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

gadget::SimDigitalGlove Class Reference

Simulated digital device Simulates a digital device from a keyboard device. More...

#include <SimDigitalGlove.h>

Inheritance diagram for gadget::SimDigitalGlove:

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

Collaboration graph
[legend]
List of all members.

Public Types

enum  finger {
  LTHUMB = 0, LINDEX = 1, LMIDDLE = 2, LRING = 3,
  LPINKY = 4, RTHUMB = 6, RINDEX = 7, RMIDDLE = 8,
  RRING = 9, RPINKY = 10
}
 Gets the digital data for the given "finger". More...


Public Methods

 SimDigitalGlove ()
 Default Constructor. More...

virtual ~SimDigitalGlove ()
 Destructor. More...

virtual bool config (jccl::ConfigElementPtr element)
 Configures this device. More...

virtual bool startSampling ()
virtual bool stopSampling ()
virtual bool sample ()
virtual void updateData ()
 Updates the state of the digital data vector. More...

void operator delete (void *p)
 Invokes the global scope delete operator. More...


Static Public Methods

std::string getElementType ()

Protected Methods

virtual void destroy ()
 Deletes this object. More...


Detailed Description

Simulated digital device Simulates a digital device from a keyboard device.

It allows any number of simulated digital devices to be created.

When the key configured is held down, the digital device is on. When the key is released, the device is no longer set.

This class should not be used directly by the user.

Definition at line 59 of file SimDigitalGlove.h.


Member Enumeration Documentation

enum gadget::SimDigitalGlove::finger
 

Gets the digital data for the given "finger".

Returns digital 0 or 1, if "finger" makes sense. Returns -1 if function fails or if devNum is out of range. Use one of these indices to get the glove's digital data. EX: int result = mGlove.getDigitalData( SimDigitalGlove::LTHUMB );

Returns:
0 == open, 1 == contact.
Note:
If devNum is out of range, function will fail, possibly issueing an error to a log or console - but will not ASSERT.

Note:
These should be the same integers as PinchGlove's
Enumeration values:
LTHUMB 
LINDEX 
LMIDDLE 
LRING 
LPINKY 
RTHUMB 
RINDEX 
RMIDDLE 
RRING 
RPINKY 

Definition at line 85 of file SimDigitalGlove.h.

00086    {
00087       LTHUMB = 0, LINDEX = 1, LMIDDLE = 2, LRING = 3, LPINKY = 4,
00088       RTHUMB = 6, RINDEX = 7, RMIDDLE = 8, RRING = 9, RPINKY = 10
00089    };


Constructor & Destructor Documentation

gadget::SimDigitalGlove::SimDigitalGlove  
 

Default Constructor.

Definition at line 43 of file SimDigitalGlove.cpp.

00044 {
00045    //vprDEBUG(vprDBG_ALL, vprDBG_VERB_LVL)<<"*** SimDigitalGlove::SimDigitalGlove()\n"<< vprDEBUG_FLUSH;
00046 }

gadget::SimDigitalGlove::~SimDigitalGlove   [virtual]
 

Destructor.

Definition at line 49 of file SimDigitalGlove.cpp.

00050 {
00051   // vprDEBUG(vprDBG_ALL, vprDBG_VERB_LVL)<<"*** SimDigitalGlove::~SimDigitalGlove()\n"<< vprDEBUG_FLUSH;
00052 }


Member Function Documentation

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

Configures this device.

Reimplemented from gadget::Glove.

Definition at line 59 of file SimDigitalGlove.cpp.

00060 {
00061    //vprDEBUG(vprDBG_ALL, vprDBG_VERB_LVL)<<"*** SimDigitalGlove::config\n"<< vprDEBUG_FLUSH;
00062    if (! (Input::config(element) && Digital::config(element) &&
00063           SimInput::config(element) && Glove::config(element)) )
00064    {
00065       return false;
00066    }
00067 
00068    //mCurGesture = 0;     // We are in no gesture yet
00069 
00070    std::vector<jccl::ConfigElementPtr> key_list;
00071    int key_count = element->getNum("key_pair");
00072    for ( int i = 0; i < key_count; ++i )
00073    {
00074       key_list.push_back(element->getProperty<jccl::ConfigElementPtr>("key_pair", i));
00075    }
00076    mSimKeys = readKeyList( key_list );
00077 
00078    return true;
00079 }

virtual bool gadget::SimDigitalGlove::startSampling   [inline, virtual]
 

Definition at line 91 of file SimDigitalGlove.h.

00091 {return true;}

virtual bool gadget::SimDigitalGlove::stopSampling   [inline, virtual]
 

Definition at line 92 of file SimDigitalGlove.h.

00092 {return true;}

virtual bool gadget::SimDigitalGlove::sample   [inline, virtual]
 

Definition at line 93 of file SimDigitalGlove.h.

00093 {return true;}

void gadget::SimDigitalGlove::updateData   [virtual]
 

Updates the state of the digital data vector.

Note:
Digital is on when key is held down. When key is release, digital goes to off state.

Definition at line 87 of file SimDigitalGlove.cpp.

References gadget::Glove::addGloveSample, gadget::Glove::getGloveDataFromDigitalData, and gadget::Glove::swapGloveBuffers.

00088 {
00089    std::vector<DigitalData> digitalSample(10);
00090    
00091     // -- Update digital data --- //
00092    for (unsigned int i = 0; i < mSimKeys.size(); i++)
00093    {
00094       if (checkKeyPair( mSimKeys[i] ))             // If keys pressed
00095          digitalSample[i] = 1;
00096       else
00097          digitalSample[i] = 0;
00098    }
00099 
00100    addDigitalSample(digitalSample);
00101    swapDigitalBuffers();
00102 
00103    std::vector<GloveData> gloveSample=getGloveDataFromDigitalData(digitalSample);
00104    addGloveSample(gloveSample);
00105    swapGloveBuffers();
00106    
00107    return;
00108 }

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

Definition at line 54 of file SimDigitalGlove.cpp.

00055 {
00056    return "simulated_digital_glove";
00057 }

void gadget::SimDigitalGlove::operator delete void *    p [inline]
 

Invokes the global scope delete operator.

This is required for proper releasing of memory in DLLs on Win32.

Definition at line 104 of file SimDigitalGlove.h.

00105    {
00106       ::operator delete(p);
00107    }

virtual void gadget::SimDigitalGlove::destroy   [inline, protected, virtual]
 

Deletes this object.

This is an implementation of the pure virtual gadget::Input::destroy() method.

Definition at line 114 of file SimDigitalGlove.h.

00115    {
00116       delete this;
00117    }


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