Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/putil/pipelineCyclerBase.h

Go to the documentation of this file.
00001 // Filename: pipelineCyclerBase.h
00002 // Created by:  drose (21Feb02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef PIPELINECYCLERBASE_H
00020 #define PIPELINECYCLERBASE_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "cycleData.h"
00025 #include "pipeline.h"
00026 #include "pointerTo.h"
00027 
00028 ////////////////////////////////////////////////////////////////////
00029 //       Class : PipelineCyclerBase
00030 // Description : This is the non-template part of the implementation
00031 //               of PipelineCycler.  See PipelineCycler.
00032 //
00033 //               We define this as a struct instead of a class to
00034 //               guarantee byte placement within the object, so that
00035 //               (particularly for the trivial implementation) the
00036 //               inherited struct's data is likely to be placed by the
00037 //               compiler at the "this" pointer.
00038 ////////////////////////////////////////////////////////////////////
00039 struct EXPCL_PANDA PipelineCyclerBase {
00040 public:
00041   INLINE PipelineCyclerBase(CycleData *initial_data, Pipeline *pipeline = NULL);
00042   INLINE PipelineCyclerBase(CycleData *initial_data, const PipelineCyclerBase &copy);
00043   INLINE void operator = (const PipelineCyclerBase &copy);
00044   INLINE ~PipelineCyclerBase();
00045 
00046   INLINE const CycleData *read() const;
00047   INLINE void increment_read(const CycleData *pointer) const;
00048   INLINE void release_read(const CycleData *pointer) const;
00049 
00050   INLINE CycleData *write();
00051   INLINE CycleData *elevate_read(const CycleData *pointer);
00052   INLINE void release_write(CycleData *pointer);
00053 
00054   INLINE int get_num_stages();
00055   INLINE bool is_stage_unique(int n) const;
00056   INLINE CycleData *write_stage(int n);
00057   INLINE void release_write_stage(int n, CycleData *pointer);
00058 
00059   INLINE CycleData *cheat() const;
00060   INLINE int get_read_count() const;
00061   INLINE int get_write_count() const;
00062 
00063 #ifdef DO_PIPELINING
00064   // This private data is only stored here if we have pipelining
00065   // compiled in.  Actually, this particular data is only used for
00066   // sanity checking the pipelining code; it doesn't do anything
00067   // useful.
00068 private:
00069   PT(CycleData) _data;
00070   Pipeline *_pipeline;
00071   short _read_count, _write_count;
00072 
00073 #else  // !DO_PIPELINING
00074   // In a trivial implementation, we only need to store the CycleData
00075   // pointer.  Actually, we don't even need to do that, if we're lucky
00076   // and the compiler doesn't do anything funny with the struct
00077   // layout.
00078   #ifndef SIMPLE_STRUCT_POINTERS
00079   CycleData *_data;
00080   #endif  // SIMPLE_STRUCT_POINTERS
00081 
00082 #endif  // DO_PIPELINING
00083 };
00084 
00085 #include "pipelineCyclerBase.I"
00086 
00087 #endif
00088 

Generated on Fri May 2 00:43:41 2003 for Panda by doxygen1.3