Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/vrpn/vrpnTracker.h

Go to the documentation of this file.
00001 // Filename: vrpnTracker.h
00002 // Created by:  drose (25Jan01)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef VRPNTRACKER_H
00020 #define VRPNTRACKER_H
00021 
00022 #include <pandabase.h>
00023 
00024 #include "vrpn_interface.h"
00025 
00026 #include "pvector.h"
00027 
00028 class VrpnTrackerDevice;
00029 
00030 ////////////////////////////////////////////////////////////////////
00031 //       Class : VrpnTracker
00032 // Description : This is the actual interface to a particular VRPN
00033 //               tracker object, and all of its sensors.  A pointer to
00034 //               this object is stored in the VrpnClient class for
00035 //               each differently-named VRPN tracker we connect to.
00036 //
00037 //               The VRPN callbacks go here, which in turn get
00038 //               vectored out to any VrpnTrackerDevice objects that
00039 //               register with this.  When the last VrpnTrackerDevice
00040 //               object unregisters, the VrpnTracker will be deleted
00041 //               by the VrpnClient.
00042 //
00043 //               This class does not need to be exported from the DLL.
00044 ////////////////////////////////////////////////////////////////////
00045 class VrpnTracker {
00046 public:
00047   VrpnTracker(const string &tracker_name, vrpn_Connection *connection);
00048   ~VrpnTracker();
00049 
00050   INLINE const string &get_tracker_name() const;
00051   INLINE bool is_empty() const;
00052 
00053   void mark(VrpnTrackerDevice *device);
00054   void unmark(VrpnTrackerDevice *device);
00055 
00056   INLINE void poll();
00057 
00058   void output(ostream &out) const;
00059   void write(ostream &out, int indent_level = 0) const;
00060 
00061 private:
00062   static void
00063   vrpn_position_callback(void *userdata, const vrpn_TRACKERCB info);
00064   static void
00065   vrpn_velocity_callback(void *userdata, const vrpn_TRACKERVELCB info);
00066   static void
00067   vrpn_acceleration_callback(void *userdata, const vrpn_TRACKERACCCB info);
00068 
00069 private:
00070   string _tracker_name;
00071   vrpn_Tracker_Remote *_tracker;
00072 
00073   typedef pvector<VrpnTrackerDevice *> Devices;
00074   Devices _devices;
00075 };
00076 
00077 INLINE ostream &operator << (ostream &out, const VrpnTracker &tracker) {
00078   tracker.output(out);
00079   return out;
00080 }
00081 
00082 #include "vrpnTracker.I"
00083 
00084 #endif
00085 

Generated on Fri May 2 00:44:37 2003 for Panda by doxygen1.3