[aspectc-user] Reflection in AspectC++
Andreas Gal
gal at cs.fau.de
Sat Oct 26 20:51:44 CEST 2002
Hi Youssef,
we offer reflection for join points in AspectC++. The Trace example shows
how to determine the type of argument types. You can use C++ RTTI
(run-time type information) to some degree to reflect on the classes
generated by AspectC++ (every aspect is internally represented as a
class at runtime). General reflection support to the degree Java supports
it (dynamic method invocation, for example), however, is out of scope for
AspectC++. This is simply a missing feature in C++. I could imagine you
could use PUMA to add reflection capabilities to C++. Once we have
released the PUMA and AspectC++ source code maybe somebody decides to
write a reflective extension to C++ based on PUMA.
As far as aspect instanciation is concerned, AspectC++ behaves slightly
different from AspectJ. Every aspect (to be precise the class used
at runtime to represent the aspect) has a static method "aspectOf", which
returns the aspect instance. If no aspectOf implementation is supplied by
the programmer, AspectC++ generates a default aspectOf() method which
always returns a pointer to a single instance of the aspect.
This code snippet is taken from the Trace example:
class TestTrace3 : public Trace {
public:
static TestTrace3 __instance;
static TestTrace3 *aspectOf () { return &__instance; }
};
Andreas
On Tue, 22 Oct 2002, Youssef Hassoun wrote:
> Hi,
>
> Questions related to AspectC++ being very similar to AspectJ.
> 1) how to solve the problems related to reflection in AspectC++ ?
> I mean, in AspectJ advices one can use Java's reflective API together
> with that of AspectJ (involving thisJointPoint) to invoke an object's
> method, for example.
> Does the aspectC++ reflective API powerful enough to allow reflective
> investigations in the advices ? If so, how ?
>
> 2) In a paper titled "AspectC++: An Aspect-oriented Extension
> of C++" the expression "instantiated aspect object" was used.
> Is it possible in AspectC++ to instantiate aspects ? How ?
> Thanks.
>
> _______________________________________________
> aspectc-user mailing list
> aspectc-user at aspectc.org
> http://www.aspectc.org/mailman/listinfo/aspectc-user
>
--
Andreas Gal, Dipl. Inf. Tel: (+49 9131) 85 28026
Univ. of Erlangen/Nuernberg, Informatik 4 Fax: (+49 9131) 85 28732
More information about the aspectc-user
mailing list