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