Panda3D
Loading...
Searching...
No Matches
vrpnTrackerDevice.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file vrpnTrackerDevice.h
10 * @author drose
11 * @date 2001-01-25
12 */
13
14#ifndef VRPNTRACKERDEVICE_H
15#define VRPNTRACKERDEVICE_H
16
17#include "pandabase.h"
18
19#include "clientTrackerDevice.h"
20
21class VrpnClient;
22class VrpnTracker;
23
24/**
25 * The Panda interface to a VRPN tracker. This object will be returned by
26 * VrpnClient::make_device(), for attaching to a TrackerNode.
27 *
28 * It represents the data from just one particular sensor of a named VRPN
29 * tracker, and may reflect either the sensor's position, its velocity, or its
30 * acceleration.
31 *
32 * This class does not need to be exported from the DLL.
33 */
35public:
36 enum DataType {
37 DT_position,
38 DT_velocity,
39 DT_acceleration
40 };
41
42 VrpnTrackerDevice(VrpnClient *client, const std::string &device_name,
43 int sensor, DataType data_type,
44 VrpnTracker *vrpn_tracker);
45 virtual ~VrpnTrackerDevice();
46
47 INLINE int get_sensor() const;
48 INLINE DataType get_data_type() const;
49 INLINE VrpnTracker *get_vrpn_tracker() const;
50
51private:
52 int _sensor;
53 DataType _data_type;
54 VrpnTracker *_vrpn_tracker;
55
56public:
57 static TypeHandle get_class_type() {
58 return _type_handle;
59 }
60 static void init_type() {
61 ClientTrackerDevice::init_type();
62 register_type(_type_handle, "VrpnTrackerDevice",
63 ClientTrackerDevice::get_class_type());
64 }
65 virtual TypeHandle get_type() const {
66 return get_class_type();
67 }
68 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
69
70private:
71 static TypeHandle _type_handle;
72
73 friend class VrpnTracker;
74};
75
76#include "vrpnTrackerDevice.I"
77
78#endif
A device, attached to the ClientBase by a TrackerNode, that records the data from a single tracker de...
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
A specific ClientBase that connects to a VRPN server and records information on the connected VRPN de...
Definition vrpnClient.h:35
The Panda interface to a VRPN tracker.
int get_sensor() const
Returns the particular sensor index that this device wants to hear about from the VrpnTracker.
VrpnTracker * get_vrpn_tracker() const
Returns a pointer to the particular VrpnTracker this device gets its data from.
DataType get_data_type() const
Returns the type of data this device represents from the VrpnTracker.
This is the actual interface to a particular VRPN tracker object, and all of its sensors.
Definition vrpnTracker.h:37
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.