[aspectc-user] Intercepting execution of nested class

Bartosz Blimke masb at chorwacja.com
Mon Jun 7 14:50:03 CEST 2004


Another problem :)

During experiments on previosu problem I have found another one:

lets take a code like this:

//main.cpp
#include <stdio.h>


void func () {

   printf ("func\n");
}


class Class1
{
public:
	class Class2
	{
	public:
	  void func1()
	  {
		  printf("Class1::Class2::func1\n");
	  }
	} class2Instance;
};


int main (int argc, char * argv[]) {
   func ();
   Class1 class1;
   class1.class2Instance.func1();
   return 0;
}
//end of main.cpp



//Aspect.ah
#ifndef __Aspect_ah__
#define __Aspect_ah__

#include <stdio.h>

aspect Aspect {

	pointcut methods() = execution("% ...::func1(...)");

	advice methods() : before()
	{
            printf("before %s\n", thisJoinPoint->signature());
	}

};
#endif // __Aspect_ah__
//endo of Aspect.ah



This code doesnt work becouse pointcut doesn't seem to
be correct.
How can I define pointcut to intercept method of nested class:

"% Class1::Class2::func1(...)" doesnt work too.


Greets,

Bartosz Blimke
masb at chorwacja.com




More information about the aspectc-user mailing list