#pragma once #include "JPTL.h" #include using namespace std; template struct Printer { template static void exec(T obj, bool* proceed) { if(*proceed) { cout << TypeInfo::signature() << endl; } *proceed = true; } // EXEC is optional, and so is the specialization for void (initial EXEC) struct EXEC { enum { BASES = CONTEXT::BASES + TypeInfo::BASECLASSES }; }; }; template struct Printer { // initial EXEC struct EXEC { enum { BASES = 0 }; }; }; template struct MemberView { struct EXEC { enum { SIZE = CONTEXT::SIZE + sizeof(typename MemberInfo::ReferredType) }; }; template static void exec(T obj) { cout << "+ " << sizeof(*MemberInfo::pointer(obj)) << " = " << EXEC::SIZE << endl; } }; template struct MemberView { // initial EXEC struct EXEC { enum { SIZE = 0 }; }; }; template struct FunctionCount { struct EXEC { enum { COUNT = CONTEXT::COUNT + 1 }; }; }; template struct FunctionCount { struct EXEC { enum { COUNT = 0 }; }; }; aspect TestAspect { advice "%" && !"TestAspect" : slice class { public: //int should_not_work[AC::TypeInfo::MEMBERS]; //THIS yields the TypeInfo of the BASE CLASS :-( : FIXME! typedef JPTL::BaseIterator bit; typedef JPTL::MemberIterator mit; typedef JPTL::FunctionIterator fit; }; advice execution("%" && !"TestAspect") : after() { cout << "*** BaseIterator ***" << endl; bool result = true; JoinPoint::That::bit::exec(tjp->that(), &result); cout << "BASES: " << JoinPoint::That::bit::EXEC::BASES << endl; cout << "*** MemberIterator ***" << endl; JoinPoint::That::mit::exec(tjp->that()); cout << "SIZE: " << JoinPoint::That::mit::EXEC::SIZE << endl; cout << "*** FunctionIterator ***" << endl; cout << "COUNT: " << JoinPoint::That::fit::EXEC::COUNT << endl; } };