The table below lists the syntactical constructs that are specific to the C++ language and that are used in the OBS Framework code. For each construct, a brief explanation of why it is included is given. Language features and constructs that are not explicitly listed in the table are never used in the framework code. The selected constructs represent a small subset of all the constructs offered by the C++ language and they in particular exclude all its dangerous or ambiguous features.
Construct | Justification for Inclusion |
---|---|
Class | Classes are needed to encapsulate logically related data and the functions to manipulate them. |
Virtual Methods | Virtual methods are needed as an adaptation mechanism to allow the default behaviour encapsulated in a framework class to be adapted to the needs of a specific application. |
Pure Virtual Methods | Pure virtual methods are needed to mark adaptation points for which no default implementation is provided. |
Single Inheritance | Inheritance is needed for two purposes: to provide concrete implementations for a pure virtual class and to adapt a concrete class by overriding one or more of its virtual methods. |
Method Inlining | Method inlining is needed to improve execution speed. In order to avoid any
negative impacts on code size, it is used in only two situations. Firstly, it
may be used with accessor methods (so-called "getter" and "setter" methods) that
simply get or set the value of an atomic property. Secondly, it may be used
where a method is implemented by delegation to another method (for an example,
see method createEventReport in class CC_RootObject ) |
Constant Methods | Constant methods are needed as a safety feature to prevent some methods from modifying class variables. |
Constant Variables | Constant variables are needed as a safety feature to enforce the non-modifiability of some variables. |
Enumerator Types | Enumerator types are needed as a safety feature to constrain the values of certain variables. |