../../AspectXLib/ParameterDatabase/ParameterDatabase/aspects/BaseParameter.axDC_BasicDatabase
is used as a component that stores the parameter data of target class.
The DC_BasicDatabase class extends the abstract class
ParameterDatabase.
Both classes are defined and implemented in
OBS Framework.
These aspect programs replace all three member variables in class SampleClass
by respective method calls setParameter() and getParameterXXX() of class
DC_BasicDatabase. String XXX stands for data type of member variable being replaced.
In this example it is assumed that member variable names starts with underline ( _ )
character.
For each member variable there is as parameter identifier woven in the base code.
Parameter identifier is a constant in the form PDxxx where
"xxx" is member variable name in upper case. Parameter identifiers are used
to uniquely identify the parameters stored in the parameter database.
Methods getParameterXXX() takes the parameter identifiers as their parameters.
Methods setParameter() have two parameters. The first one is
the parameter identifier, the second one is the new value of the parameter
that is to be stored in the database.
This aspect contains advices that adds parameter database variable declaration
and initialization code to the base code. It also adds necessary #include
preprocessor directives.
This aspect program uses pointcuts defined in file PointcutLibrary.xml.
(PointcutLibrary.ax)Pointcuts | |
| unit | targetClassDeclaration |
| class | targetClass |
Advices | |
| add | addConstants |
|
Add constants to the class declaration | |
| add | addIncludesToDeclaration |
|
Add the #include preprocessor instructions | |
| add | addDatabaseReference |
|
Add declaration of pointer to parameter database to target class | |
| begin | addDatabaseInicialization |
|
Add code fragment that initialize the parameter database | |
Triplet: unit add declaration
PDxxx where "xxx" is member
variable name in upper case. For example constant PD_WIDTH is the parameter identifier of
the member variable _width.
Refers to global pointcut: unit targetClassDeclaration (PointcutLibrary)
Triplet: unit add include
#include preprocessor instructions.
Declaration of class TD_DatabaseId is needed in order to define parameter identifiers,
this data type is defined in header file GeneralInclude/BasicTypes.h. The pointer to
parameter database has to be defined in the class definition. Therefore the header file
Data/DC_BasicDatabase.h has to be included as well.
Refers to global pointcut: unit targetClassDeclaration (PointcutLibrary)
Triplet: class add declaration
DC_BasicDatabase* and is named pDB. It is declared as private.
Refers to global pointcut: class targetClass (PointcutLibrary)
Triplet: constructor begin codeFragment
pDB)Local Pointcut: constructor (source)