Panda3D
 All Classes Functions Variables Enumerations
clientDevice.I
1 // Filename: clientDevice.I
2 // Created by: drose (25Jan01)
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: ClientDevice::get_client
18 // Access: Public
19 // Description: Returns the ClientBase this device is associated
20 // with.
21 ////////////////////////////////////////////////////////////////////
23 get_client() const {
24  return _client;
25 }
26 
27 ////////////////////////////////////////////////////////////////////
28 // Function: ClientDevice::is_connected
29 // Access: Public
30 // Description: Returns true if the device is still connected to its
31 // ClientBase, false otherwise.
32 ////////////////////////////////////////////////////////////////////
33 INLINE bool ClientDevice::
34 is_connected() const {
35  return _is_connected;
36 }
37 
38 ////////////////////////////////////////////////////////////////////
39 // Function: ClientDevice::get_device_type
40 // Access: Public
41 // Description: Returns the type of device this is considered to be
42 // to the ClientBase: a ClientTrackerDevice,
43 // ClientAnalogDevice, or what have you. This is not
44 // exactly the same thing as get_type(), because it does
45 // not return the exact type of the ClientDevice
46 // (e.g. it reports ClientTrackerDevice, not
47 // VrpnTrackerDevice).
48 ////////////////////////////////////////////////////////////////////
50 get_device_type() const {
51  return _device_type;
52 }
53 
54 ////////////////////////////////////////////////////////////////////
55 // Function: ClientDevice::get_device_name
56 // Access: Public
57 // Description: Returns the device name reported to the ClientBase.
58 // This has some implementation-defined meaning to
59 // identify particular devices.
60 ////////////////////////////////////////////////////////////////////
61 INLINE const string &ClientDevice::
62 get_device_name() const {
63  return _device_name;
64 }
65 
66 ////////////////////////////////////////////////////////////////////
67 // Function: ClientDevice::acquire
68 // Access: Public
69 // Description: Grabs the mutex associated with this particular
70 // device. The device will not update asynchronously
71 // while the mutex is held, allowing the user to copy
72 // the data out without fear of getting a partial update
73 // during the copy.
74 ////////////////////////////////////////////////////////////////////
75 INLINE void ClientDevice::
77 #ifdef OLD_HAVE_IPC
78  _lock.acquire();
79 #endif
80 }
81 
82 ////////////////////////////////////////////////////////////////////
83 // Function: ClientDevice::unlock
84 // Access: Public
85 // Description: Releases the mutex associated with this particular
86 // device. This should be called after all the data has
87 // been successfully copied out. See acquire().
88 ////////////////////////////////////////////////////////////////////
89 INLINE void ClientDevice::
90 unlock() {
91 #ifdef OLD_HAVE_IPC
92  _lock.unlock();
93 #endif
94 }
bool is_connected() const
Returns true if the device is still connected to its ClientBase, false otherwise. ...
Definition: clientDevice.I:34
ClientBase * get_client() const
Returns the ClientBase this device is associated with.
Definition: clientDevice.I:23
void unlock()
Releases the mutex associated with this particular device.
Definition: clientDevice.I:90
An abstract base class for a family of client device interfaces–including trackers, buttons, dials, and other analog inputs.
Definition: clientBase.h:47
void acquire()
Grabs the mutex associated with this particular device.
Definition: clientDevice.I:76
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
const string & get_device_name() const
Returns the device name reported to the ClientBase.
Definition: clientDevice.I:62
TypeHandle get_device_type() const
Returns the type of device this is considered to be to the ClientBase: a ClientTrackerDevice, ClientAnalogDevice, or what have you.
Definition: clientDevice.I:50