Panda3D
dialNode.h
1 // Filename: dialNode.h
2 // Created by: drose (12Mar02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef DIALNODE_H
16 #define DIALNODE_H
17 
18 #include "pandabase.h"
19 
20 #include "clientBase.h"
21 #include "clientDialDevice.h"
22 #include "dataNode.h"
23 
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : DialNode
27 // Description : This is the primary interface to infinite dial type
28 // devices associated with a ClientBase. This creates a
29 // node that connects to the named dial device, if it
30 // exists, and provides hooks to the user to read the
31 // state of any of the sequentially numbered dial
32 // controls associated with that device.
33 //
34 // A dial is a rotating device that does not have
35 // stops--it can keep rotating any number of times.
36 // Therefore it does not have a specific position at any
37 // given time, unlike an AnalogDevice.
38 ////////////////////////////////////////////////////////////////////
39 class EXPCL_PANDA_DEVICE DialNode : public DataNode {
40 PUBLISHED:
41  DialNode(ClientBase *client, const string &device_name);
42  virtual ~DialNode();
43 
44  INLINE bool is_valid() const;
45 
46  INLINE int get_num_dials() const;
47 
48  INLINE double read_dial(int index);
49  INLINE bool is_dial_known(int index) const;
50 
51 private:
52  PT(ClientDialDevice) _dial;
53 
54 protected:
55  // Inherited from DataNode
56  virtual void do_transmit_data(DataGraphTraverser *trav,
57  const DataNodeTransmit &input,
58  DataNodeTransmit &output);
59 
60 private:
61  // no inputs or outputs at the moment.
62 
63 public:
64  static TypeHandle get_class_type() {
65  return _type_handle;
66  }
67  static void init_type() {
68  DataNode::init_type();
69  register_type(_type_handle, "DialNode",
70  DataNode::get_class_type());
71  }
72  virtual TypeHandle get_type() const {
73  return get_class_type();
74  }
75  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
76 
77 private:
78  static TypeHandle _type_handle;
79 };
80 
81 #include "dialNode.I"
82 
83 #endif
The fundamental type of node for the data graph.
Definition: dataNode.h:64
This is the primary interface to infinite dial type devices associated with a ClientBase.
Definition: dialNode.h:39
A device, attached to the ClientBase by a DialNode, that records the data from a single named dial de...
An abstract base class for a family of client device interfaces–including trackers, buttons, dials, and other analog inputs.
Definition: clientBase.h:47
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
Encapsulates the data generated from (or sent into) any particular DataNode.
This object supervises the traversal of the data graph and the moving of data from one DataNode to it...