#ifndef ADVISE_PI
#define ADVISE_PI

#include <string>
#include <iostream>

using namespace std;

aspect AdvisePI {

   pointcut call_pi_within_Circle() =
      call("% getPI()") && within("Circle");

   pointcut exec_pi() = execution("% getPI()");

   pointcut call_pi_within_CircleArea1() =
      call("% getPI()") && within("% %::CircleArea(...)");

   pointcut call_pi_within_CircleArea2() =
      call("% getPI()") && within("CircleArea");

/*    pointcut CircleAreaExec() = execution("% CircleArea(...)");
    pointcut call_pi_within_CircleArea3() = 
      call("% getPI()") && within(CircleAreaExec());  // ILLEGAL!
*/

   pointcut call_pi_within_CircleArea() = call_pi_within_CircleArea1() ||
					  call_pi_within_CircleArea2();

   advice call_pi_within_CircleArea() : before()
   {
      cerr << "AOP: About to call PI within CircleArea function, JoinPoint="
	   << JoinPoint::signature() << endl;
   }

   advice call_pi_within_Circle() : before()
   {
      cerr << "AOP: About to call PI within Circle class, JoinPoint="
	   << JoinPoint::signature() << endl;
   }

   advice exec_pi() : before()
   {
      cerr << "AOP: About to exec PI, JoinPoint="
	   << JoinPoint::signature() << endl;
   }


};
#endif
