Hello,
I’m trying to do aspect-oriented programming in C++
and found this library which is almost up to speed to do it (but not
quite). The documentation is rather incomplete (with respect to AOP at least)
but the relevant code itself seems pretty complete (although I can’t
quite figure out how to use it for AOP J).
http://www.cdiggins.com/bil.html
Does anyone here have experience with the BIL and/or AOP in
C++? The specific problem I’m having is using an
‘interface’ as a ‘pointcut’. The docs seem to
indicate that an interface is a pointcut, but when I try substituting it in as
the ‘aspect’ class’ pointcut_type, I get this error:
1>c:\expedia\ems\ads\lib\boost\boost_1_37\boost\interfaces\crosscut.hpp(59)
: error C2039: 'generator' : is not a member of 'Ic'
1>
c:\expedia\ems\devs\v-jleonard\aspect_test\aspect_test\aspect_test.cpp(12) :
see declaration of 'Ic'
1>
c:\expedia\ems\ads\lib\boost\boost_1_37\boost\mpl\aux_\preprocessed\plain\apply_wrap.hpp(39)
: see reference to class template instantiation
'boost::interfaces::detail::crosscut_impl<Aspects>::generator_impl<Derived,Flags,Base>::merge::apply<Aspect>'
being compiled
1> with
1> [
1>
Aspects=boost::mpl::list<log_aspect,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na>,
1>
Derived=boost::interfaces::crosscut_interface<c,log_aspect>,
1>
Flags=boost::interfaces::flags::default_,
1>
Base=boost::interfaces::detail::empty_base,
1>
Aspect=boost::interfaces::aspect<Ic,log_advice>
1> ]
1>
c:\expedia\ems\ads\lib\boost\boost_1_37\boost\mpl\aux_\preprocessed\plain\apply.hpp(43)
: see reference to class template instantiation
'boost::mpl::apply_wrap1<F,T1>' being compiled
1> with
1> [
1>
F=boost::interfaces::detail::crosscut_impl<boost::mpl::list<log_aspect,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na>>::generator_impl<boost::interfaces::crosscut_interface<c,log_aspect>,boost::interfaces::flags::default_,boost::interfaces::detail::empty_base>::merge,
1>
T1=boost::interfaces::aspect<Ic,log_advice>
1>
]
It seems that interface_base has a ‘generator’
member, but the BOOST_IDL_END
macro derives interfaces from interface_base::type instead.
I realize this isn’t yet an official boost library, but it deals with a
great many of the same techniques/ideas [and relies on a lot of underlying
boost functionality] so any help you can offer would be much appreciated!
[My code is attached and the BIL code can be downloaded here: http://www.coderage.com/interfaces/].
Thanks,
Jonathan
P.S. if anyone knows of alternate ways of pulling off AOP in
C++, I’d be open to that too!