Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Buttons Class Reference

Buttons is a representation for a set of n boolean inputs. This fairly abstract class should be subclassed to make Buttons objects that actually know how to get their buttons. This is somewhat parallel to the Tracker object, compare them! More...

#include <P_Buttons.h>

Inheritance diagram for Buttons:

CaveButtons FreeVRButtons MobileButtons PhoneButtons SpaceballButtons VRJugglerButtons VRPNButtons List of all members.

Public Methods

 Buttons ()
virtual ~Buttons ()
virtual const char * device_name () const=0
virtual Buttons * clone ()=0
int start (const SensorConfig *)
virtual void update ()=0
int state (int num)

Protected Methods

virtual int do_start (const SensorConfig *)
 Do subclass-specific startup tasks; return success. More...


Protected Attributes

ResizeArray< int > used
 the buttons that it uses. More...

int stat [MAX_BUTTONS]
 buttons can be changed by update. More...


Detailed Description

Buttons is a representation for a set of n boolean inputs. This fairly abstract class should be subclassed to make Buttons objects that actually know how to get their buttons. This is somewhat parallel to the Tracker object, compare them!

Common notes for VMDTracker, Feedback, and Buttons classes, collectively referred to as devices in what follows.

Constructor: The constructor must not require any input arguments. The reason for this is that an instance of every class is created and held in an associative store so that it can be referenced by its device_name() string. This instantiation is done independently of any device configuration, such as what would be found in the .vmdsensors file. Constructors should thus do nothing but initialize member data to NULL or default values.

device_name(): This pure virtual function supplies a string by which the device can be accessed in an associative store (since classes aren't first-class objects in C++). The name must be unique to that class, among all devices of that type.

clone(): This should do nothing more that return an instance of the class.

do_start(const SensorConfig *): Here's where the action is: This method will be called from the base class start() method after general initialization is done. This method is where the subclass should, e.g., establish a connection to a remote device. If there is no class-specific initialization to do then the subclass need not override this method.

start() should be called only once in a device's life, when it is first added to a Tool.

Definition at line 71 of file P_Buttons.h.


Constructor & Destructor Documentation

Buttons::Buttons   [inline]
 

Definition at line 80 of file P_Buttons.h.

virtual Buttons::~Buttons   [inline, virtual]
 

Definition at line 81 of file P_Buttons.h.


Member Function Documentation

virtual Buttons* Buttons::clone   [pure virtual]
 

Implemented in MobileButtons.

virtual const char* Buttons::device_name   const [pure virtual]
 

Implemented in MobileButtons.

virtual int Buttons::do_start const SensorConfig   [inline, protected, virtual]
 

Do subclass-specific startup tasks; return success.

Reimplemented in MobileButtons.

Definition at line 77 of file P_Buttons.h.

Referenced by start.

int Buttons::start const SensorConfig  
 

Definition at line 29 of file P_Buttons.C.

References ResizeArray< int >::append, ResizeArray< int >::clear, do_start, SensorConfig::getsensors, MAX_BUTTONS, ResizeArray::num, stat, and used.

Referenced by Tool::add_buttons.

int Buttons::state int    num [inline]
 

Definition at line 89 of file P_Buttons.h.

References ResizeArray::num, num, and stat.

Referenced by Tool::isgrabbing.

virtual void Buttons::update   [pure virtual]
 

Implemented in MobileButtons.


Member Data Documentation

int Buttons::stat[MAX_BUTTONS] [protected]
 

buttons can be changed by update.

Definition at line 74 of file P_Buttons.h.

Referenced by VRPNButtons::do_start, start, state, VRJugglerButtons::update, SpaceballButtons::update, FreeVRButtons::update, CaveButtons::update, and MobileButtons::update.

ResizeArray<int> Buttons::used [protected]
 

the buttons that it uses.

Definition at line 73 of file P_Buttons.h.

Referenced by start.


The documentation for this class was generated from the following files:
Generated on Fri Nov 8 02:46:23 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002