cmil::InputSequencer Class Reference

#include <InputSequencer.h>

Inheritance diagram for cmil::InputSequencer:

Inheritance graph
[legend]
Collaboration diagram for cmil::InputSequencer:

Collaboration graph
[legend]
List of all members.

Public Types

 Trigger
 Capture
enum  Mode { Trigger, Capture }

Public Member Functions

 InputSequencer ()
virtual ~InputSequencer ()
void captureNormal (ModAction *stop_action)
Ev::SequencegetCaptured () const
bool handle (const InputData &input)
bool handle (const ModData &input)
virtual bool isCombo (const Ev::Sequence &seq) const =0
 This function should provide validation of combo style sequences for clients.
virtual bool isNormal (const Ev::Sequence &seq) const =0
 This function should provide validation of regular sequences for clients.
virtual std::string getName () const
bool addNormal (const Ev &event)
bool removeNormal (const Ev &event)
bool addCombo (const Ev &event)

Protected Attributes

Mode m_mode
InputActionm_stop_capture_action
Ev::Sequencem_captured

Private Member Functions

virtual Ev::Sequencecapture (const ModData &input)=0
 This should return a non-null once a valid sequence is passed.
virtual bool imp_handle (const ModData &input)=0
virtual bool imp_handle (const InputData &input)=0
virtual bool imp_addNormal (const Ev::Sequence &seq)=0
virtual bool imp_removeNormal (const Ev::Sequence &seq)=0
virtual bool imp_addCombo (const Ev::Sequence &seq)=0

Detailed Description

Definition at line 28 of file InputSequencer.h.


Member Enumeration Documentation

enum cmil::InputSequencer::Mode

Enumerator:
Trigger  This is the normal operating mode where the context just receives inputs and forwards them to a sequencer for action triggering.
Capture  In this mode the context captures valid Input Sequences and returns them as a service to the user, this is helpful for tasks such as rebinding actions, or implimenting some custom triggering mechanism.

Definition at line 32 of file InputSequencer.h.

00032                 {
00035         Trigger,  
00036 
00040         Capture
00041       };


Constructor & Destructor Documentation

cmil::InputSequencer::InputSequencer (  )  [inline]

Definition at line 30 of file InputSequencer.h.

00030 : m_mode(Trigger), m_stop_capture_action(NULL), m_captured(NULL) {} 

virtual cmil::InputSequencer::~InputSequencer (  )  [inline, virtual]

Definition at line 43 of file InputSequencer.h.

References m_captured.

00043                                 {
00044         if(m_captured) 
00045           delete m_captured;
00046       };


Member Function Documentation

bool cmil::InputSequencer::addCombo ( const Ev event  )  [inline]

Definition at line 117 of file InputSequencer.h.

References cmil::Ev::getSequence(), imp_addCombo(), isCombo(), and Logger::log_debug().

Referenced by cmil::defaultContext::addCombo().

00117                                      {
00118         Ev::Sequence* sequence;
00119         if((sequence = event.getSequence()) != NULL) {
00120           log_debug("addCombo validating..");
00121           if(isCombo(*sequence)) {
00122             return imp_addCombo(*sequence);
00123           }
00124         }
00125         return false;
00126       }

Here is the call graph for this function:

Here is the caller graph for this function:

bool cmil::InputSequencer::addNormal ( const Ev event  )  [inline]

Definition at line 95 of file InputSequencer.h.

References cmil::Ev::getSequence(), imp_addNormal(), isNormal(), and Logger::log_debug().

Referenced by cmil::defaultContext::addNormal().

00095                                       {
00096         Ev::Sequence* sequence;
00097         if((sequence = event.getSequence()) != NULL) {
00098           log_debug("addNormal validating..");
00099           if(isNormal(*sequence)) {
00100             return imp_addNormal(*sequence);
00101           }
00102         }
00103         return false;
00104       }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual Ev::Sequence* cmil::InputSequencer::capture ( const ModData input  )  [private, pure virtual]

This should return a non-null once a valid sequence is passed.

Implemented in cmil::NodeSequencer.

Referenced by handle().

Here is the caller graph for this function:

void cmil::InputSequencer::captureNormal ( ModAction stop_action  )  [inline]

This should cause the sequencer to start capturing sequences, when it receives a valid sequence, it should stop and run the associated stop_seq action, this is similar to a "callback". The user can then check which sequence was captured using getCaptured().

Remove any prior captured sequence, this is necessary inorder for handle(ModData) to work properly

Definition at line 52 of file InputSequencer.h.

References Capture, Logger::log_error(), m_captured, m_mode, and m_stop_capture_action.

Referenced by cmil::defaultContext::captureNormal().

