OMK::TriggerBaseExtension Class Reference

Base class for trigger. More...

#include <OMKTriggerExtension.h>

Inheritance diagram for OMK::TriggerBaseExtension:

Inheritance graph
[legend]
Collaboration diagram for OMK::TriggerBaseExtension:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual ~TriggerBaseExtension ()

Protected Member Functions

 TriggerBaseExtension (OMK::ExtensibleSimulatedObject *owner, const Name &id, bool registerExtension=true)
virtual bool loadExtensionParameters (const ConfigurationParameterDescriptor *node)
 Configuration parameters loader of Extension.
virtual void preComputeParameters ()
 method.

Protected Attributes

AttributeT< float > _threshold
 The attribute of the threshold.
IAccessorT< bool > * _flagAccessor
 The flag attribute.

Detailed Description

Base class for trigger.

Module description :
See TriggerAttributeExtension and TriggerExtension.

Definition at line 148 of file OMKTriggerExtension.h.


Constructor & Destructor Documentation

TriggerBaseExtension::TriggerBaseExtension ( OMK::ExtensibleSimulatedObject owner,
const Name id,
bool  registerExtension = true 
) [protected]

Definition at line 95 of file OMKTriggerExtension.cpp.

References _threshold, and OMK::ExtensibleSimulatedObject::addAttribute().

00096 : DistanceToExtension( owner, id, registerExtension ),
00097   _threshold( Name( id.getString() + "Threshold" ), 1.0f ),
00098   _flagAccessor( 0 )
00099 {
00100   owner->addAttribute( _threshold ) ;
00101 }

TriggerBaseExtension::~TriggerBaseExtension (  )  [virtual]

Definition at line 103 of file OMKTriggerExtension.cpp.

00104 {
00105 }


Member Function Documentation

bool TriggerBaseExtension::loadExtensionParameters ( const ConfigurationParameterDescriptor node  )  [protected, virtual]

Configuration parameters loader of Extension.

Parameters:
[in] node the root node of the configuration parameter, null if no node defined for the extension.
Returns:
should return true if all the parameters are well retrieved.
Overwrite this method to initialise the extension. This method allows the extension to get parameters of its own field.
Be careful, loadObjectParameters method is called before this method.
See How to configure an extension ? for details.

Reimplemented from OMK::DistanceToExtension.

Reimplemented in OMK::TriggerAttributeExtension, and OMK::TriggerExtension.

Definition at line 107 of file OMKTriggerExtension.cpp.

References _threshold, OMK::DistanceToExtension::loadExtensionParameters(), and OMK::IAttributeBaseT< PrmType >::loadParameters().

Referenced by OMK::TriggerExtension::loadExtensionParameters(), and OMK::TriggerAttributeExtension::loadExtensionParameters().

00108 {
00109   _threshold.loadParameters( node, "Threshold" ) ;
00110 
00111   return DistanceToExtension::loadExtensionParameters( node );
00112 }

void TriggerBaseExtension::preComputeParameters (  )  [protected, virtual]

method.

This method is called by the extensible simulated object at each compute step. Its call takes place in the compute method just after the inputs were retrieved by the computeInputs method and before the output parameters will be computed by the computeParameters

Reimplemented from OMK::DistanceToExtension.

Definition at line 114 of file OMKTriggerExtension.cpp.

References OMK::DistanceToExtension::_distance, _flagAccessor, _threshold, OMK::IAttributeT< PrmType, ModelType, AccessorType >::get(), OMASSERTM, OMK::DistanceToExtension::preComputeParameters(), and OMK::IAccessorT< T >::set().

00115 {
00116   OMASSERTM( _flagAccessor, "Must be valid !" ) ;
00117   DistanceToExtension::preComputeParameters() ;
00118   bool trigger = _distance.get() <= _threshold.get() ;
00119   _flagAccessor->set( trigger ) ;
00120 }


Member Data Documentation

AttributeT< float > OMK::TriggerBaseExtension::_threshold [protected]

The attribute of the threshold.

If the distance between the object and the target is less than the thresold the flag (_flagAccessor) is set to true, else it stays to false.

Definition at line 161 of file OMKTriggerExtension.h.

Referenced by loadExtensionParameters(), preComputeParameters(), and TriggerBaseExtension().

IAccessorT< bool >* OMK::TriggerBaseExtension::_flagAccessor [protected]

The flag attribute.

With TriggerAttributeExtension, it is a already defined attribute of the object. With TriggerExtension, it is defined by the extension.

Definition at line 165 of file OMKTriggerExtension.h.

Referenced by OMK::TriggerExtension::loadExtensionParameters(), OMK::TriggerAttributeExtension::loadExtensionParameters(), and preComputeParameters().


logo OpenMask

Documentation generated on Mon Jun 9 11:46:03 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007