Panda3D
|
00001 // Filename: clientDevice.I 00002 // Created by: drose (25Jan01) 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: ClientDevice::get_client 00018 // Access: Public 00019 // Description: Returns the ClientBase this device is associated 00020 // with. 00021 //////////////////////////////////////////////////////////////////// 00022 INLINE ClientBase *ClientDevice:: 00023 get_client() const { 00024 return _client; 00025 } 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Function: ClientDevice::is_connected 00029 // Access: Public 00030 // Description: Returns true if the device is still connected to its 00031 // ClientBase, false otherwise. 00032 //////////////////////////////////////////////////////////////////// 00033 INLINE bool ClientDevice:: 00034 is_connected() const { 00035 return _is_connected; 00036 } 00037 00038 //////////////////////////////////////////////////////////////////// 00039 // Function: ClientDevice::get_device_type 00040 // Access: Public 00041 // Description: Returns the type of device this is considered to be 00042 // to the ClientBase: a ClientTrackerDevice, 00043 // ClientAnalogDevice, or what have you. This is not 00044 // exactly the same thing as get_type(), because it does 00045 // not return the exact type of the ClientDevice 00046 // (e.g. it reports ClientTrackerDevice, not 00047 // VrpnTrackerDevice). 00048 //////////////////////////////////////////////////////////////////// 00049 INLINE TypeHandle ClientDevice:: 00050 get_device_type() const { 00051 return _device_type; 00052 } 00053 00054 //////////////////////////////////////////////////////////////////// 00055 // Function: ClientDevice::get_device_name 00056 // Access: Public 00057 // Description: Returns the device name reported to the ClientBase. 00058 // This has some implementation-defined meaning to 00059 // identify particular devices. 00060 //////////////////////////////////////////////////////////////////// 00061 INLINE const string &ClientDevice:: 00062 get_device_name() const { 00063 return _device_name; 00064 } 00065 00066 //////////////////////////////////////////////////////////////////// 00067 // Function: ClientDevice::acquire 00068 // Access: Public 00069 // Description: Grabs the mutex associated with this particular 00070 // device. The device will not update asynchronously 00071 // while the mutex is held, allowing the user to copy 00072 // the data out without fear of getting a partial update 00073 // during the copy. 00074 //////////////////////////////////////////////////////////////////// 00075 INLINE void ClientDevice:: 00076 acquire() { 00077 #ifdef OLD_HAVE_IPC 00078 _lock.acquire(); 00079 #endif 00080 } 00081 00082 //////////////////////////////////////////////////////////////////// 00083 // Function: ClientDevice::unlock 00084 // Access: Public 00085 // Description: Releases the mutex associated with this particular 00086 // device. This should be called after all the data has 00087 // been successfully copied out. See acquire(). 00088 //////////////////////////////////////////////////////////////////// 00089 INLINE void ClientDevice:: 00090 unlock() { 00091 #ifdef OLD_HAVE_IPC 00092 _lock.unlock(); 00093 #endif 00094 }