[aspectc-user] (no subject)

Olaf Spinczyk Olaf.Spinczyk at informatik.uni-erlangen.de
Thu May 15 15:38:58 CEST 2003

Hi Sven,

Sven.Apel at metop-md.de wrote:
> Hallo,
> I have a problem with a pointcut declaration. Here is code example:
> int A::method_a()
> {
>         int i;
>         ...                        <---------------------
>         i = B::method_b();
>         ...                        <---------------------
>         return i;
> }
> I want to add code before and after the call off B::method_b() but only 
> inside A::method_a().
> How can I express this with a pointcut?
> best regards
> Sven

You can capture the call to B::method_b() with 'call("% 
B::method_b()")'. The intersection of these join points with all join 
points within the class A give you all calls to method_b inside class A:

call("% B::method_b()") && within("A")

This is, of coarse, not what you wanted, but describes the idea. 
Selecting all join point within method_a() is not yet implemented in 
ac++. However, future releases will support this with the same syntax:

call("% B::method_b()") && within("% A::method_a()")  <-- not yet!

I hope that the first pointcut shown here is already sufficient for you. 
If not, tell me.



More information about the aspectc-user mailing list