Vision Touch Surface Library
 All Classes Files Functions Variables Pages
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
GestureManager Class Referenceabstract

The GestureManager class is a pure abstract class that provides an interface to create any gesture and manages its state. More...

#include <gesturemanager.h>

Inheritance diagram for GestureManager:
Inheritance graph
[legend]
Collaboration diagram for GestureManager:
Collaboration graph
[legend]

Public Member Functions

 GestureManager ()
 
 ~GestureManager ()
 
virtual void updateStatus (FrameData &params)
 updateStatus processes the data of the given frame More...
 
virtual bool isGestureDetected (FrameData &params)=0
 isGestureDetected determines if the gesture is detected with the given data More...
 
virtual void generateGestureData (FrameData &params)=0
 generateGestureData This function generates the data needed for the gesture manager More...
 
virtual void onStatusInit (FrameData &params)=0
 onStatusInit This function is called the first time the init counter reaches 0 More...
 
virtual void onStatusActive (FrameData &params)=0
 onStatusActive This function is called while the status is active, until the end counter reaches 0 More...
 
virtual void onStatusFinish (FrameData &params)=0
 onStatusFinish This function is called when the end counter reaches 0 More...
 
virtual void onStatusInactive (FrameData &params)=0
 onStatusInactive This function is called when the status is set to inactive More...
 
virtual void setIOManager (IOEventManager *eventManager)
 setIOManager This function changes the event manager associated with this class More...
 
virtual IOEventManagergetIOManager ()
 
virtual bool isActive () const
 
int getCounterInitMax () const
 
void setCounterInitMax (int value)
 
int getCounterEndMax () const
 
void setCounterEndMax (int value)
 

Protected Member Functions

virtual void resetInitCounter ()
 
virtual void resetEndCounter ()
 

Protected Attributes

int counterInit
 
int counterEnd
 
int counterInitMax
 
int counterEndMax
 
IOEventManageriomanager
 
bool gestureDetected
 
boost::mutex iomanagerMutex
 

Static Protected Attributes

static const int STATUS_ACTIVE =0
 
static const int STATUS_INACTIVE =-2
 
static const int STATUS_INIT =-1
 
static const int STATUS_FINISH =1
 

Detailed Description

The GestureManager class is a pure abstract class that provides an interface to create any gesture and manages its state.

The key idea is that for each frame the controller is going to call updateStatus(). The object will decide then its state and execute the apropiate function. For managing the status the class uses counters. If the init counter is set to N the class will switch the state to active when N observations of the gesture have been detected. An equivalent process is applied for a counter to end the gesture.

For making a gesture work it is enough to override the pure virtual functions. Note that each gesture is independent and will not exclude other gestures from being performed.

The GestureManager is associated with an IOEventManager that should be called in the overriden functions accordingly to perform the event.

Constructor & Destructor Documentation

GestureManager::GestureManager ( )
GestureManager::~GestureManager ( )
inline

Member Function Documentation

virtual void GestureManager::generateGestureData ( FrameData params)
pure virtual

generateGestureData This function generates the data needed for the gesture manager

Parameters
paramsdata of the frame needed for the gesture

This function is called every time that GestureManager::updateStatus is called and GestureManager::isGestureDetected returns True

Implemented in SwipeManager, TappingManager, DoubleSwipeManager, and MonitorHandsManager.

int GestureManager::getCounterEndMax ( ) const
int GestureManager::getCounterInitMax ( ) const
IOEventManager * GestureManager::getIOManager ( )
virtual
bool GestureManager::isActive ( ) const
virtual
virtual bool GestureManager::isGestureDetected ( FrameData params)
pure virtual

isGestureDetected determines if the gesture is detected with the given data

Parameters
paramsdata of the frame needed for the gesture
Returns
True when the gesture is detected

Implemented in SwipeManager, TappingManager, DoubleSwipeManager, and MonitorHandsManager.

virtual void GestureManager::onStatusActive ( FrameData params)
pure virtual

onStatusActive This function is called while the status is active, until the end counter reaches 0

Parameters
paramsdata of the frame needed for the gesture

Note that the status can be active serveral frames so this function is going to be called several times in a row.

Implemented in SwipeManager, TappingManager, DoubleSwipeManager, and MonitorHandsManager.

virtual void GestureManager::onStatusFinish ( FrameData params)
pure virtual

onStatusFinish This function is called when the end counter reaches 0

Parameters
paramsdata of the frame needed for the gesture

After this function is called the state of the gesutre is going to be set as inactive. The function should not be called again until the status of the gesture has gone to active again.

Implemented in SwipeManager, TappingManager, DoubleSwipeManager, and MonitorHandsManager.

virtual void GestureManager::onStatusInactive ( FrameData params)
pure virtual

onStatusInactive This function is called when the status is set to inactive

Parameters
paramsdata of the frame needed for the gestures

In case a gesture needs passive information this is the function where it should be recorded.

Implemented in SwipeManager, TappingManager, DoubleSwipeManager, and MonitorHandsManager.

virtual void GestureManager::onStatusInit ( FrameData params)
pure virtual

onStatusInit This function is called the first time the init counter reaches 0

Parameters
paramsdata of the frame needed for the gesture

After this function is called the state of the gesture is going to be set as active. The function should not be called again until the status of the gesture has gone to inactive again.

In this function all the atributes that are going to be needed during the gesture should be initialized.

Implemented in SwipeManager, TappingManager, DoubleSwipeManager, and MonitorHandsManager.

void GestureManager::resetEndCounter ( )
protectedvirtual
void GestureManager::resetInitCounter ( )
protectedvirtual
void GestureManager::setCounterEndMax ( int  value)
void GestureManager::setCounterInitMax ( int  value)
void GestureManager::setIOManager ( IOEventManager eventManager)
virtual

setIOManager This function changes the event manager associated with this class

Parameters
eventManagerpointer to the new event manager

This function has lateral effects. No copy of the reference is done.

void GestureManager::updateStatus ( FrameData params)
virtual

updateStatus processes the data of the given frame

Parameters
paramsdata of the frame needed for the gesture

This function will call GestureManager::generateGestureData, GestureManager::onStatusInit, GestureManager::onStatusActive, GestureManager::onStatusFinish or GestureManager::onStatusInactive depending on the output of the function GestureManager::isGestureDetected and the values of the counters.

Member Data Documentation

int GestureManager::counterEnd
protected
int GestureManager::counterEndMax
protected
int GestureManager::counterInit
protected
int GestureManager::counterInitMax
protected
bool GestureManager::gestureDetected
protected
IOEventManager* GestureManager::iomanager
protected
boost::mutex GestureManager::iomanagerMutex
protected
const int GestureManager::STATUS_ACTIVE =0
staticprotected
const int GestureManager::STATUS_FINISH =1
staticprotected
const int GestureManager::STATUS_INACTIVE =-2
staticprotected
const int GestureManager::STATUS_INIT =-1
staticprotected

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