dataNodeTransmit.I 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // Filename: dataNodeTransmit.I
  2. // Created by: drose (11Mar02)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://etc.cmu.edu/panda3d/docs/license/ .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. ////////////////////////////////////////////////////////////////////
  19. // Function: DataNodeTransmit::Constructor
  20. // Access: Public
  21. // Description:
  22. ////////////////////////////////////////////////////////////////////
  23. INLINE DataNodeTransmit::
  24. DataNodeTransmit() {
  25. }
  26. ////////////////////////////////////////////////////////////////////
  27. // Function: DataNodeTransmit::Copy Constructor
  28. // Access: Public
  29. // Description:
  30. ////////////////////////////////////////////////////////////////////
  31. INLINE DataNodeTransmit::
  32. DataNodeTransmit(const DataNodeTransmit &copy) :
  33. _data(copy._data)
  34. {
  35. }
  36. ////////////////////////////////////////////////////////////////////
  37. // Function: DataNodeTransmit::Copy Assignment Operator
  38. // Access: Public
  39. // Description:
  40. ////////////////////////////////////////////////////////////////////
  41. INLINE void DataNodeTransmit::
  42. operator = (const DataNodeTransmit &copy) {
  43. _data = copy._data;
  44. }
  45. ////////////////////////////////////////////////////////////////////
  46. // Function: DataNodeTransmit::reserve
  47. // Access: Public
  48. // Description: Tells the DataNodeTransmit object how many wires it
  49. // is expected to store data for.
  50. ////////////////////////////////////////////////////////////////////
  51. INLINE void DataNodeTransmit::
  52. reserve(int num_wires) {
  53. _data.reserve(num_wires);
  54. }
  55. ////////////////////////////////////////////////////////////////////
  56. // Function: DataNodeTransmit::get_data
  57. // Access: Public
  58. // Description: Extracts the data for the indicated index, if it has
  59. // been stored, or the empty parameter if it has not.
  60. ////////////////////////////////////////////////////////////////////
  61. INLINE const EventParameter &DataNodeTransmit::
  62. get_data(int index) const {
  63. if (index >= 0 && index < (int)_data.size()) {
  64. return _data[index];
  65. }
  66. static EventParameter empty_parameter;
  67. return empty_parameter;
  68. }
  69. ////////////////////////////////////////////////////////////////////
  70. // Function: DataNodeTransmit::has_data
  71. // Access: Public
  72. // Description: Returns true if the indicated parameter has been
  73. // stored, false otherwise.
  74. ////////////////////////////////////////////////////////////////////
  75. INLINE bool DataNodeTransmit::
  76. has_data(int index) const {
  77. if (index >= 0 && index < (int)_data.size()) {
  78. return !_data[index].is_empty();
  79. }
  80. return false;
  81. }
  82. ////////////////////////////////////////////////////////////////////
  83. // Function: DataNodeTransmit::set_data
  84. // Access: Public
  85. // Description: Sets the data for the indicated parameter.
  86. ////////////////////////////////////////////////////////////////////
  87. INLINE void DataNodeTransmit::
  88. set_data(int index, const EventParameter &data) {
  89. if (index >= (int)_data.size()) {
  90. slot_data(index);
  91. }
  92. nassertv(index >= 0 && index < (int)_data.size());
  93. _data[index] = data;
  94. }