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