Helper class in order to manipulate IParameter and IParameter values natively. More...
Public Member Functions | |
Construction | |
TParameterHandler (void) | |
Default construction, does nothing. | |
TParameterHandler (OpenViBE::Kernel::IParameter *pParameter) | |
IParameter based construction. | |
Initialization | |
OpenViBE::boolean | initialize (OpenViBE::Kernel::IParameter *pParameter) |
Connects this parameter handler to a concrete IParameter pointer. | |
OpenViBE::boolean | uninitialize (void) |
Disconnects this parameter handler from its concrete IParameter pointer. | |
OpenViBE::boolean | exists (void) const |
Checks whether this handler is connected to a concrete IParameter or not. | |
Transparent operators | |
operator T (void) const | |
Handled object type cast. | |
T | operator-> (void) const |
Handled object type member access operator. | |
TParameterHandler< T > & | operator= (const T &t) |
Affectation operator. | |
Reference target management | |
OpenViBE::boolean | clearReferenceTarget (void) |
Clears all reference targets. | |
OpenViBE::boolean | setReferenceTarget (OpenViBE::Kernel::TParameterHandler< T > &rParameterHandler) |
Sets a new reference target. | |
OpenViBE::boolean | setReferenceTarget (OpenViBE::Kernel::IParameter *pParameter) |
Sets a new reference target. | |
OpenViBE::boolean | setReferenceTarget (T &t) |
Sets a new reference target. | |
Protected Attributes | |
OpenViBE::Kernel::IParameter * | m_pParameter |
Handled parameter. |
Detailed Description
template<typename T>
class OpenViBE::Kernel::TParameterHandler< T >
Helper class in order to manipulate IParameter and IParameter values natively.
- Date:
- 2007-11-21
- See also:
- IParameter
- EParameterType
The purpose for this template is to help user code to manipulate IParameter abstract class and it's associated value. Client code should probably use this template better than IParameter directly. The template argument is the handled data type :
- for
ParameterType_Integer
:OpenViBE::int64
- for
ParameterType_UInteger
:OpenViBE::uint64
- for
ParameterType_Boolean
:OpenViBE::boolean
- for
ParameterType_Float
:OpenViBE::float64
- for
ParameterType_String
:OpenViBE::CString
- for
ParameterType_Identifier
:OpenViBE::CIdentifier
- for
ParameterType_Matrix
:OpenViBE::IMatrix*
- for
ParameterType_StimulationSet
:OpenViBE::IStimulationSet*
- for
ParameterType_MemoryBuffer
:OpenViBE::IMemoryBuffer*
- for
ParameterType_Object
:OpenViBE::IObject*
- for
ParameterType_Pointer
:OpenViBE::uint8*
The idea is to connect the handler to the corresponding IParameter object thanks to the initialize
function. Then the provided interface translates handled object native operation to generic IParameter operations automatically. Moreover, the handler is able to provide the handled object's interface thanks to an automatic cast operator.
Constructor & Destructor Documentation
TParameterHandler | ( | OpenViBE::Kernel::IParameter * | pParameter | ) | [inline] |
IParameter based construction.
- Parameters:
-
pParameter [in] : the parameter to use for the initialization
This constructor considers the parameter handler to be connected to the provided parameter. This is equivalent to using the default constructor and call the initialize function with the provided IParameter pointer.
Member Function Documentation
OpenViBE::boolean initialize | ( | OpenViBE::Kernel::IParameter * | pParameter | ) | [inline] |
Connects this parameter handler to a concrete IParameter pointer.
- Parameters:
-
pParameter [in] : the concrete parameter to connect to (it can not be NULL
)
- Returns:
- true in case of success.
- false in case of error.
Future calls to this handler will be redirected to the concrete parameter object.
OpenViBE::boolean uninitialize | ( | void | ) | [inline] |
Disconnects this parameter handler from its concrete IParameter pointer.
- Returns:
- true in case of success.
- false in case of error.
This handler won't be usable until initialize
is called successfully again.
OpenViBE::boolean exists | ( | void | ) | const [inline] |
Checks whether this handler is connected to a concrete IParameter or not.
- Returns:
- true if this handler is connected to a concrete IParameter, false if not
operator T | ( | void | ) | const [inline] |
Handled object type cast.
- Returns:
- The handled object itself
This cast operator allows the handler to be used as if it was the handled object itself. For example, an unsigned integer parameter handler is usable in arithmetic operations :
// l_oParameter will directly be used as if it is an unsigned integer
TParameterHandler<uint64> l_oParameter ( ... );
uint64 a= ...;
uint64 c=a*l_oParameter+l_oParameter;
References IParameter::getValue(), and TParameterHandler< T >::m_pParameter.
T operator-> | ( | void | ) | const [inline] |
Handled object type member access operator.
- Returns:
- The handled object itself for access operation
This operator allows the handler to be used as if it was the handled object itself. For example, a matrix parameter handler is usable as if it was a matrix pointer :
// l_oParameter will directly be used as if it is a matrix pointer
TParameterHandler<IMatrix*> l_oParameter ( ... );
l_oParameter->setDimensionCount(2);
TParameterHandler<T>& operator= | ( | const T & | t | ) | [inline] |
Affectation operator.
- Returns:
- This handler itself
This operator allows to affect handled object type values to the handled object itself. For example, an unsigned integer parameter handler can be affected this way :
// the affectation of l_oParameter will directly go to its handled unsigned integer
TParameterHandler<uint64> l_oParameter ( ... );
l_oParameter = 1;
OpenViBE::boolean clearReferenceTarget | ( | void | ) | [inline] |
Clears all reference targets.
- Returns:
- true in case of success.
- false in case of error.
OpenViBE::boolean setReferenceTarget | ( | OpenViBE::Kernel::TParameterHandler< T > & | rParameterHandler | ) | [inline] |
Sets a new reference target.
- Parameters:
-
rParameterHandler [in] : a parameter handler of the same type as this parameter handler
- Returns:
- true in case of success.
- false in case of error.
OpenViBE::boolean setReferenceTarget | ( | OpenViBE::Kernel::IParameter * | pParameter | ) | [inline] |
Sets a new reference target.
- Parameters:
-
pParameter [in] : a parameter to use as reference target
- Returns:
- true in case of success.
- false in case of error.
OpenViBE::boolean setReferenceTarget | ( | T & | t | ) | [inline] |
Sets a new reference target.
- Parameters:
-
t [in] : a value to use as reference target
- Returns:
- true in case of success.
- false in case of error.
Generated on Tue Jun 26 2012 15:25:54 for Documentation by 1.7.4