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