OMK::NotAttributeExtension Class Reference
[Extensions]

This extension add a boolean attribute which is the not of an other boolean attribute of the object. More...

#include <OMKNotAttributeExtension.h>

Inheritance diagram for OMK::NotAttributeExtension:

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

Collaboration graph
[legend]
List of all members.

Protected Member Functions

virtual void preComputeParameters ()
 method.
virtual void postComputeParameters ()
 This method is called during compute by the extensible simulated object.

Protected Attributes

AttributeT< bool > * _not
IAttributeBaseT< bool > * _attributeAccessor

Private Member Functions

 DECLARE_EXTENSION_FACTORY (NotAttributeExtension)

Detailed Description

This extension add a boolean attribute which is the not of an other boolean attribute of the object.

Module description :
When both the attribute and the inverted attribute are changed in the same step the attribute has priority. So if the attribute is changed, the inverted attribute is set to the inverse. If the attribute is unchanged and the inverted attribute is changed, the attribute is set to the inverse of the inverted attribute.
Configuration parameters :
The name of the added attribute will be AttributeIdNot where AttributeId is the name of the boolean attribute to invert.

Example:

object
{
  Class Tracker
  Scheduling
  {
    Frequency 60
  }  
  UserParams
  {
    TargetConnect [target Position]
  }
  Extensions
  {
    near
    {
      Class Trigger
    }
    not
    {
      Class NotAttribute
      AttributeId nearReached // The attribute of the trigger
      Output true
    }
  }
}
This configuration declares a tracker which has a trigger with an attribut (declaring an output) nearReachedNot which is true when it is far of the target and false when it is near.

See Tracker and TriggerExtension

Definition at line 83 of file OMKNotAttributeExtension.h.


Member Function Documentation

OMK::NotAttributeExtension::DECLARE_EXTENSION_FACTORY ( NotAttributeExtension   )  [private]

void NotAttributeExtension::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::Extension.

Definition at line 62 of file OMKNotAttributeExtension.cpp.

References _attributeAccessor, _not, OMK::IAttributeT< PrmType, ModelType, AccessorType >::get(), OMK::IAccessorT< T >::get(), OMK::IAttribute::isUpdated(), OMK::IAccessorT< T >::set(), and OMK::IAttributeT< PrmType, ModelType, AccessorType >::set().

00063 {
00064   if( _attributeAccessor->isUpdated() )
00065     _not->set( !_attributeAccessor->get() ) ;
00066   else if( _not->isUpdated() )
00067     _attributeAccessor->set( !_not->get() ) ;
00068 }

void NotAttributeExtension::postComputeParameters (  )  [protected, virtual]

This method is called during compute by the extensible simulated object.

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

Reimplemented from OMK::Extension.

Definition at line 70 of file OMKNotAttributeExtension.cpp.

References _attributeAccessor, _not, OMK::IAccessorT< T >::get(), and OMK::IAttributeT< PrmType, ModelType, AccessorType >::set().

00071 {
00072   _not->set( !_attributeAccessor->get() ) ;
00073 }


Member Data Documentation

AttributeT< bool >* OMK::NotAttributeExtension::_not [protected]

Definition at line 89 of file OMKNotAttributeExtension.h.

Referenced by postComputeParameters(), and preComputeParameters().

IAttributeBaseT< bool >* OMK::NotAttributeExtension::_attributeAccessor [protected]

Definition at line 90 of file OMKNotAttributeExtension.h.

Referenced by postComputeParameters(), and preComputeParameters().


logo OpenMask

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

Generated with doxygen by Dimitri van Heesch ,   1997-2007