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