<html><body>
<DIV>I'm exploring aspects that have multiple concerns in them...</DIV>
<DIV> </DIV>
<DIV>For example, Caching is a concern that can be implemented in an aspect. </DIV>
<DIV>In addition, we could have a Caching aspect that not only uses around advice to 'intercept'</DIV>
<DIV>calls and return precomputed values, but also keeps track of the number of 'hits' and 'misses' for</DIV>
<DIV>each function that it is caching. Each separate function of course has a separate cache</DIV>
<DIV>(e.g. static map <key,value>) and separate hit/miss stats. This can be useful, because</DIV>
<DIV>caching a function that rarely recomputes the same value will not save run time...</DIV>
<DIV> </DIV>
<DIV>One could argue that tracking the stats of a cache is a separate concern of the cacher, in</DIV>
<DIV>the same way that adding caching code directly to each method is adding an extra concern</DIV>
<DIV>to the functions.</DIV>
<DIV> </DIV>
<DIV>I've created a Cache that tracks stats per join point, but one thing I am trying</DIV>
<DIV>(not so successfully) is to use to two aspects -- one to implement Caching using</DIV>
<DIV>around advice and a Cache class, and another to implement calls to the Cache class</DIV>
<DIV>from the CachingAspect.</DIV>
<DIV> </DIV>
<DIV>So, in a nutshell, I want to create an aspect that captures calls from inside another aspect.</DIV>
<DIV>This is kind of like AspectJ's adviceexecution, but I don't believe AspectC++ has that.</DIV>
<DIV> </DIV>
<DIV>What I have found from experimenting with a trivial case (not even caching) is that I</DIV>
<DIV>can have:</DIV>
<DIV> AspectA, which calls a function HELLO</DIV>
<DIV> AspectB, which uses the execution pointcut of HELLO</DIV>
<DIV> </DIV>
<DIV>BUT, if AspectB tries to use call("% HELLO(...)") instead of execution (so that it's</DIV>
<DIV>weaving inide of AspectA) or if AspectB tries to use something like </DIV>
<DIV> JoinPoint::signature() </DIV>
<DIV>even with the execution joinpoint, I get errors when the woven code is compiled.</DIV>
<DIV> </DIV>
<DIV>I'm guessing that trying to weave into another aspect's advice or access JoinPoint</DIV>
<DIV>info there is not supported, but without doing this the second aspect doesn't have</DIV>
<DIV>enough context to be able to do anything useful...</DIV>
<DIV> </DIV>
<DIV>Here's an example of the aspect file that works. It has an Advisor</DIV>
<DIV>aspect that calls HELLO, and a Monitor aspect that weaves against</DIV>
<DIV>the execution of HELLO but doesn't use JoinPoint information</DIV>
<DIV>(since the joinpoint would occur when Advisor's advice calls HELLO).</DIV>
<DIV> </DIV>
<DIV>#include <iostream><BR>#include <map><BR>#include <string></DIV>
<DIV>void HELLO() { std::cerr << " IN HELLO" << std::endl; }</DIV>
<DIV>aspect Advisor {<BR> pointcut CallCircleArea() = call("% CircleArea(...)");</DIV>
<DIV> advice CallCircleArea() : around()<BR> {<BR> HELLO();<BR> tjp->proceed();<BR> std::cerr << " In Advisor aspect..." << std::endl;<BR> }<BR>};</DIV>
<DIV>aspect Monitor {<BR> pointcut Hello() = execution("% HELLO(...)");<BR> advice Hello() : before() {<BR> std::cerr << " In Monitor, about to call HELLO ............." << std::endl;<BR> }<BR>};<BR></DIV>
<DIV> </DIV>
<DIV>Is this aspects that weave into other aspects beyond the scope of what AspectC++ can currently do,</DIV>
<DIV>or am I just missing something? </DIV>
<DIV> </DIV>
<DIV>Thanks!</DIV>
<DIV>-Mike Mortensen</DIV></body></html>