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