dialNode.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // Filename: dialNode.h
  2. // Created by: drose (12Mar02)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://www.panda3d.org/license.txt .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef DIALNODE_H
  19. #define DIALNODE_H
  20. #include "pandabase.h"
  21. #include "clientBase.h"
  22. #include "clientDialDevice.h"
  23. #include "dataNode.h"
  24. ////////////////////////////////////////////////////////////////////
  25. // Class : DialNode
  26. // Description : This is the primary interface to infinite dial type
  27. // devices associated with a ClientBase. This creates a
  28. // node that connects to the named dial device, if it
  29. // exists, and provides hooks to the user to read the
  30. // state of any of the sequentially numbered dial
  31. // controls associated with that device.
  32. //
  33. // A dial is a rotating device that does not have
  34. // stops--it can keep rotating any number of times.
  35. // Therefore it does not have a specific position at any
  36. // given time, unlike an AnalogDevice.
  37. ////////////////////////////////////////////////////////////////////
  38. class EXPCL_PANDA DialNode : public DataNode {
  39. PUBLISHED:
  40. DialNode(ClientBase *client, const string &device_name);
  41. virtual ~DialNode();
  42. INLINE bool is_valid() const;
  43. INLINE int get_num_dials() const;
  44. INLINE double read_dial(int index);
  45. INLINE bool is_dial_known(int index) const;
  46. private:
  47. PT(ClientDialDevice) _dial;
  48. protected:
  49. // Inherited from DataNode
  50. virtual void do_transmit_data(const DataNodeTransmit &input,
  51. DataNodeTransmit &output);
  52. private:
  53. // no inputs or outputs at the moment.
  54. public:
  55. static TypeHandle get_class_type() {
  56. return _type_handle;
  57. }
  58. static void init_type() {
  59. DataNode::init_type();
  60. register_type(_type_handle, "DialNode",
  61. DataNode::get_class_type());
  62. }
  63. virtual TypeHandle get_type() const {
  64. return get_class_type();
  65. }
  66. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  67. private:
  68. static TypeHandle _type_handle;
  69. };
  70. #include "dialNode.I"
  71. #endif