../../AspectXLib/ParameterDatabase/ParameterDatabase/aspects/GetParameter.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 two advices. They replace member
variables with pDB->getParameterInt()
or pDB->getParameterInt() method calls.
This aspect program uses pointcuts defined in file PointcutLibrary.xml.
(PointcutLibrary.ax)Pointcuts | |
| name | targetIntNameGetter |
| name | targetFloatNameGetter |
Advices | |
| replace | targetIntNameGetter |
|
Replace integer member variable with the pDB->getParameterInt() method call | |
| replace | targetFloatNameGetter |
|
Replace float member variable with the pDB->getParameterFloat() method call | |
Triplet: name replace codeFragment
pDB->getParameterInt() method call.
Only those member variable occurrences are replaced where the value of the variable is not
changed. Other cases, where the value is changed, are covered by advice
targetIntExprSetter.
For example member variable _width is replaced with
pDB->getParameterInt(DB_WIDTH) where the substring
_WIDTH is automatically generated from the
variable name.
Refers to global pointcut: name targetIntNameGetter (PointcutLibrary)
Triplet: name replace codeFragment
pDB->getParameterFloat() method call.
Only those member variable occurrences are replaced where the value of the variable is not
changed. Other cases, where the value is changed, are covered by advice
targetFloatExprSetter.
For example member variable _flt is replaced with
pDB->getParameterFloat(DB_FLT) where the substring
_FLT is automatically generated from the
variable name.
Refers to global pointcut: name targetFloatNameGetter (PointcutLibrary)