00001 // Filename: cycleData.h 00002 // Created by: drose (21Feb02) 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 CYCLEDATA_H 00016 #define CYCLEDATA_H 00017 00018 #include "pandabase.h" 00019 #include "typeHandle.h" 00020 #include "nodeReferenceCount.h" 00021 00022 class BamWriter; 00023 class BamReader; 00024 class TypedWritable; 00025 class Datagram; 00026 class DatagramIterator; 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Class : CycleData 00030 // Description : A single page of data maintained by a PipelineCycler. 00031 // Normally you should inherit from this class to define 00032 // the data structures that are important to protect 00033 // between stages of a pipeline. See PipelineCycler. 00034 //////////////////////////////////////////////////////////////////// 00035 #ifdef DO_PIPELINING 00036 00037 // If we are compiling in pipelining support, we maintain a pointer to 00038 // a CycleData object in each containing class, instead of the object 00039 // itself. Thus, it should be a ReferenceCount object. Furthermore, 00040 // since we want to make a distinction between references within the 00041 // cycler, and references outside the cycler 00042 // (e.g. GeomPipelineReader), we make it a NodeReferenceCount. 00043 class EXPCL_PANDA_PIPELINE CycleData : public NodeReferenceCount 00044 00045 #else // !DO_PIPELINING 00046 00047 // If we are *not* compiling in pipelining support, the CycleData 00048 // object is stored directly within its containing classes, and hence 00049 // should not be a ReferenceCount object. 00050 class EXPCL_PANDA_PIPELINE CycleData 00051 00052 #endif // DO_PIPELINING 00053 { 00054 public: 00055 INLINE CycleData(); 00056 virtual ~CycleData(); 00057 00058 virtual CycleData *make_copy() const=0; 00059 00060 virtual void write_datagram(BamWriter *, Datagram &) const; 00061 virtual void write_datagram(BamWriter *, Datagram &, void *extra_data) const; 00062 virtual int complete_pointers(TypedWritable **p_list, BamReader *manager); 00063 virtual void fillin(DatagramIterator &scan, BamReader *manager); 00064 virtual void fillin(DatagramIterator &scan, BamReader *manager, 00065 void *extra_data); 00066 00067 virtual TypeHandle get_parent_type() const; 00068 virtual void output(ostream &out) const; 00069 }; 00070 00071 INLINE ostream & 00072 operator << (ostream &out, const CycleData &cd) { 00073 cd.output(out); 00074 return out; 00075 } 00076 00077 #include "cycleData.I" 00078 00079 #endif 00080