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

panda/src/putil/cycleDataReader.h

Go to the documentation of this file.
00001 // Filename: cycleDataReader.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 CYCLEDATAREADER_H
00020 #define CYCLEDATAREADER_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "cycleData.h"
00025 #include "pipelineCycler.h"
00026 
00027 ////////////////////////////////////////////////////////////////////
00028 //       Class : CycleDataReader
00029 // Description : This template class calls PipelineCycler::read() in
00030 //               the constructor and PipelineCycler::release_read() in
00031 //               the destructor.  In the interim, it provides a
00032 //               transparent read-only access to the CycleData.
00033 //
00034 //               It exists as a syntactic convenience to access the
00035 //               data in the CycleData.  It also allows the whole
00036 //               system to compile down to nothing if
00037 //               SUPPORT_PIPELINING is not defined.
00038 ////////////////////////////////////////////////////////////////////
00039 template<class CycleDataType>
00040 class CycleDataReader {
00041 public:
00042   INLINE CycleDataReader(const PipelineCycler<CycleDataType> &cycler);
00043   INLINE CycleDataReader(const CycleDataReader<CycleDataType> &copy);
00044   INLINE void operator = (const CycleDataReader<CycleDataType> &copy);
00045 
00046   INLINE ~CycleDataReader();
00047 
00048   INLINE const CycleDataType *operator -> () const;
00049   INLINE operator const CycleDataType * () const;
00050 
00051   INLINE const CycleDataType *take_pointer();
00052   INLINE CycleDataType *elevate_to_write(PipelineCycler<CycleDataType> &cycler);
00053 
00054 private:
00055 #ifdef DO_PIPELINING
00056   // This is the data stored for a real pipelining implementation.
00057   const PipelineCycler<CycleDataType> *_cycler;
00058   const CycleDataType *_pointer;
00059   CycleDataType *_write_pointer;
00060 #else  // !DO_PIPELINING
00061   // This is all we need for the trivial, do-nothing implementation.
00062   const CycleDataType *_pointer;
00063 #endif  // DO_PIPELINING
00064 };
00065 
00066 #include "cycleDataReader.I"
00067 
00068 #endif

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