Panda3D

dataNodeTransmit.h

00001 // Filename: dataNodeTransmit.h
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 #ifndef DATANODETRANSMIT_H
00016 #define DATANODETRANSMIT_H
00017 
00018 #include "pandabase.h"
00019 #include "eventParameter.h"
00020 #include "typedWritable.h"
00021 #include "deletedChain.h"
00022 
00023 class Datagram;
00024 class DatagramIterator;
00025 class BamReader;
00026 class BamWriter;
00027 
00028 ////////////////////////////////////////////////////////////////////
00029 //       Class : DataNodeTransmit
00030 // Description : Encapsulates the data generated from (or sent into)
00031 //               any particular DataNode.  This is basically just an
00032 //               array of EventParameters, one for each registered
00033 //               input or output wire.
00034 ////////////////////////////////////////////////////////////////////
00035 class EXPCL_PANDA_DGRAPH DataNodeTransmit : public TypedWritable {
00036 public:
00037   INLINE DataNodeTransmit();
00038   INLINE DataNodeTransmit(const DataNodeTransmit &copy);
00039   INLINE void operator = (const DataNodeTransmit &copy);
00040   virtual ~DataNodeTransmit();
00041   ALLOC_DELETED_CHAIN(DataNodeTransmit);
00042 
00043   INLINE void reserve(int num_wires);
00044 
00045   INLINE const EventParameter &get_data(int index) const;
00046   INLINE bool has_data(int index) const;
00047   INLINE void set_data(int index, const EventParameter &data);
00048 
00049 private:
00050   void slot_data(int index);
00051 
00052   typedef pvector<EventParameter> Data;
00053   Data _data;
00054 
00055 public:
00056   static void register_with_read_factory();
00057   virtual void write_datagram(BamWriter *manager, Datagram &dg);
00058   virtual int complete_pointers(TypedWritable **plist,
00059                                 BamReader *manager);
00060 
00061 protected:
00062   static TypedWritable *make_from_bam(const FactoryParams &params);
00063   void fillin(DatagramIterator &scan, BamReader *manager);
00064   
00065 public:
00066   static TypeHandle get_class_type() {
00067     return _type_handle;
00068   }
00069   static void init_type() {
00070     TypedWritable::init_type();
00071     register_type(_type_handle, "DataNodeTransmit",
00072                   TypedWritable::get_class_type());
00073   }
00074   virtual TypeHandle get_type() const {
00075     return get_class_type();
00076   }
00077   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00078 
00079 private:
00080   static TypeHandle _type_handle;
00081 };
00082 
00083 #include "dataNodeTransmit.I"
00084 
00085 #endif
 All Classes Functions Variables Enumerations