Panda3D
dataNodeTransmit.h
1 // Filename: dataNodeTransmit.h
2 // Created by: drose (11Mar02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef DATANODETRANSMIT_H
16 #define DATANODETRANSMIT_H
17 
18 #include "pandabase.h"
19 #include "eventParameter.h"
20 #include "typedWritable.h"
21 #include "deletedChain.h"
22 
23 class Datagram;
24 class DatagramIterator;
25 class BamReader;
26 class BamWriter;
27 
28 ////////////////////////////////////////////////////////////////////
29 // Class : DataNodeTransmit
30 // Description : Encapsulates the data generated from (or sent into)
31 // any particular DataNode. This is basically just an
32 // array of EventParameters, one for each registered
33 // input or output wire.
34 ////////////////////////////////////////////////////////////////////
35 class EXPCL_PANDA_DGRAPH DataNodeTransmit : public TypedWritable {
36 public:
37  INLINE DataNodeTransmit();
38  INLINE DataNodeTransmit(const DataNodeTransmit &copy);
39  INLINE void operator = (const DataNodeTransmit &copy);
40  virtual ~DataNodeTransmit();
41  ALLOC_DELETED_CHAIN(DataNodeTransmit);
42 
43  INLINE void reserve(int num_wires);
44 
45  INLINE const EventParameter &get_data(int index) const;
46  INLINE bool has_data(int index) const;
47  INLINE void set_data(int index, const EventParameter &data);
48 
49 private:
50  void slot_data(int index);
51 
53  Data _data;
54 
55 public:
56  static void register_with_read_factory();
57  virtual void write_datagram(BamWriter *manager, Datagram &dg);
59  BamReader *manager);
60 
61 protected:
62  static TypedWritable *make_from_bam(const FactoryParams &params);
63  void fillin(DatagramIterator &scan, BamReader *manager);
64 
65 public:
66  static TypeHandle get_class_type() {
67  return _type_handle;
68  }
69  static void init_type() {
70  TypedWritable::init_type();
71  register_type(_type_handle, "DataNodeTransmit",
72  TypedWritable::get_class_type());
73  }
74  virtual TypeHandle get_type() const {
75  return get_class_type();
76  }
77  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
78 
79 private:
80  static TypeHandle _type_handle;
81 };
82 
83 #include "dataNodeTransmit.I"
84 
85 #endif
An optional parameter associated with an event.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:37
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
This is our own Panda specialization on the default STL list.
Definition: plist.h:38
virtual void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is intended to be called by each class's make_from_bam() method to read in all...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin()...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:40
A class to retrieve the individual data elements previously stored in a Datagram. ...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43
Encapsulates the data generated from (or sent into) any particular DataNode.