Panda3D
Loading...
Searching...
No Matches
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 */
17INLINE DataNodeTransmit::
18DataNodeTransmit() {
19}
20
21/**
22 *
23 */
24INLINE DataNodeTransmit::
25DataNodeTransmit(const DataNodeTransmit &copy) :
26 _data(copy._data)
27{
28}
29
30/**
31 *
32 */
33INLINE void DataNodeTransmit::
34operator = (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 */
43reserve(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 */
52get_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 */
64has_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 */
75set_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}
Encapsulates the data generated from (or sent into) any particular DataNode.
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...
void set_data(int index, const EventParameter &data)
Sets the data for the indicated parameter.
bool has_data(int index) const
Returns true if the indicated parameter has been stored, false otherwise.
void reserve(int num_wires)
Tells the DataNodeTransmit object how many wires it is expected to store data for.
An optional parameter associated with an event.