Panda3D
cycleData.h
1 // Filename: cycleData.h
2 // Created by: drose (21Feb02)
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 CYCLEDATA_H
16 #define CYCLEDATA_H
17 
18 #include "pandabase.h"
19 #include "typeHandle.h"
20 #include "nodeReferenceCount.h"
21 
22 class BamWriter;
23 class BamReader;
24 class TypedWritable;
25 class Datagram;
26 class DatagramIterator;
27 
28 ////////////////////////////////////////////////////////////////////
29 // Class : CycleData
30 // Description : A single page of data maintained by a PipelineCycler.
31 // Normally you should inherit from this class to define
32 // the data structures that are important to protect
33 // between stages of a pipeline. See PipelineCycler.
34 ////////////////////////////////////////////////////////////////////
35 #ifdef DO_PIPELINING
36 
37 // If we are compiling in pipelining support, we maintain a pointer to
38 // a CycleData object in each containing class, instead of the object
39 // itself. Thus, it should be a ReferenceCount object. Furthermore,
40 // since we want to make a distinction between references within the
41 // cycler, and references outside the cycler
42 // (e.g. GeomPipelineReader), we make it a NodeReferenceCount.
43 class EXPCL_PANDA_PIPELINE CycleData : public NodeReferenceCount
44 
45 #else // !DO_PIPELINING
46 
47 // If we are *not* compiling in pipelining support, the CycleData
48 // object is stored directly within its containing classes, and hence
49 // should not be a ReferenceCount object.
50 class EXPCL_PANDA_PIPELINE CycleData
51 
52 #endif // DO_PIPELINING
53 {
54 public:
55  INLINE CycleData();
56  virtual ~CycleData();
57 
58  virtual CycleData *make_copy() const=0;
59 
60  virtual void write_datagram(BamWriter *, Datagram &) const;
61  virtual void write_datagram(BamWriter *, Datagram &, void *extra_data) const;
62  virtual int complete_pointers(TypedWritable **p_list, BamReader *manager);
63  virtual void fillin(DatagramIterator &scan, BamReader *manager);
64  virtual void fillin(DatagramIterator &scan, BamReader *manager,
65  void *extra_data);
66 
67  virtual TypeHandle get_parent_type() const;
68  virtual void output(ostream &out) const;
69 };
70 
71 INLINE ostream &
72 operator << (ostream &out, const CycleData &cd) {
73  cd.output(out);
74  return out;
75 }
76 
77 #include "cycleData.I"
78 
79 #endif
80 
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
virtual void output(ostream &out) const
Formats the contents of the CycleData in some meaningful way for humans.
Definition: cycleData.cxx:103
A single page of data maintained by a PipelineCycler.
Definition: cycleData.h:50
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:37
virtual TypeHandle get_parent_type() const
Returns the type of the container that owns the CycleData.
Definition: cycleData.cxx:91
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
This class specializes ReferenceCount to add an additional counter, called node_ref_count, for the purposes of counting the number of times the object is referenced by a "node", whatever that may mean in context.
virtual void write_datagram(BamWriter *, Datagram &) const
Writes the contents of this object to the datagram for shipping out to a Bam file.
Definition: cycleData.cxx:34
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()...
Definition: cycleData.cxx:55
virtual void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is intended to be called by each class&#39;s make_from_bam() method to read in all...
Definition: cycleData.cxx:68
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