Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

gadget::GestureProxy Class Reference

Proxy to Gesture object. More...

#include <GestureProxy.h>

Inheritance diagram for gadget::GestureProxy:

Inheritance graph
[legend]
Collaboration diagram for gadget::GestureProxy:

Collaboration graph
[legend]
List of all members.

Public Methods

 GestureProxy ()
 Constructs the proxy to point to the given gesture device. More...

virtual ~GestureProxy ()
int getGesture ()
 Gets the current gesture. More...

int getGestureIndex (std::string name)
 Returns the identifier of the string gesture. More...

std::string getGestureString (int gestureId=-1)
 Gets a gesture name. More...

vpr::Interval getTimeStamp () const
 Returns time of last update. More...

GesturegetGesturePtr ()
 Returns a pointer to the device held by this proxy. More...

bool config (jccl::ConfigElementPtr element)
 Configures the proxy. More...

virtual InputgetProxiedInputDevice ()
 Returns a pointer to the base class of the devices being proxied. More...


Static Public Methods

std::string getElementType ()
 Returns the string rep of the element type used to config this device. More...


Detailed Description

Proxy to Gesture object.

A proxy is used by the user to actually acces the gesture data. The proxy allows the user to query the current gesture information. Clients call the get* routines to get the current gesture (id or string) Once the client has the current gesture, they should test it against the gestures they want to respond to.

See also:
gadget::Gesture

Definition at line 63 of file GestureProxy.h.


Constructor & Destructor Documentation

gadget::GestureProxy::GestureProxy   [inline]
 

Constructs the proxy to point to the given gesture device.

Definition at line 67 of file GestureProxy.h.

00068    { ;}

virtual gadget::GestureProxy::~GestureProxy   [inline, virtual]
 

Definition at line 70 of file GestureProxy.h.

00071    {}


Member Function Documentation

int gadget::GestureProxy::getGesture   [inline]
 

Gets the current gesture.

Returns:
id of current gesture.

Definition at line 77 of file GestureProxy.h.

00078    {
00079       const int defaultGesture(-1);
00080 
00081       if(isStupified())
00082          return defaultGesture;
00083       else
00084          return mTypedDevice->getGesture();
00085    }

int gadget::GestureProxy::getGestureIndex std::string    name [inline]
 

Returns the identifier of the string gesture.

Parameters:
name  The string name of a gesture.
Returns:
-1 if not found

Definition at line 92 of file GestureProxy.h.

00093    {
00094       const int defaultGestureIndex(-1);
00095       if(isStupified())
00096          return defaultGestureIndex;
00097       else
00098          return mTypedDevice->getGestureIndex(name);
00099    }

std::string gadget::GestureProxy::getGestureString int    gestureId = -1 [inline]
 

Gets a gesture name.

Returns:
Name of gesture with the given id (gestureId).
Note:
if gestureId = -1, returns name of current gesture.

Definition at line 106 of file GestureProxy.h.

00107    {
00108       if(isStupified())
00109          return std::string("");
00110       else
00111          return mTypedDevice->getGestureString(gestureId);
00112    }

vpr::Interval gadget::GestureProxy::getTimeStamp   const [inline, virtual]
 

Returns time of last update.

Implements gadget::Proxy.

Definition at line 115 of file GestureProxy.h.

00116    {
00117       // XXX: Broken for now, this is a case similar to the EventWindow type in that
00118       //      it does not point to one data element like digital, analog, and position.
00119       return vpr::Interval();
00120    }

Gesture* gadget::GestureProxy::getGesturePtr   [inline]
 

Returns a pointer to the device held by this proxy.

Definition at line 123 of file GestureProxy.h.

00124    {
00125       if(isStupified())
00126          return NULL;
00127       else
00128          return mTypedDevice;
00129    }

std::string gadget::GestureProxy::getElementType   [static]
 

Returns the string rep of the element type used to config this device.

Used by the Input Manager to find elements that construct devices.

Reimplemented from gadget::Proxy.

Definition at line 42 of file GestureProxy.cpp.

Referenced by config.

00043 {
00044    return "gesture_proxy";
00045 }

bool gadget::GestureProxy::config jccl::ConfigElementPtr    element [virtual]
 

Configures the proxy.

Postcondition:
Proxy is configured (it is not registered yet though).
Returns:
success.

Reimplemented from gadget::Proxy.

Definition at line 47 of file GestureProxy.cpp.

References gadgetDBG_INPUT_MGR, getElementType, gadget::TypedProxy< Gesture >::mDeviceName, and gadget::TypedProxy< Gesture >::refresh.

00048 {
00049 vpr::DebugOutputGuard dbg_output(gadgetDBG_INPUT_MGR, vprDBG_STATE_LVL,
00050       std::string("------------------ GESTURE PROXY config() -----------------\n"),
00051       std::string("\n"));
00052 
00053    vprASSERT(element->getID() == getElementType());
00054 
00055    if ( ! Proxy::config(element) )
00056    {
00057       return false;
00058    }
00059 
00060    mDeviceName = element->getProperty<std::string>("device");
00061 
00062    refresh();
00063 
00064    return true;
00065 }

virtual Input* gadget::GestureProxy::getProxiedInputDevice   [inline, virtual]
 

Returns a pointer to the base class of the devices being proxied.

Returns:
NULL if no device is proxied.

Implements gadget::Proxy.

Definition at line 135 of file GestureProxy.h.

00136    {
00137       if((NULL == mTypedDevice) || (isStupified)())
00138          return NULL;
00139 
00140       Input* ret_val = dynamic_cast<Input*>(mTypedDevice);
00141       vprASSERT((ret_val != NULL) && "Cross-cast in GestureProxy failed");
00142       return ret_val;
00143    }


The documentation for this class was generated from the following files:
Generated on Sun May 2 14:26:58 2004 for Gadgeteer by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002