Panda3D
cycleDataLockedStageReader.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file cycleDataLockedStageReader.h
10  * @author drose
11  * @date 2006-04-30
12  */
13 
14 #ifndef CYCLEDATALOCKEDSTAGEREADER_H
15 #define CYCLEDATALOCKEDSTAGEREADER_H
16 
17 #include "pandabase.h"
18 
19 #include "cycleData.h"
20 #include "pipelineCycler.h"
21 
22 /**
23  * This class is similar to CycleDataLockedReader, except it allows reading
24  * from a particular stage of the pipeline.
25  */
26 template<class CycleDataType>
28 public:
29  // By hiding this template from interrogate, we improve compile-time speed
30  // and memory utilization.
31 #ifndef CPPPARSER
33  int stage, Thread *current_thread = Thread::get_current_thread());
36 
37  INLINE void operator = (const CycleDataLockedStageReader<CycleDataType> &copy);
38  INLINE void operator = (CycleDataLockedStageReader<CycleDataType> &&from) noexcept;
39 
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 
63 
64 #endif
This class maintains different copies of a page of data between stages of the graphics pipeline (or a...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
const CycleDataType * take_pointer()
This is intended to be called only from CycleDataStageWriter when it elevates the pointer from read t...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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:46
Thread * get_current_thread() const
Returns the Thread pointer of the currently-executing thread, as passed to the constructor of this ob...