00001 // Filename: dataNodeTransmit.I 00002 // Created by: drose (11Mar02) 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: DataNodeTransmit::Constructor 00022 // Access: Public 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE DataNodeTransmit:: 00026 DataNodeTransmit() { 00027 } 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Function: DataNodeTransmit::Copy Constructor 00031 // Access: Public 00032 // Description: 00033 //////////////////////////////////////////////////////////////////// 00034 INLINE DataNodeTransmit:: 00035 DataNodeTransmit(const DataNodeTransmit ©) : 00036 _data(copy._data) 00037 { 00038 } 00039 00040 //////////////////////////////////////////////////////////////////// 00041 // Function: DataNodeTransmit::Copy Assignment Operator 00042 // Access: Public 00043 // Description: 00044 //////////////////////////////////////////////////////////////////// 00045 INLINE void DataNodeTransmit:: 00046 operator = (const DataNodeTransmit ©) { 00047 _data = copy._data; 00048 } 00049 00050 //////////////////////////////////////////////////////////////////// 00051 // Function: DataNodeTransmit::Destructor 00052 // Access: Public 00053 // Description: 00054 //////////////////////////////////////////////////////////////////// 00055 INLINE DataNodeTransmit:: 00056 ~DataNodeTransmit() { 00057 } 00058 00059 //////////////////////////////////////////////////////////////////// 00060 // Function: DataNodeTransmit::reserve 00061 // Access: Public 00062 // Description: Tells the DataNodeTransmit object how many wires it 00063 // is expected to store data for. 00064 //////////////////////////////////////////////////////////////////// 00065 INLINE void DataNodeTransmit:: 00066 reserve(int num_wires) { 00067 _data.reserve(num_wires); 00068 } 00069 00070 //////////////////////////////////////////////////////////////////// 00071 // Function: DataNodeTransmit::get_data 00072 // Access: Public 00073 // Description: Extracts the data for the indicated index, if it has 00074 // been stored, or the empty parameter if it has not. 00075 //////////////////////////////////////////////////////////////////// 00076 INLINE const EventParameter &DataNodeTransmit:: 00077 get_data(int index) const { 00078 if (index >= 0 && index < (int)_data.size()) { 00079 return _data[index]; 00080 } 00081 static EventParameter empty_parameter; 00082 return empty_parameter; 00083 } 00084 00085 //////////////////////////////////////////////////////////////////// 00086 // Function: DataNodeTransmit::has_data 00087 // Access: Public 00088 // Description: Returns true if the indicated parameter has been 00089 // stored, false otherwise. 00090 //////////////////////////////////////////////////////////////////// 00091 INLINE bool DataNodeTransmit:: 00092 has_data(int index) const { 00093 if (index >= 0 && index < (int)_data.size()) { 00094 return !_data[index].is_empty(); 00095 } 00096 return false; 00097 } 00098 00099 //////////////////////////////////////////////////////////////////// 00100 // Function: DataNodeTransmit::set_data 00101 // Access: Public 00102 // Description: Sets the data for the indicated parameter. 00103 //////////////////////////////////////////////////////////////////// 00104 INLINE void DataNodeTransmit:: 00105 set_data(int index, const EventParameter &data) { 00106 if (index >= (int)_data.size()) { 00107 slot_data(index); 00108 } 00109 nassertv(index >= 0 && index < (int)_data.size()); 00110 _data[index] = data; 00111 }