Panda3D

cycleDataStageReader.h

00001 // Filename: cycleDataStageReader.h
00002 // Created by:  drose (08Feb06)
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 CYCLEDATASTAGEREADER_H
00016 #define CYCLEDATASTAGEREADER_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "cycleData.h"
00021 #include "pipelineCycler.h"
00022 
00023 ////////////////////////////////////////////////////////////////////
00024 //       Class : CycleDataStageReader
00025 // Description : This class is similar to CycleDataReader, except it
00026 //               allows reading from a particular stage of the
00027 //               pipeline.
00028 ////////////////////////////////////////////////////////////////////
00029 template<class CycleDataType>
00030 class CycleDataStageReader {
00031 public:
00032   // By hiding this template from interrogate, we improve compile-time
00033   // speed and memory utilization.
00034 #ifndef CPPPARSER
00035   INLINE CycleDataStageReader(const PipelineCycler<CycleDataType> &cycler, 
00036                               int stage, Thread *current_thread = Thread::get_current_thread());
00037   INLINE CycleDataStageReader(const CycleDataStageReader<CycleDataType> &copy);
00038   INLINE void operator = (const CycleDataStageReader<CycleDataType> &copy);
00039 
00040   INLINE ~CycleDataStageReader();
00041 
00042   INLINE const CycleDataType *operator -> () const;
00043   INLINE operator const CycleDataType * () const;
00044 
00045   INLINE Thread *get_current_thread() const;
00046 
00047 private:
00048 #ifdef DO_PIPELINING
00049   // This is the data stored for a real pipelining implementation.
00050   const PipelineCycler<CycleDataType> *_cycler;
00051   Thread *_current_thread;
00052   const CycleDataType *_pointer;
00053   int _stage;
00054 #else  // !DO_PIPELINING
00055   // This is all we need for the trivial, do-nothing implementation.
00056   const CycleDataType *_pointer;
00057 #endif  // DO_PIPELINING
00058 #endif  // CPPPARSER
00059 };
00060 
00061 #include "cycleDataStageReader.I"
00062 
00063 #endif
 All Classes Functions Variables Enumerations