AspectC++: Difference between revisions
m Whitespace |
change pipe link to redirect: the text is actually the article title source-to-source compiler |
||
Line 25: | Line 25: | ||
| website = {{URL|http://www.aspectc.org}} |
| website = {{URL|http://www.aspectc.org}} |
||
}} |
}} |
||
'''AspectC++''' is an [[Aspect-oriented programming|aspect-oriented]] extension of [[C (programming language)|C]] and [[C++]] languages. It has a [[ |
'''AspectC++''' is an [[Aspect-oriented programming|aspect-oriented]] extension of [[C (programming language)|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 General Public License|GNU GPL]], though some [[computing|extensions]] specific to [[Microsoft Windows]] are only available through pure-systems GmbH. |
||
[[Aspect-oriented programming]] allows modularizing cross-cutting concerns in a single [[Programming language|module]], an [[computer science|aspect]]. |
[[Aspect-oriented programming]] allows modularizing cross-cutting concerns in a single [[Programming language|module]], an [[computer science|aspect]]. |
Revision as of 20:40, 25 November 2019
Developer(s) | Olaf Spinczyk (project leader), Georg Blaschke, Christoph Borchert, Benjamin Kramer, Daniel Lohmann, Horst Schirmeier, Ute Spinczyk, Reinhard Tartler, Matthias Urban [1] |
---|---|
Initial release | November 6, 2001[2] |
Stable release | 2.2
/ 10 March 2017 |
Written in | C++ |
Operating system | Cross-platform |
Type | Source-to-source Compiler |
License | GPL 2+ |
Website | www |
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;
}
};
The Tracer aspect will print out a message before any call to %Iter::Reset
. The %Iter
syntax
means that it will match all classes that end in Iter.
Each 'matched' location in the source code is called a join point—the advice is joined to (or advises) that code. AspectC++ provides a join point API to provide and access to information about the join point. For example, the function:
JoinPoint::signature()
returns the name of the function (that matched %Iter::Reset
) that is about to be called.
The join point API also provides compile-time type information that can be used within an aspect to access the type or the value of the arguments and the return type and return value of a method or function.
References
External links