[aspectc-user] Pointcut of class constructor

Olaf Spinczyk Olaf.Spinczyk at informatik.uni-erlangen.de
Thu Apr 22 11:35:50 CEST 2004


Hi,

Bartosz Blimke wrote:
> Hello,
> 
> I would like to add some code to the constructor
> of some class from aspect. Is it possible
> to have pointcut which represents constructor ?
> 
> for example:
> 
> class Person {
> 
> public:
>     Person(){};
>     ~Person(){};
>     void sampleMethod(){};
> }
> 
> pointcut personMethods() =
>    execution(% Person::%(...));
> 
> advice personMethods() : around {
>   tjp->proceed();
>   cout << JoinPoint::signature() << endl;
> }
> 
> shows only
> 
> Person::sampleMethod(void)
> 
> Is there some way to describe constructor pointcut ?
> 
> Greets,
> 
> Bartosz Blimke

the execution of the constructor is matched by

   execution("Person::Person(...)")

Please note that this syntax is probably going to change in one of the 
next releases. However, the functionality of giving advice for an object 
constuction will remain.

Olaf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3142 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://www.aspectc.org/pipermail/aspectc-user/attachments/20040422/b71ea9da/attachment.bin>


More information about the aspectc-user mailing list