[aspectc-user] Problem with advice ordering.

Panu Bloigu panu.bloigu at mbnet.fi
Tue Nov 14 11:18:22 CET 2006


Hello again you all and thank you for putting your time in answering my
questions. However, one more question about advice ordering. I have the
following two aspects:

==============
File: Inner.ah
==============
#ifndef INNER_AH_
#define INNER_AH_
#include <iostream>
aspect Inner
{
        pointcut pc() = "void ClassA::method()";
        advice execution(pc()) : before()
        {
                std::cout<<"Inner.\n";
        }
};
#endif

and

==============
File: Outer.ah
==============
#ifndef OUTER_AH_
#define OUTER_AH_
#include <iostream>
aspect Outer
{
        pointcut pc() = "void ClassA::method()";
        advice "ClassA" : order("Outer", "%" && !"Outer");
        advice execution(pc()) : before()
        {
                std::cout<<"Outer.\n";
        }
};
#endif

As I have understood, the order advice in this case should affect the
execution of ClassA's method() so that first the text "Outer" gets printed
and then the text "Inner" and finally methdod()'s body gets executed.
However, this is not the case. The text "Inner" appears allways first.
Again, I'm pretty sure there's just some little thing I'm missing. Probably
there's something wrong in my order declaration, but I just can't figure
it out.

Panu.






More information about the aspectc-user mailing list