00001 // Filename: vrpnDial.h 00002 // Created by: drose (26Jan01) 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 VRPNDIAL_H 00020 #define VRPNDIAL_H 00021 00022 #include <pandabase.h> 00023 00024 #include "vrpn_interface.h" 00025 00026 #include "pvector.h" 00027 00028 class VrpnDialDevice; 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Class : VrpnDial 00032 // Description : This is the actual interface to a particular VRPN 00033 // dial device, and all of its numbered dials. A 00034 // pointer to this object is stored in the VrpnClient 00035 // class for each differently-named VRPN dial device 00036 // we connect to. 00037 // 00038 // The VRPN callbacks go here, which in turn get 00039 // vectored out to any VrpnDialDevice objects that 00040 // register with this. When the last VrpnDialDevice 00041 // object unregisters, the VrpnDial will be deleted 00042 // by the VrpnClient. 00043 // 00044 // This class does not need to be exported from the DLL. 00045 //////////////////////////////////////////////////////////////////// 00046 class VrpnDial { 00047 public: 00048 VrpnDial(const string &dial_name, vrpn_Connection *connection); 00049 ~VrpnDial(); 00050 00051 INLINE const string &get_dial_name() const; 00052 INLINE bool is_empty() const; 00053 00054 void mark(VrpnDialDevice *device); 00055 void unmark(VrpnDialDevice *device); 00056 00057 INLINE void poll(); 00058 00059 void output(ostream &out) const; 00060 void write(ostream &out, int indent_level = 0) const; 00061 00062 private: 00063 static void 00064 vrpn_dial_callback(void *userdata, const vrpn_DIALCB info); 00065 00066 private: 00067 string _dial_name; 00068 vrpn_Dial_Remote *_dial; 00069 00070 typedef pvector<VrpnDialDevice *> Devices; 00071 Devices _devices; 00072 }; 00073 00074 INLINE ostream &operator << (ostream &out, const VrpnDial &dial) { 00075 dial.output(out); 00076 return out; 00077 } 00078 00079 #include "vrpnDial.I" 00080 00081 #endif