[aspectc-user] slice-class
J. Liebig
joerg.liebig at st.ovgu.de
Wed Jun 18 14:26:42 CEST 2008
Hi,
I've a question concerning advices with slice-classes.
Conside the following example:
class FOO_A {
public:
const char * _st;
FOO_A() :
_st("foo - a") {
}
};
class FOO_B {
public:
const char * _st;
FOO_B() :
_st("foo - b") {
}
};
I'm using the following aspect to weave a static
introduction into both classes.
#ifndef __TEST_AH__
#define __TEST_AH__
#
#include <iostream>
using namespace std;
aspect Bar1 {
pointcut iprint() = "FOO_A" || "FOO_B";
advice iprint() : slice class {
public:
void print() {
cout << _st << endl;
return;
}
};
};
#endif // __TEST_AH__
If I want to add a second aspect called Test2.ah
to it, this ones doesn't appear in the resultcode:
#ifndef __TEST_AH__
#define __TEST_AH__
#
#include <iostream>
using namespace std;
aspect Bar2 {
pointcut iprint2() = "FOO_A" || "FOO_B";
advice iprint2() : slice class {
public:
void print2() {
cout << "in bar2" << endl;
return;
}
};
};
#endif // __TEST_AH__
According to the output of the ac++ compiler the file
Test2.ah is also used. But now code is inserted into
class FOO_A or class FOO_B. I found out that the order
of weaving aspects depends on the alphanumeric order
of the files holding the aspects.
How can I fix the problem above?
best regards,
jl
More information about the aspectc-user
mailing list