[aspectc-user] return value from around advice

Olaf Spinczyk os at aspectc.org
Wed May 27 09:29:22 CEST 2009


Hi Steven,

in order to modify the return value by around (or after) advice use the
join point API:

*tjp->result() = new DerivedObject;

Note that this is "generic advice", i.e. the type of *tjp->result()
depends on the matched function call. For join points where
DerivedObject is not compatible with the result type the advice will not
work.

Cheers,

Olaf

steven schrieb:
>
> hi,
>
> I have a factory method and want weave a specific construction into it.
> so, is it possible to return a value from an around advice like this:
>
> advice call("Object* Factory::createObject()"): around(){
>     return new DerivedObject();   
> }
>
> ?
>
>
> cheers,
>
> steven
> _______________________________________________
> aspectc-user mailing list
> aspectc-user at aspectc.org
> http://www.aspectc.org/mailman/listinfo/aspectc-user
>




More information about the aspectc-user mailing list