Panda3D
|
00001 // Filename: dialNode.h 00002 // Created by: drose (12Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef DIALNODE_H 00016 #define DIALNODE_H 00017 00018 #include "pandabase.h" 00019 00020 #include "clientBase.h" 00021 #include "clientDialDevice.h" 00022 #include "dataNode.h" 00023 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Class : DialNode 00027 // Description : This is the primary interface to infinite dial type 00028 // devices associated with a ClientBase. This creates a 00029 // node that connects to the named dial device, if it 00030 // exists, and provides hooks to the user to read the 00031 // state of any of the sequentially numbered dial 00032 // controls associated with that device. 00033 // 00034 // A dial is a rotating device that does not have 00035 // stops--it can keep rotating any number of times. 00036 // Therefore it does not have a specific position at any 00037 // given time, unlike an AnalogDevice. 00038 //////////////////////////////////////////////////////////////////// 00039 class EXPCL_PANDA_DEVICE DialNode : public DataNode { 00040 PUBLISHED: 00041 DialNode(ClientBase *client, const string &device_name); 00042 virtual ~DialNode(); 00043 00044 INLINE bool is_valid() const; 00045 00046 INLINE int get_num_dials() const; 00047 00048 INLINE double read_dial(int index); 00049 INLINE bool is_dial_known(int index) const; 00050 00051 private: 00052 PT(ClientDialDevice) _dial; 00053 00054 protected: 00055 // Inherited from DataNode 00056 virtual void do_transmit_data(DataGraphTraverser *trav, 00057 const DataNodeTransmit &input, 00058 DataNodeTransmit &output); 00059 00060 private: 00061 // no inputs or outputs at the moment. 00062 00063 public: 00064 static TypeHandle get_class_type() { 00065 return _type_handle; 00066 } 00067 static void init_type() { 00068 DataNode::init_type(); 00069 register_type(_type_handle, "DialNode", 00070 DataNode::get_class_type()); 00071 } 00072 virtual TypeHandle get_type() const { 00073 return get_class_type(); 00074 } 00075 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00076 00077 private: 00078 static TypeHandle _type_handle; 00079 }; 00080 00081 #include "dialNode.I" 00082 00083 #endif