Panda3D

dataNodeTransmit.I
Go to the documentation of this file.
1 /**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file dataNodeTransmit.I
10 * @author drose
11 * @date 2002-03-11
12 */
13
14 /**
15 *
16 */
17 INLINE DataNodeTransmit::
18 DataNodeTransmit() {
19 }
20
21 /**
22 *
23 */
24 INLINE DataNodeTransmit::
25 DataNodeTransmit(const DataNodeTransmit &copy) :
26 _data(copy._data)
27 {
28 }
29
30 /**
31 *
32 */
33 INLINE void DataNodeTransmit::
34 operator = (const DataNodeTransmit &copy) {
35 _data = copy._data;
36 }
37
38 /**
39 * Tells the DataNodeTransmit object how many wires it is expected to store
40 * data for.
41 */
42 INLINE void DataNodeTransmit::
43 reserve(int num_wires) {
44 _data.reserve(num_wires);
45 }
46
47 /**
48 * Extracts the data for the indicated index, if it has been stored, or the
49 * empty parameter if it has not.
50 */
51 INLINE const EventParameter &DataNodeTransmit::
52 get_data(int index) const {
53 if (index >= 0 && index < (int)_data.size()) {
54 return _data[index];
55 }
56 static EventParameter empty_parameter;
57 return empty_parameter;
58 }
59
60 /**
61 * Returns true if the indicated parameter has been stored, false otherwise.
62 */
63 INLINE bool DataNodeTransmit::
64 has_data(int index) const {
65 if (index >= 0 && index < (int)_data.size()) {
66 return !_data[index].is_empty();
67 }
68 return false;
69 }
70
71 /**
72 * Sets the data for the indicated parameter.
73 */
74 INLINE void DataNodeTransmit::
75 set_data(int index, const EventParameter &data) {
76 if (index >= (int)_data.size()) {
77 slot_data(index);
78 }
79 nassertv(index >= 0 && index < (int)_data.size());
80 _data[index] = data;
81 }
DataNodeTransmit
Encapsulates the data generated from (or sent into) any particular DataNode.
Definition: dataNodeTransmit.h:32
DataNodeTransmit::get_data
const EventParameter & get_data(int index) const
Extracts the data for the indicated index, if it has been stored, or the empty parameter if it has no...
Definition: dataNodeTransmit.I:52
DataNodeTransmit::set_data
void set_data(int index, const EventParameter &data)
Sets the data for the indicated parameter.
Definition: dataNodeTransmit.I:75
DataNodeTransmit::has_data
bool has_data(int index) const
Returns true if the indicated parameter has been stored, false otherwise.
Definition: dataNodeTransmit.I:64
DataNodeTransmit::reserve
void reserve(int num_wires)
Tells the DataNodeTransmit object how many wires it is expected to store data for.
Definition: dataNodeTransmit.I:43
EventParameter
An optional parameter associated with an event.
Definition: eventParameter.h:35