00052                                                    {
00053         if(m_mode == Capture) 
00054           log_error("captureSeq() already in capture mode.");
00055         else  {
00056             m_stop_capture_action = stop_action; 
00057             m_mode = Capture;
00058 
00060           if(m_captured) {  
00061             delete m_captured;
00062             m_captured = NULL;
00063           }
00064         }
00065       }

Here is the call graph for this function:

Here is the caller graph for this function:

Ev::Sequence* cmil::InputSequencer::getCaptured (  )  const [inline]

Definition at line 67 of file InputSequencer.h.

References m_captured.

Referenced by cmil::defaultContext::getCaptured().

00067                                       { 
00068         return m_captured; 
00069       }; 

Here is the caller graph for this function:

virtual std::string cmil::InputSequencer::getName (  )  const [inline, virtual]

Implements Logger.

Reimplemented in cmil::NodeSequencer.

Definition at line 93 of file InputSequencer.h.

00093 { return "InputSequencer"; }

bool cmil::InputSequencer::handle ( const ModData input  )  [inline]

This concretely enforces capture behavior, InputData is ignored because there is no way of determining the kind of sequence desired by the user based on it.

Definition at line 78 of file InputSequencer.h.

References capture(), Capture, imp_handle(), m_mode, and Trigger.

00078                                         {
00079         if(m_mode == Capture) {
00080           if(capture(input))
00081             m_mode = Trigger;
00082         }
00083 
00084         return imp_handle(input); 
00085       };

Here is the call graph for this function:

bool cmil::InputSequencer::handle ( const InputData input  )  [inline]

Definition at line 71 of file InputSequencer.h.

References imp_handle().

Referenced by cmil::defaultContext::update().

00071                                           {
00072         return imp_handle(input); 
00073       };

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool cmil::InputSequencer::imp_addCombo ( const Ev::Sequence seq  )  [private, pure virtual]

Implemented in cmil::NodeSequencer.

Referenced by addCombo().

Here is the caller graph for this function:

virtual bool cmil::InputSequencer::imp_addNormal ( const Ev::Sequence seq  )  [private, pure virtual]

Implemented in cmil::NodeSequencer.

Referenced by addNormal().

Here is the caller graph for this function:

virtual bool cmil::InputSequencer::imp_handle ( const InputData input  )  [private, pure virtual]

Implemented in cmil::NodeSequencer.

virtual bool cmil::InputSequencer::imp_handle ( const ModData input  )  [private, pure virtual]

Implemented in cmil::NodeSequencer.

Referenced by handle().

Here is the caller graph for this function:

virtual bool cmil::InputSequencer::imp_removeNormal ( const Ev::Sequence seq  )  [private, pure virtual]

Implemented in cmil::NodeSequencer.

Referenced by removeNormal().

Here is the caller graph for this function:

virtual bool cmil::InputSequencer::isCombo ( const Ev::Sequence seq  )  const [pure virtual]

This function should provide validation of combo style sequences for clients.

Implemented in cmil::NodeSequencer.

Referenced by addCombo().

Here is the caller graph for this function:

virtual bool cmil::InputSequencer::isNormal ( const Ev::Sequence seq  )  const [pure virtual]

This function should provide validation of regular sequences for clients.

Implemented in cmil::NodeSequencer.

Referenced by addNormal(), and removeNormal().

Here is the caller graph for this function:

bool cmil::InputSequencer::removeNormal ( const Ev event  )  [inline]

Definition at line 106 of file InputSequencer.h.

References cmil::Ev::getSequence(), imp_removeNormal(), isNormal(), and Logger::log_debug().

Referenced by cmil::defaultContext::removeNormal().

00106                                          {
00107         Ev::Sequence* sequence;
00108         if((sequence = event.getSequence()) != NULL) {
00109           log_debug("removeNormal validating..");
00110           if(isNormal(*sequence)) {
00111             return imp_removeNormal(*sequence);
00112           }
00113         }
00114         return false;
00115       }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Ev::Sequence* cmil::InputSequencer::m_captured [protected]

Definition at line 130 of file InputSequencer.h.

Referenced by cmil::NodeSequencer::capture(), captureNormal(), getCaptured(), and ~InputSequencer().

Mode cmil::InputSequencer::m_mode [protected]

Definition at line 128 of file InputSequencer.h.

Referenced by captureNormal(), and handle().

InputAction* cmil::InputSequencer::m_stop_capture_action [protected]

Definition at line 129 of file InputSequencer.h.

Referenced by cmil::NodeSequencer::capture(), and captureNormal().


The documentation for this class was generated from the following file:
(c) 2006-2007 John P. Feltz
Generated on Wed Jul 25 16:08:03 2007 for Common Media Input Layer by doxygen 1.4.7

SourceForge.net Logo