Panda3D

clientDialDevice.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 clientDialDevice.h
10 * @author drose
11 * @date 2001-01-26
12 */
13
14 #ifndef CLIENTDIALDEVICE_H
15 #define CLIENTDIALDEVICE_H
16
17 #include "pandabase.h"
18
19 #include "clientDevice.h"
20
21 /**
22 * A device, attached to the ClientBase by a DialNode, that records the data
23 * from a single named dial device. The named device can contain any number
24 * of dials, numbered in sequence beginning at zero.
25 *
26 * A dial is a rotating device that does not have stops--it can keep rotating
27 * any number of times. Therefore it does not have a specific position at any
28 * given time, unlike an AnalogDevice.
29 */
30 class EXPCL_PANDA_DEVICE ClientDialDevice : public ClientDevice {
31 protected:
32 INLINE ClientDialDevice(ClientBase *client, const std::string &device_name);
33
34 public:
35 INLINE int get_num_dials() const;
36
37 INLINE void push_dial(int index, double offset);
38 INLINE double read_dial(int index);
39 INLINE bool is_dial_known(int index) const;
40
41 private:
42 void ensure_dial_index(int index);
43
44 protected:
45 class DialState {
46 public:
47 INLINE DialState();
48
49 double _offset;
50 bool _known;
51 };
52
53 typedef pvector<DialState> Dials;
54 Dials _dials;
55
56
57 public:
58 static TypeHandle get_class_type() {
59 return _type_handle;
60 }
61 static void init_type() {
62 ClientDevice::init_type();
63 register_type(_type_handle, "ClientDialDevice",
64 ClientDevice::get_class_type());
65 }
66 virtual TypeHandle get_type() const {
67 return get_class_type();
68 }
69 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
70
71 private:
72 static TypeHandle _type_handle;
73 };
74
75 #include "clientDialDevice.I"
76
77 #endif
ClientBase
An abstract base class for a family of client device interfaces–including trackers,...
Definition: clientBase.h:43
ClientDevice
Any of a number of different devices that might be attached to a ClientBase, including trackers,...
Definition: clientDevice.h:27
ClientDialDevice
A device, attached to the ClientBase by a DialNode, that records the data from a single named dial de...
Definition: clientDialDevice.h:30
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
pvector< DialState >
clientDevice.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
clientDialDevice.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22