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