GetParameter Aspect
[ParameterDatabase Group]

This aspect is defined in file: ../../AspectXLib/ParameterDatabase/ParameterDatabase/aspects/GetParameter.ax

Aspect Description

Inserts function calls that replaces member variables where the value of the variable is not updated. One of fours sample aspect programs that modifies the component to access all its parameters from a parameter database. This group of aspect programs show an example of how the implementation of selected classes in a certain code base can be modified to change the way in which member variables are handled. In this example, all member variables in the base code are moved to a dedicated object called parameter database (see Parameter Database Design Pattern).

The DC_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.
Author:
A. Pasetti, O. Rohlik
See also:
PointcutLibrary
BaseParameter
SetParameter
Includes:
PointcutLibrary(PointcutLibrary.ax)

Pointcuts

nametargetIntNameGetter
 
nametargetFloatNameGetter
 

Advices

replacetargetIntNameGetter
  Replace integer member variable with the pDB->getParameterInt() method call
replacetargetFloatNameGetter
  Replace float member variable with the pDB->getParameterFloat() method call

Pointcut Documentation

name targetIntNameGetter (source)
name targetFloatNameGetter (source)

Advice Documentation

replace targetIntNameGetter (source)

Triplet: name replace codeFragment

Replace integer member variable with the 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)

replace targetFloatNameGetter (source)

Triplet: name replace codeFragment

Replace float member variable with the 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)