# cGenericTool Class Reference
[Haptic Tools]

cGenericTool describes a generic class to create virtual tools inside a virtual environment (cWorld) and connecting them to haptic devices. More...

`#include <CGenericTool.h>`

Inheritance diagram for cGenericTool:

[legend]

List of all members.

## Public Member Functions
| cGenericTool ()
| Constructor of cGenericTool.
virtual | ~cGenericTool ()
| Destructor of cGenericTool.
void | setHapticDevice (cGenericHapticDevice *a_device)
| Connect this tool to a haptic device.
cGenericHapticDevice * | getHapticDevice ()
| Get the handle of haptic device to wich this tool is connected to.
virtual void | render (const int a_renderMode=0)
| Render the object in OpenGL.
virtual void | updatePose ()
| Update Position, orientation, velocity and other degree of freedoms of tool.
virtual void | computeInteractionForces ()
| Compute interaction forces with environment.
virtual void | applyForces ()
| Apply latest forces to device.
virtual int | start ()
| Start communication with the device connected to the tool (0 indicates success).
virtual int | stop ()
| Stop communication with the device connected to the tool (0 indicates success).
virtual int | initialize (const bool a_resetEncoders=false)
| Initialize encoders on device connected to the tool (0 indicates success).
virtual int | setForcesON ()
| Toggle forces ON.
virtual int | setForcesOFF ()
| Toggle forces OFF.
virtual bool | getUserSwitch (int a_switchIndex)
| Read the status of one of the switches on this device.
virtual bool | isInContact (cGenericObject *a_object)
| Check if the tool is touching a particular object.
## Protected Attributes
cGenericHapticDevice * | m_device
| Handle to the haptic device driver.
int | m_userSwitches
| Status of the user switches of the device attached to this tool.

## Detailed Description

cGenericTool describes a generic class to create virtual tools inside a virtual environment (cWorld) and connecting them to haptic devices.

## Member Function Documentation

bool cGenericTool::getUserSwitch | ( | int | a_switchIndex | ) | `[virtual]`

Read the status of one of the switches on this device.

Read the status of the user switches from the haptic device controlled by this tool.

Parameters:

  | a_switchIndex | Index number of the switch.

Returns:
  Return true if switch is active, otherwise return false.

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

- D:/CHAI3D/build-2-0-0/2.0.0/win32/src/tools/CGenericTool.h
- D:/CHAI3D/build-2-0-0/2.0.0/win32/src/tools/CGenericTool.cpp

CHAI3D 2.0.0 documentation
Please address any questions to support@chai3d.org
(C) 2003-2009 - CHAI 3D
All Rights Reserved.