00001 // Filename: dialNode.I 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 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: DialNode::is_valid 00018 // Access: Public 00019 // Description: Returns true if the DialNode is valid and 00020 // connected to a server, false otherwise. 00021 //////////////////////////////////////////////////////////////////// 00022 INLINE bool DialNode:: 00023 is_valid() const { 00024 return (_dial != (ClientDialDevice *)NULL) && _dial->is_connected(); 00025 } 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Function: DialNode::get_num_dials 00029 // Access: Public 00030 // Description: Returns the number of dial dials known to the 00031 // DialNode. This number may change as more dials 00032 // are discovered. 00033 //////////////////////////////////////////////////////////////////// 00034 INLINE int DialNode:: 00035 get_num_dials() const { 00036 _dial->acquire(); 00037 int result = _dial->get_num_dials(); 00038 _dial->unlock(); 00039 return result; 00040 } 00041 00042 //////////////////////////////////////////////////////////////////// 00043 // Function: DialNode::read_dial 00044 // Access: Public 00045 // Description: Returns the number of complete revolutions of the 00046 // dial since the last time read_dial() was called. 00047 // This is a destructive operation; it is not possible 00048 // to read the dial without resetting the counter. 00049 //////////////////////////////////////////////////////////////////// 00050 INLINE double DialNode:: 00051 read_dial(int index) { 00052 _dial->acquire(); 00053 double result = _dial->read_dial(index); 00054 _dial->unlock(); 00055 return result; 00056 } 00057 00058 //////////////////////////////////////////////////////////////////// 00059 // Function: DialNode::is_dial_known 00060 // Access: Public 00061 // Description: Returns true if the state of the indicated dial 00062 // dial is known, or false if we have never heard 00063 // anything about this particular dial. 00064 //////////////////////////////////////////////////////////////////// 00065 INLINE bool DialNode:: 00066 is_dial_known(int index) const { 00067 _dial->acquire(); 00068 bool result = _dial->is_dial_known(index); 00069 _dial->unlock(); 00070 return result; 00071 }