AspectC++
lastmod 2018-08-17created 2014-01-047 edits
AspectC++ is an aspect-oriented extension of C and C++ languages. It has a source-to-source compiler, which translates AspectC++ source code into compilable C++. The compiler is available under the GNU GPL, though some extensions specific to Microsoft Windows are only available through pure-systems GmbH.
Aspect-oriented programming allows modularizing cross-cutting concerns in a single module, an aspect. Aspects can modify existing classes, but most commonly they provide 'advice' that runs before, after, or around existing functionality.
Example
All calls to a specific function can be traced using an aspect, rather than inserting 'cerr' or print statements in many places:
aspect Tracer
{
advice call("% %Iter::Reset(...)") : before()
{
cerr << "about to call Iter::Reset for " << JoinPoint::signature() << endl;
}
};
See also
Favorite site
- AspectC++ web site
- Wikipedia (en) description of AspectC++
- Eclipse AspectC/C++ Development Tools
- About AOP (Aspect Oriented Programming) and.. aspect C++ 1
- The possibility of native AOP in C++
- Beyond object orientation to aspect orientation
References
-
AOP(Aspect_Oriented_Programming)_and_aspect_C++.pdf ↩