Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

CompareTrans< T > Class Template Reference

#include <CompareTrans.h>

Inheritance diagram for CompareTrans< T >:

Inheritance graph
[legend]
List of all members.

Detailed Description

template<class T>
class CompareTrans< T >

causes a transition if a value (through a pointer) goes above a given value

You will need to specify an event mask which will be listened for. This event will then be listened for - each time it is received, CompareTrans will check the values for possible activation.

For example, if you want to transition when the IR sensor goes below, say 200, pass &state->sensors[IRDistOffset], CompareTrans::LT, 200, and EventBase(EventBase::sensorEGID,SensorSourceID::UpdatedSID,EventBase::statusETID) as the polling event. Or a timer event to just check at a certain interval.

If you pass a class as the templated type, only requires that < operator is defined for comparing inequality, == for equality, and a copy constructor (CompareTrans holds a protected copy of the value)

Passing NULL as the value to monitor will cause a transition on the first event received

Definition at line 25 of file CompareTrans.h.

Public Types

enum  Test_t {
  LT, GT, LTE, GTE,
  EQ, NE
}
 use these values to sepecify what kind of comparison should be made to test for activation More...

Public Member Functions

 CompareTrans (StateNode *destination, const T *monitor, Test_t test, const T &value)
 constructor, only checks monitor when it is first activated (no polling)
 CompareTrans (StateNode *destination, const T *monitor, Test_t test, const T &value, const EventBase &poll)
 constructor, see CompareTrans class notes for information
 CompareTrans (const std::string &name, StateNode *destination, const T *monitor, Test_t test, const T &value, const EventBase &poll)
 constructor, see CompareTrans class notes for information
virtual void DoStart ()
 starts listening
virtual void DoStop ()
 stops listening
virtual void processEvent (const EventBase &)
 don't care about the event, just a pulse to check the values

Protected Member Functions

 CompareTrans (const std::string &classname, const std::string &instancename, StateNode *destination, const T *monitor, Test_t test, const T &value)
 constructor (no polling), see CompareTrans class notes for information (this version is only need by subclasses so they can pass their type name)
 CompareTrans (const std::string &classname, const std::string &instancename, StateNode *destination, const T *monitor, Test_t test, const T &value, const EventBase &poll)
 constructor, see CompareTrans class notes for information (this version is only need by subclasses so they can pass their type name)

Protected Attributes

const T * mon
 address of value to monitor
Test_t tst
 test to make
val
 value to compare against
bool isPolling
 set to true if poller should be used (otherwise only checked on activation)
EventBase poller
 event to listen to, when it comes, compare the values

Private Member Functions

 CompareTrans (const CompareTrans &node)
 don't call this
CompareTrans operator= (const CompareTrans &node)
 don't call this


Member Enumeration Documentation

template<class T>
enum CompareTrans::Test_t
 

use these values to sepecify what kind of comparison should be made to test for activation

Enumerator:
LT  less than
GT  greater than
LTE  less than or equal
GTE  greater than or equal
EQ  equal
NE  not equal

Definition at line 28 of file CompareTrans.h.


Constructor & Destructor Documentation

template<class T>
CompareTrans< T >::CompareTrans StateNode destination,
const T *  monitor,
Test_t  test,
const T &  value
[inline]
 

constructor, only checks monitor when it is first activated (no polling)

Definition at line 38 of file CompareTrans.h.

template<class T>
CompareTrans< T >::CompareTrans StateNode destination,
const T *  monitor,
Test_t  test,
const T &  value,
const EventBase poll
[inline]
 

constructor, see CompareTrans class notes for information

Definition at line 43 of file CompareTrans.h.

template<class T>
CompareTrans< T >::CompareTrans const std::string &  name,
StateNode destination,
const T *  monitor,
Test_t  test,
const T &  value,
const EventBase poll
[inline]
 

constructor, see CompareTrans class notes for information

Definition at line 48 of file CompareTrans.h.

template<class T>
CompareTrans< T >::CompareTrans const std::string &  classname,
const std::string &  instancename,
StateNode destination,
const T *  monitor,
Test_t  test,
const T &  value
[inline, protected]
 

constructor (no polling), see CompareTrans class notes for information (this version is only need by subclasses so they can pass their type name)

Definition at line 90 of file CompareTrans.h.

template<class T>
CompareTrans< T >::CompareTrans const std::string &  classname,
const std::string &  instancename,
StateNode destination,
const T *  monitor,
Test_t  test,
const T &  value,
const EventBase poll
[inline, protected]
 

constructor, see CompareTrans class notes for information (this version is only need by subclasses so they can pass their type name)

Definition at line 94 of file CompareTrans.h.

template<class T>
CompareTrans< T >::CompareTrans const CompareTrans< T > &  node  )  [private]
 

don't call this


Member Function Documentation

template<class T>
virtual void CompareTrans< T >::DoStart  )  [inline, virtual]
 

starts listening

Reimplemented from BehaviorBase.

Reimplemented in SmoothCompareTrans< T >.

Definition at line 53 of file CompareTrans.h.

Referenced by SmoothCompareTrans< T >::DoStart().

template<class T>
virtual void CompareTrans< T >::DoStop  )  [inline, virtual]
 

stops listening

Reimplemented from BehaviorBase.

Definition at line 62 of file CompareTrans.h.

template<class T>
CompareTrans CompareTrans< T >::operator= const CompareTrans< T > &  node  )  [private]
 

don't call this

template<class T>
virtual void CompareTrans< T >::processEvent const EventBase  )  [inline, virtual]
 

don't care about the event, just a pulse to check the values

Reimplemented from BehaviorBase.

Reimplemented in SmoothCompareTrans< T >.

Definition at line 65 of file CompareTrans.h.

Referenced by CompareTrans< T >::DoStart(), and SmoothCompareTrans< T >::processEvent().


Member Data Documentation

template<class T>
bool CompareTrans< T >::isPolling [protected]
 

set to true if poller should be used (otherwise only checked on activation)

Definition at line 101 of file CompareTrans.h.

Referenced by CompareTrans< T >::DoStart().

template<class T>
const T* CompareTrans< T >::mon [protected]
 

address of value to monitor

Definition at line 98 of file CompareTrans.h.

Referenced by CompareTrans< T >::processEvent().

template<class T>
EventBase CompareTrans< T >::poller [protected]
 

event to listen to, when it comes, compare the values

Definition at line 102 of file CompareTrans.h.

Referenced by CompareTrans< T >::DoStart().

template<class T>
Test_t CompareTrans< T >::tst [protected]
 

test to make

Definition at line 99 of file CompareTrans.h.

Referenced by CompareTrans< T >::processEvent().

template<class T>
T CompareTrans< T >::val [protected]
 

value to compare against

Definition at line 100 of file CompareTrans.h.

Referenced by CompareTrans< T >::processEvent().


The documentation for this class was generated from the following file:

Tekkotsu v2.4.1
Generated Tue Aug 16 16:34:58 2005 by Doxygen 1.4.4