Panda3D
vrpnDial.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 vrpnDial.h
10  * @author drose
11  * @date 2001-01-26
12  */
13 
14 #ifndef VRPNDIAL_H
15 #define VRPNDIAL_H
16 
17 #include "pandabase.h"
18 
19 #include "vrpn_interface.h"
20 
21 #include "pvector.h"
22 
23 class VrpnDialDevice;
24 
25 /**
26  * This is the actual interface to a particular VRPN dial device, and all of
27  * its numbered dials. A pointer to this object is stored in the VrpnClient
28  * class for each differently-named VRPN dial device we connect to.
29  *
30  * The VRPN callbacks go here, which in turn get vectored out to any
31  * VrpnDialDevice objects that register with this. When the last
32  * VrpnDialDevice object unregisters, the VrpnDial will be deleted by the
33  * VrpnClient.
34  *
35  * This class does not need to be exported from the DLL.
36  */
37 class VrpnDial {
38 public:
39  VrpnDial(const std::string &dial_name, vrpn_Connection *connection);
40  ~VrpnDial();
41 
42  INLINE const std::string &get_dial_name() const;
43  INLINE bool is_empty() const;
44 
45  void mark(VrpnDialDevice *device);
46  void unmark(VrpnDialDevice *device);
47 
48  INLINE void poll();
49 
50  void output(std::ostream &out) const;
51  void write(std::ostream &out, int indent_level = 0) const;
52 
53 private:
54  static void VRPN_CALLBACK
55  vrpn_dial_callback(void *userdata, const vrpn_DIALCB info);
56 
57 private:
58  std::string _dial_name;
59  vrpn_Dial_Remote *_dial;
60 
62  Devices _devices;
63 };
64 
65 INLINE std::ostream &operator << (std::ostream &out, const VrpnDial &dial) {
66  dial.output(out);
67  return out;
68 }
69 
70 #include "vrpnDial.I"
71 
72 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The Panda interface to a VRPN dial device.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void mark(VrpnDialDevice *device)
Adds the indicated VrpnDialDevice to the list of devices that are sharing this VrpnDial.
Definition: vrpnDial.cxx:48
bool is_empty() const
Returns true if no VrpnDialDevices reference this VrpnDial, or false otherwise.
Definition: vrpnDial.I:27
void poll()
Polls the connected device.
Definition: vrpnDial.I:36
const std::string & get_dial_name() const
Returns the name of the dial device that was used to create this VrpnDial.
Definition: vrpnDial.I:18
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the actual interface to a particular VRPN dial device, and all of its numbered dials.
Definition: vrpnDial.h:37
void unmark(VrpnDialDevice *device)
Removes the indicated VrpnDialDevice from the list of devices that are sharing this VrpnDial.
Definition: vrpnDial.cxx:60