Panda3D
 All Classes Functions Variables Enumerations
cycleDataLockedStageReader.h
1 // Filename: cycleDataLockedStageReader.h
2 // Created by: drose (30Apr06)
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 CYCLEDATALOCKEDSTAGEREADER_H
16 #define CYCLEDATALOCKEDSTAGEREADER_H
17 
18 #include "pandabase.h"
19 
20 #include "cycleData.h"
21 #include "pipelineCycler.h"
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : CycleDataLockedStageReader
25 // Description : This class is similar to CycleDataLockedReader,
26 // except it allows reading from a particular stage of
27 // the pipeline.
28 ////////////////////////////////////////////////////////////////////
29 template<class CycleDataType>
31 public:
32  // By hiding this template from interrogate, we improve compile-time
33  // speed and memory utilization.
34 #ifndef CPPPARSER
36  int stage, Thread *current_thread = Thread::get_current_thread());
37  INLINE CycleDataLockedStageReader(const CycleDataLockedStageReader<CycleDataType> &copy);
38  INLINE void operator = (const CycleDataLockedStageReader<CycleDataType> &copy);
39 
40  INLINE ~CycleDataLockedStageReader();
41 
42  INLINE const CycleDataType *operator -> () const;
43  INLINE operator const CycleDataType * () const;
44 
45  INLINE const CycleDataType *take_pointer();
46  INLINE Thread *get_current_thread() const;
47 
48 private:
49 #ifdef DO_PIPELINING
50  // This is the data stored for a real pipelining implementation.
51  const PipelineCycler<CycleDataType> *_cycler;
52  Thread *_current_thread;
53  const CycleDataType *_pointer;
54  int _stage;
55 #else // !DO_PIPELINING
56  // This is all we need for the trivial, do-nothing implementation.
57  const CycleDataType *_pointer;
58 #endif // DO_PIPELINING
59 #endif // CPPPARSER
60 };
61 
62 #include "cycleDataLockedStageReader.I"
63 
64 #endif
This class maintains different copies of a page of data between stages of the graphics pipeline (or a...
const CycleDataType * take_pointer()
This is intended to be called only from CycleDataStageWriter when it elevates the pointer from read t...
static Thread * get_current_thread()
Returns a pointer to the currently-executing Thread object.
Definition: thread.I:145
const CycleDataType * operator->() const
This provides an indirect member access to the actual CycleData data.
This class is similar to CycleDataLockedReader, except it allows reading from a particular stage of t...
A thread; that is, a lightweight process.
Definition: thread.h:51
Thread * get_current_thread() const
Returns the Thread pointer of the currently-executing thread, as passed to the constructor of this ob...