Panda3D
|
An abstract base class for a family of client device interfaces--including trackers, buttons, dials, and other analog inputs. More...
#include "clientBase.h"
Public Member Functions | |
virtual TypeHandle | force_init_type () |
bool | fork_asynchronous_thread (double poll_time) |
Forks a separate thread to do all the polling of connected devices. | |
CoordinateSystem | get_coordinate_system () const |
Returns the coordinate system that all devices associated with this client will operate in. | |
double | get_last_poll_time () const |
Returns the time (according to the global ClockObject's get_real_time() method) of the last device poll. | |
virtual TypeHandle | get_type () const |
bool | is_forked () const |
Returns true if the ClientBase has been forked (and, therefore, poll() does not need to be called), false otherwise. | |
bool | poll () |
Initiates a poll of the client devices, if we are not forked and if we have not already polled this frame. | |
PT (ClientDevice) get_device(TypeHandle device_type | |
void | set_coordinate_system (CoordinateSystem cs) |
Specifies the coordinate system that all devices associated with this client will operate in. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. | |
Public Attributes | |
const string & | device_name |
Protected Member Functions | |
virtual bool | disconnect_device (TypeHandle device_type, const string &device_name, ClientDevice *device) |
Removes the device, which is presumably about to destruct, from the list of connected devices, and frees any data required to support it. | |
virtual void | do_poll () |
Implements the polling and updating of connected devices, if the ClientBase requires this. | |
virtual | PT (ClientDevice) make_device(TypeHandle device_type |
Protected Attributes | |
virtual const string & | device_name = 0 |
Friends | |
class | ClientDevice |
An abstract base class for a family of client device interfaces--including trackers, buttons, dials, and other analog inputs.
This provides a common interface to connect to such devices and extract their data; it is used by TrackerNode etc. to put these devices in the data graph.
Definition at line 47 of file clientBase.h.
bool ClientBase::disconnect_device | ( | TypeHandle | device_type, |
const string & | device_name, | ||
ClientDevice * | device | ||
) | [protected, virtual] |
Removes the device, which is presumably about to destruct, from the list of connected devices, and frees any data required to support it.
This device will no longer receive automatic updates with each poll.
The return value is true if the device was disconnected, or false if it was unknown (e.g. it was disconnected previously).
Reimplemented in VrpnClient.
Definition at line 167 of file clientBase.cxx.
Referenced by ClientDevice::disconnect(), and VrpnClient::disconnect_device().
void ClientBase::do_poll | ( | ) | [protected, virtual] |
Implements the polling and updating of connected devices, if the ClientBase requires this.
This may be called in a sub-thread if fork_asynchronous_thread() was called; otherwise, it will be called once per frame.
Reimplemented in VrpnClient.
Definition at line 195 of file clientBase.cxx.
References ClockObject::get_frame_count(), ClockObject::get_frame_time(), and ClockObject::get_global_clock().
Referenced by poll().
bool ClientBase::fork_asynchronous_thread | ( | double | poll_time | ) |
Forks a separate thread to do all the polling of connected devices.
The forked thread will poll after every poll_time seconds has elapsed. Returns true if the fork was successful, or false otherwise (for instance, because we were already forked, or because asynchronous threads are disabled).
Definition at line 82 of file clientBase.cxx.
CoordinateSystem ClientBase::get_coordinate_system | ( | ) | const [inline] |
Returns the coordinate system that all devices associated with this client will operate in.
Normally, this is CS_default.
Definition at line 80 of file clientBase.I.
double ClientBase::get_last_poll_time | ( | ) | const [inline] |
Returns the time (according to the global ClockObject's get_real_time() method) of the last device poll.
Definition at line 56 of file clientBase.I.
static void ClientBase::init_type | ( | ) | [inline, static] |
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Making it inline seems to cause problems in the optimizer.
Reimplemented from TypedReferenceCount.
Reimplemented in VrpnClient.
Definition at line 100 of file clientBase.h.
References TypedReferenceCount::init_type().
Referenced by VrpnClient::init_type().
bool ClientBase::is_forked | ( | ) | const [inline] |
Returns true if the ClientBase has been forked (and, therefore, poll() does not need to be called), false otherwise.
Definition at line 25 of file clientBase.I.
bool ClientBase::poll | ( | ) | [inline] |
Initiates a poll of the client devices, if we are not forked and if we have not already polled this frame.
Returns true if the poll occurred, or false if it did not.
Definition at line 38 of file clientBase.I.
References do_poll(), and ClockObject::get_global_clock().
Referenced by ClientDevice::poll().
void ClientBase::set_coordinate_system | ( | CoordinateSystem | cs | ) | [inline] |
Specifies the coordinate system that all devices associated with this client will operate in.
Normally, this is CS_default.
Definition at line 68 of file clientBase.I.