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