Panda3D
dialNode.I
1 // Filename: dialNode.I
2 // Created by: drose (12Mar02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: DialNode::is_valid
18 // Access: Public
19 // Description: Returns true if the DialNode is valid and
20 // connected to a server, false otherwise.
21 ////////////////////////////////////////////////////////////////////
22 INLINE bool DialNode::
23 is_valid() const {
24  return (_dial != (ClientDialDevice *)NULL) && _dial->is_connected();
25 }
26 
27 ////////////////////////////////////////////////////////////////////
28 // Function: DialNode::get_num_dials
29 // Access: Public
30 // Description: Returns the number of dial dials known to the
31 // DialNode. This number may change as more dials
32 // are discovered.
33 ////////////////////////////////////////////////////////////////////
34 INLINE int DialNode::
35 get_num_dials() const {
36  _dial->acquire();
37  int result = _dial->get_num_dials();
38  _dial->unlock();
39  return result;
40 }
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->acquire();
53  double result = _dial->read_dial(index);
54  _dial->unlock();
55  return result;
56 }
57 
58 ////////////////////////////////////////////////////////////////////
59 // Function: DialNode::is_dial_known
60 // Access: Public
61 // Description: Returns true if the state of the indicated dial
62 // dial is known, or false if we have never heard
63 // anything about this particular dial.
64 ////////////////////////////////////////////////////////////////////
65 INLINE bool DialNode::
66 is_dial_known(int index) const {
67  _dial->acquire();
68  bool result = _dial->is_dial_known(index);
69  _dial->unlock();
70  return result;
71 }
bool is_valid() const
Returns true if the DialNode is valid and connected to a server, false otherwise. ...
Definition: dialNode.I:23
A device, attached to the ClientBase by a DialNode, that records the data from a single named dial de...
int get_num_dials() const
Returns the number of dial dials known to the DialNode.
Definition: dialNode.I:35
bool is_dial_known(int index) const
Returns true if the state of the indicated dial dial is known, or false if we have never heard anythi...
Definition: dialNode.I:66
double read_dial(int index)
Returns the number of complete revolutions of the dial since the last time read_dial() was called...
Definition: dialNode.I:51