[aspectc-user] capturing variables

Jamal Siadat siadat at cpsc.ucalgary.ca
Mon Jul 25 22:30:04 CEST 2005


Hi, I'm running into something rather unusual for me that I would like to
see if ac++ has any automatic support mechanism.

I have a method in a class. in this method I'm declaring a variable (int
x), and I perform certain manipulations on it. I need to put an after
advice and somehow capture the value of x in order to perform furthur
manipulations in the advice. Is that possible? if so how would the sytax
be?

Here is an example:
in base code:
int A::a( const char *name, float b) {

   int x=7;
//perform certain manipulations at the end the value of x is 15
}


in advice:
advice execution("% A::a(...)")  :after(){
.
.
// how can I capture the value of x which is 15 in this advice considering
// that x is not defined in class A there I cant use tjp-that()
cout <<"at the end "<<x<<endl;
}

secondly would ac++ support something like:
advice execution("% A::a(...)")  :after(){
tjp->that()->B::b();
}
assuming that B is the super class of A? if not would I need my aspect to
inheret from A or B? or is there a way to perform this without furthur
inheritance?

Thanks,
Jamal




More information about the aspectc-user mailing list