23 template<
class CycleDataType>
28 _current_thread(current_thread)
30 _pointer = _cycler->read(_current_thread);
31 nassertv(_pointer !=
nullptr);
37 template<
class CycleDataType>
40 _cycler(copy._cycler),
41 _current_thread(copy._current_thread),
42 _pointer(copy._pointer)
44 nassertv(_pointer !=
nullptr);
45 _cycler->increment_read(_pointer);
51 template<
class CycleDataType>
54 _cycler(from._cycler),
55 _current_thread(from._current_thread),
56 _pointer(from._pointer)
58 from._pointer =
nullptr;
64 template<
class CycleDataType>
67 nassertv(_pointer ==
nullptr);
68 nassertv(_current_thread == copy._current_thread);
70 _cycler = copy._cycler;
71 _pointer = copy._pointer;
73 nassertv(_pointer !=
nullptr);
74 _cycler->increment_read(_pointer);
80 template<
class CycleDataType>
83 nassertv(_pointer ==
nullptr);
84 nassertv(_current_thread == from._current_thread);
86 _cycler = from._cycler;
87 _pointer = from._pointer;
89 from._pointer =
nullptr;
95 template<
class CycleDataType>
98 if (_pointer !=
nullptr) {
99 _cycler->release_read(_pointer);
106 template<
class CycleDataType>
109 nassertr(_pointer !=
nullptr, _cycler->cheat());
117 template<
class CycleDataType>
119 operator
const CycleDataType * ()
const {
120 nassertr(_pointer !=
nullptr, _cycler->cheat());
130 template<
class CycleDataType>
133 const CycleDataType *pointer = _pointer;
135 nassertr(pointer !=
nullptr, _cycler->cheat());
143 template<
class CycleDataType>
146 return _current_thread;
149 #else // !DO_PIPELINING 155 template<
class CycleDataType>
158 _pointer = cycler.
cheat();
164 template<
class CycleDataType>
167 _pointer(copy._pointer)
174 template<
class CycleDataType>
177 _pointer = copy._pointer;
183 template<
class CycleDataType>
186 nassertv(_pointer ==
nullptr);
188 _pointer = from._pointer;
189 from._pointer =
nullptr;
195 template<
class CycleDataType>
203 template<
class CycleDataType>
213 template<
class CycleDataType>
215 operator
const CycleDataType * ()
const {
225 template<
class CycleDataType>
235 template<
class CycleDataType>
238 return Thread::get_current_thread();
241 #endif // DO_PIPELINING This class maintains different copies of a page of data between stages of the graphics pipeline (or a...
CycleDataType * cheat() const
Returns a pointer without counting it.
const CycleDataType * take_pointer()
This is intended to be called only from CycleDataWriter when it elevates the pointer from read to wri...
Thread * get_current_thread() const
Returns the Thread pointer of the currently-executing thread, as passed to the constructor of this ob...
This template class calls PipelineCycler::read() in the constructor and PipelineCycler::release_read(...
const CycleDataType * operator ->() const
This provides an indirect member access to the actual CycleData data.
A thread; that is, a lightweight process.