00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef VRPNTRACKER_H
00016 #define VRPNTRACKER_H
00017
00018 #include "pandabase.h"
00019
00020 #include "vrpn_interface.h"
00021
00022 #include "pvector.h"
00023
00024 class VrpnTrackerDevice;
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 class VrpnTracker {
00042 public:
00043 VrpnTracker(const string &tracker_name, vrpn_Connection *connection);
00044 ~VrpnTracker();
00045
00046 INLINE const string &get_tracker_name() const;
00047 INLINE bool is_empty() const;
00048
00049 void mark(VrpnTrackerDevice *device);
00050 void unmark(VrpnTrackerDevice *device);
00051
00052 INLINE void poll();
00053
00054 void output(ostream &out) const;
00055 void write(ostream &out, int indent_level = 0) const;
00056
00057 private:
00058 static void VRPN_CALLBACK
00059 vrpn_position_callback(void *userdata, const vrpn_TRACKERCB info);
00060 static void VRPN_CALLBACK
00061 vrpn_velocity_callback(void *userdata, const vrpn_TRACKERVELCB info);
00062 static void VRPN_CALLBACK
00063 vrpn_acceleration_callback(void *userdata, const vrpn_TRACKERACCCB info);
00064
00065 private:
00066 string _tracker_name;
00067 vrpn_Tracker_Remote *_tracker;
00068
00069 typedef pvector<VrpnTrackerDevice *> Devices;
00070 Devices _devices;
00071 };
00072
00073 INLINE ostream &operator << (ostream &out, const VrpnTracker &tracker) {
00074 tracker.output(out);
00075 return out;
00076 }
00077
00078 #include "vrpnTracker.I"
00079
00080 #endif
00081