ButtonDevice Class Reference

General device with max 8 buttons. Do not use this class!! Use derived clases Flystick1 or Measurer. More...

#include <bodies.h>

Inheritance diagram for ButtonDevice:

Body Body FlyStick1 FlyStick1 Measurer Measurer

List of all members.

Public Member Functions

 ~ButtonDevice ()
 destructor
virtual int Button (int num)
 Specifies whether button is pressed or not.
virtual int ButonsNumber ()
 Returns number of buttons (8 is returned for all clases derived from this).
virtual int ButtonsMask32 ()
 returns mask of first 32 buttons
 ~ButtonDevice ()
 destructor
virtual int Button (int num)
 Specifies whether button is pressed or not.
virtual int ButonsNumber ()
 Returns number of buttons (8 is returned for all clases derived from this).
virtual int ButtonsMask32 ()
 returns mask of first 32 buttons

Protected Member Functions

 ButtonDevice (BodyType type, int id, float qu, int buttons, float *shift=NULL, float *rotation=NULL)
 constructor of the class
 ButtonDevice (BodyType type, int id, float qu, int buttons, float *shift=NULL, float *rotation=NULL)
 constructor of the class

Protected Attributes

int buttons
 Binary coded buttons configuration.


Detailed Description

General device with max 8 buttons. Do not use this class!! Use derived clases Flystick1 or Measurer.

Definition at line 197 of file bodies.h.


Constructor & Destructor Documentation

ButtonDevice::ButtonDevice ( Body::BodyType  type,
int  id,
float  qu,
int  buttons,
float *  shift = NULL,
float *  rotation = NULL 
) [protected]

constructor of the class

Parameters:
type The type of the Device (see BodyType specification)
id Identificator of the device
qu Quality of device visibility
buttons Binary coded configuration of buttons (max 8 buttons)
shift Shift vector (constructor makes a copy)
rotation Rotation matrix of the device (constructor makes a copy)

Definition at line 139 of file bodies.cpp.

00140 : Body(id, qu, type, shift, rotation)
00141 {
00142        this->buttons = buttons;
00143 }

ButtonDevice::~ButtonDevice (  ) 

destructor

Definition at line 144 of file bodies.cpp.

00145 {}

ButtonDevice::ButtonDevice ( BodyType  type,
int  id,
float  qu,
int  buttons,
float *  shift = NULL,
float *  rotation = NULL 
) [protected]

constructor of the class

Parameters:
type The type of the Device (see BodyType specification)
id Identificator of the device
qu Quality of device visibility
buttons Binary coded configuration of buttons (max 8 buttons)
shift Shift vector (constructor makes a copy)
rotation Rotation matrix of the device (constructor makes a copy)

ButtonDevice::~ButtonDevice (  ) 

destructor


Member Function Documentation

int ButtonDevice::Button ( int  num  )  [virtual]

Specifies whether button is pressed or not.

Parameters:
num - index to array, so use just values from 0 to 7 Returns 1 if button is pressed
Returns 0 if button is not pressed
Returns -10 if button is not in scope or device is not equiped with buttons

Reimplemented from Body.

Definition at line 150 of file bodies.cpp.

00151 {
00152        int res = 0x01;
00153        if (0<=num && num < 8)
00154        {
00155               res = res << num; // shift mask num positions to left
00156               if (0 != (res & buttons)) return 1;
00157               else return 0;
00158        }
00159        else return -10;
00160 }

int ButtonDevice::ButonsNumber (  )  [virtual]

Returns number of buttons (8 is returned for all clases derived from this).

Reimplemented from Body.

Definition at line 146 of file bodies.cpp.

00147 {
00148        return 8;
00149 }

int ButtonDevice::ButtonsMask32 (  )  [virtual]

returns mask of first 32 buttons

Reimplemented from Body.

Definition at line 229 of file bodies.cpp.

00230 {
00231        return this->buttons;
00232 }

virtual int ButtonDevice::Button ( int  num  )  [virtual]

Specifies whether button is pressed or not.

Parameters:
num - index to array, so use just values from 0 to 7 Returns 1 if button is pressed
Returns 0 if button is not pressed
Returns -10 if button is not in scope or device is not equiped with buttons

Reimplemented from Body.

virtual int ButtonDevice::ButonsNumber (  )  [virtual]

Returns number of buttons (8 is returned for all clases derived from this).

Reimplemented from Body.

virtual int ButtonDevice::ButtonsMask32 (  )  [virtual]

returns mask of first 32 buttons

Reimplemented from Body.


Member Data Documentation

int ButtonDevice::buttons [protected]

Binary coded buttons configuration.

Definition at line 201 of file bodies.h.


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

Generated on Tue Mar 10 14:41:38 2009 for VRUT by  doxygen 1.5.5