dialNode.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Filename: dialNode.h
  2. // Created by: drose (26Jan01)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. #ifndef DIALNODE_H
  6. #define DIALNODE_H
  7. #include <pandabase.h>
  8. #include "clientBase.h"
  9. #include "clientDialDevice.h"
  10. #include <dataNode.h>
  11. #include <nodeAttributes.h>
  12. ////////////////////////////////////////////////////////////////////
  13. // Class : DialNode
  14. // Description : This is the primary interface to infinite dial type
  15. // devices associated with a ClientBase. This creates a
  16. // node that connects to the named dial device, if it
  17. // exists, and provides hooks to the user to read the
  18. // state of any of the sequentially numbered dial
  19. // controls associated with that device.
  20. //
  21. // A dial is a rotating device that does not have
  22. // stops--it can keep rotating any number of times.
  23. // Therefore it does not have a specific position at any
  24. // given time, unlike an AnalogDevice.
  25. ////////////////////////////////////////////////////////////////////
  26. class EXPCL_PANDA DialNode : public DataNode {
  27. PUBLISHED:
  28. DialNode(ClientBase *client, const string &device_name);
  29. virtual ~DialNode();
  30. INLINE bool is_valid() const;
  31. INLINE int get_num_dials() const;
  32. INLINE double read_dial(int index);
  33. INLINE bool is_dial_known(int index) const;
  34. ////////////////////////////////////////////////////////////////////
  35. // From parent class DataNode
  36. ////////////////////////////////////////////////////////////////////
  37. public:
  38. virtual void
  39. transmit_data(NodeAttributes &data);
  40. NodeAttributes _attrib;
  41. private:
  42. PT(ClientDialDevice) _dial;
  43. public:
  44. virtual TypeHandle get_type() const {
  45. return get_class_type();
  46. }
  47. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  48. static TypeHandle get_class_type() {
  49. return _type_handle;
  50. }
  51. static void init_type();
  52. private:
  53. static TypeHandle _type_handle;
  54. };
  55. #include "dialNode.I"
  56. #endif