[aspectc-user] Defining an Aspect Instantiation Model
Olaf Spinczyk
Olaf.Spinczyk at informatik.uni-erlangen.de
Fri Aug 19 22:13:53 CEST 2005
Hi Sergio,
your problem is the same as the one reported by Sylvain Meunier at the
beginning of august on this mailing list. It is a bug in ac++ 0.9.3 :-(.
You can solve the problem by going back to version 0.9.2.
The problem is already fixed in our internal development version. You
can expect that your example code will also work with the next ac++
version, on which we are currently working urgently.
Sorry for this problem,
Olaf
Sergio Queiroz wrote:
>Hi,
>
>I am trying to define an aspect in such way that every instance of a class has
>an different aspect instance associated.
>
>I tried to follow the examples in the AspectC++ - A Language Overview and in
>the AspectC++ Language Reference but they did not work :(
>
>When I try to compile my example with "ag++ -o main main.cpp -Wall" I get the
>following message:
>
>myaspect.ah:9: warning: all member functions in class `MyAspect' are private
>myclass.h:22: error: field `myInstance' has incomplete type
>error: Execution failed: "g++" -xc++ "main.acc" -xnone -Wall -o "main"
>
>So, the first line of the message is easy to avoid but I could not declare the
>variable myInstance.
>
>I am attaching my source code.
>
>Sérgio
>
>------------------------------------------------------------------------
>
>#include "myclass.h"
>
>#include <iostream>
>
>using namespace std;
>
>int
>main() {
> MyClass m1, m2;
>
> m1.setM (8);
>
> m2.setM (7);
>
> cout << m1.getM () << endl;
>
> cout << m2.getM () << endl;
>
> return 0;
>}
>
>------------------------------------------------------------------------
>
>#ifndef MYCLASS_H
>#define MYCLASS_H
>
>class MyClass {
>
> public:
>
> MyClass () {
> m = 4;
> }
>
> int getM () {
> return m;
> }
>
> void setM (int a) {
> m = a;
> }
>
> private:
> int m;
>};
>
>#endif // MYCLASS_H
>
>------------------------------------------------------------------------
>
>_______________________________________________
>aspectc-user mailing list
>aspectc-user at aspectc.org
>http://www.aspectc.org/mailman/listinfo/aspectc-user
>
More information about the aspectc-user
mailing list