dialNode.I 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // Filename: dialNode.I
  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. ////////////////////////////////////////////////////////////////////
  19. // Function: DialNode::is_valid
  20. // Access: Public
  21. // Description: Returns true if the DialNode is valid and
  22. // connected to a server, false otherwise.
  23. ////////////////////////////////////////////////////////////////////
  24. INLINE bool DialNode::
  25. is_valid() const {
  26. return (_dial != (ClientDialDevice *)NULL) && _dial->is_connected();
  27. }
  28. ////////////////////////////////////////////////////////////////////
  29. // Function: DialNode::get_num_dials
  30. // Access: Public
  31. // Description: Returns the number of dial dials known to the
  32. // DialNode. This number may change as more dials
  33. // are discovered.
  34. ////////////////////////////////////////////////////////////////////
  35. INLINE int DialNode::
  36. get_num_dials() const {
  37. _dial->lock();
  38. int result = _dial->get_num_dials();
  39. _dial->unlock();
  40. return result;
  41. }
  42. ////////////////////////////////////////////////////////////////////
  43. // Function: DialNode::read_dial
  44. // Access: Public
  45. // Description: Returns the number of complete revolutions of the
  46. // dial since the last time read_dial() was called.
  47. // This is a destructive operation; it is not possible
  48. // to read the dial without resetting the counter.
  49. ////////////////////////////////////////////////////////////////////
  50. INLINE double DialNode::
  51. read_dial(int index) {
  52. _dial->lock();
  53. double result = _dial->read_dial(index);
  54. _dial->unlock();
  55. return result;
  56. }
  57. ////////////////////////////////////////////////////////////////////
  58. // Function: DialNode::is_dial_known
  59. // Access: Public
  60. // Description: Returns true if the state of the indicated dial
  61. // dial is known, or false if we have never heard
  62. // anything about this particular dial.
  63. ////////////////////////////////////////////////////////////////////
  64. INLINE bool DialNode::
  65. is_dial_known(int index) const {
  66. _dial->lock();
  67. bool result = _dial->is_dial_known(index);
  68. _dial->unlock();
  69. return result;
  70. }