[aspectc-user] Aspects inheritance problem ?

Bartosz Blimke masb at chorwacja.com
Fri May 28 10:19:45 CEST 2004


Hi,

According to the Olaf's advice for workaround
for problem about intercepting cflow() of a aspect method,
I've been trying to implement this solution,
and I found next problem.

Here is the source code:

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

void func () {
   printf ("func\n");
}

int main () {
   func ();
   return 0;
}
---------

Aspect.ah
-----------
#ifndef __Aspect_ah__
#define __Aspect_ah__



aspect Aspect {

   void run(AC::Action &action);

   pointcut virtual methods() = 0;

   advice methods() && !cflow(execution("% Aspect::run(...)")) :
	around () {
     run(tjp->action ());
   }

};

#endif // __Aspect_ah__
----------


Aspect.cpp
-----------
#include "Aspect.ah"

void Aspect::run(AC::Action &action)
{
     action.trigger();
}
-------------

DerivedAspect.ah
-----------
#ifndef _DerivedAspect_ah_
#define _DerivedAspect_ah_

#include "Aspect.ah"

aspect DerivedAspect : public Aspect
{
	pointcut methods() = execution("% func()");

	pointcut virtual methods2() = 0;

	void run2(AC::Action &action);
};

#endif //_DerivedAspect_ah_
------------


DerivedAspect.cpp
-----------
#include "DerivedAspect.ah"


void DerivedAspect::run2(AC::Action &action)
{
     action.trigger();
}
------------

FinalAspect.ah
-------------
#ifndef _FinalAspect_ah_
#define _FinalAspect_ah_

#include "DerivedAspect.ah"

aspect FinalAspect : public DerivedAspect
{
	pointcut methods() = execution("% func()");

	pointcut methods2() = execution("% func()");

};

#endif
---------------


When I try to compile this code I have:

Compiling...
weaving ... .\DerivedAspect.cpp -> Debug\DerivedAspect.cpp
compiling ... DerivedAspect.cpp
FinalAspect.ah(2) : error C2504: 'DerivedAspect' : base class undefined
Compiler failed for DerivedAspect.cpp


I should add that this is only code to show the problem,
without any special funcionality.

I have no idea how to solve the problem,
have I done something wrong, or the weaver doesn't generate
correct code ?


Greets,

Bartek



More information about the aspectc-user mailing list