请输入您要查询的百科知识:

 

词条 AspectC++
释义

  1. Example

  2. References

  3. External links

{{Infobox software
| name = AspectC++ Compiler
| logo =
| logo caption =
| screenshot =
| caption =
| collapsible =
| author =
| developer = Olaf Spinczyk (project leader), Georg Blaschke, Christoph Borchert, Benjamin Kramer, Daniel Lohmann, Horst Schirmeier, Ute Spinczyk, Reinhard Tartler, Matthias Urban [1]
| released = {{start date and years ago|2001|11|06}} [2]
| discontinued =
| latest release version = 2.2
| latest release date = {{Start date and age|2017|03|10|df=yes/no}}
| latest preview version =
| latest preview date =
| programming language = C++
| operating system = Cross-platform
| platform =
| size =
| language =
| status =
| genre = Source-to-source Compiler
| license = GPL 2+
| alexa =
| website = {{URL|http://www.aspectc.org}}
}}

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

1. ^http://www.aspectc.org/Contact.php
2. ^http://www.aspectc.org/releases/0.5/ChangeLog-0.5

External links

  • AspectC++
  • Articles on aspect-oriented programming and AspectC++ at past AOSD conferences
{{aosd}}{{soft-eng-stub}}

2 : Aspect-oriented programming|C++ programming language family

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/11 12:06:06