Panda3D

Loading...
Searching...
No Matches
cycleDataStageReader.I
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 cycleDataStageReader.I
10 * @author drose
11 * @date 2006-02-08
12 */
13
14#ifndef CPPPARSER
15
16#ifdef DO_PIPELINING
17// This is the implementation for full support of pipelining (as well as the
18// sanity-check only implementation).
19
20/**
21 *
22 */
23 template<class CycleDataType>
24INLINE CycleDataStageReader<CycleDataType>::
25 CycleDataStageReader(const PipelineCycler<CycleDataType> &cycler,
26 int stage, Thread *current_thread) :
27 _cycler(&cycler),
28 _current_thread(current_thread),
29 _stage(stage)
30{
31 _pointer = _cycler->read_stage_unlocked(_stage);
32}
33
34/**
35 *
36 */
37 template<class CycleDataType>
38INLINE CycleDataStageReader<CycleDataType>::
39 CycleDataStageReader(const CycleDataStageReader<CycleDataType> &copy) :
40 _cycler(copy._cycler),
41 _current_thread(copy._current_thread),
42 _pointer(copy._pointer),
43 _stage(copy._stage)
44{
45}
46
47/**
48 *
49 */
50 template<class CycleDataType>
51INLINE void CycleDataStageReader<CycleDataType>::
52 operator = (const CycleDataStageReader<CycleDataType> &copy) {
53 nassertv(_current_thread == copy._current_thread);
54
55 _cycler = copy._cycler;
56 _pointer = copy._pointer;
57 _stage = copy._stage;
58}
59
60/**
61 *
62 */
63 template<class CycleDataType>
64INLINE CycleDataStageReader<CycleDataType>::
65~CycleDataStageReader() {
66}
67
68/**
69 * This provides an indirect member access to the actual CycleData data.
70 */
71 template<class CycleDataType>
72INLINE const CycleDataType *CycleDataStageReader<CycleDataType>::
73 operator -> () const {
74 return _pointer;
75}
76
77/**
78 * This allows the CycleDataStageReader to be passed to any function that
79 * expects a const CycleDataType pointer.
80 */
81 template<class CycleDataType>
82INLINE CycleDataStageReader<CycleDataType>::
83operator const CycleDataType * () const {
84 return _pointer;
85}
86
87/**
88 * Returns the Thread pointer of the currently-executing thread, as passed to
89 * the constructor of this object.
90 */
91 template<class CycleDataType>
92INLINE Thread *CycleDataStageReader<CycleDataType>::
93 get_current_thread() const {
94 return _current_thread;
95}
96
97#else // !DO_PIPELINING
98// This is the trivial, do-nothing implementation.
99
100/**
101 *
102 */
103 template<class CycleDataType>
104INLINE CycleDataStageReader<CycleDataType>::
105 CycleDataStageReader(const PipelineCycler<CycleDataType> &cycler, int,
106 Thread *) {
107 _pointer = cycler.cheat();
108}
109
110/**
111 *
112 */
113 template<class CycleDataType>
114INLINE CycleDataStageReader<CycleDataType>::
115 CycleDataStageReader(const CycleDataStageReader<CycleDataType> &copy) :
116 _pointer(copy._pointer)
117{
118}
119
120/**
121 *
122 */
123 template<class CycleDataType>
124INLINE void CycleDataStageReader<CycleDataType>::
125 operator = (const CycleDataStageReader<CycleDataType> &copy) {
126 _pointer = copy._pointer;
127}
128
129/**
130 *
131 */
132 template<class CycleDataType>
133INLINE CycleDataStageReader<CycleDataType>::
134~CycleDataStageReader() {
135}
136
137/**
138 * This provides an indirect member access to the actual CycleData data.
139 */
140 template<class CycleDataType>
141INLINE const CycleDataType *CycleDataStageReader<CycleDataType>::
142 operator -> () const {
143 return _pointer;
144}
145
146/**
147 * This allows the CycleDataStageReader to be passed to any function that
148 * expects a const CycleDataType pointer.
149 */
150 template<class CycleDataType>
151INLINE CycleDataStageReader<CycleDataType>::
152operator const CycleDataType * () const {
153 return _pointer;
154}
155
156/**
157 * Returns the Thread pointer of the currently-executing thread, as passed to
158 * the constructor of this object.
159 */
160 template<class CycleDataType>
161INLINE Thread *CycleDataStageReader<CycleDataType>::
162 get_current_thread() const {
163 return Thread::get_current_thread();
164}
165
166#endif // DO_PIPELINING
167#endif // CPPPARSER
CycleDataStageReader
This class is similar to CycleDataReader, except it allows reading from a particular stage of the pip...
Definition cycleDataStageReader.h:27
CycleDataStageReader::get_current_thread
Thread * get_current_thread() const
Returns the Thread pointer of the currently-executing thread, as passed to the constructor of this ob...
Definition cycleDataStageReader.I:162
CycleDataStageReader::operator->
const CycleDataType * operator->() const
This provides an indirect member access to the actual CycleData data.
Definition cycleDataStageReader.I:142
Thread
A thread; that is, a lightweight process.
Definition thread.h:46
Thread::get_current_thread
get_current_thread
Returns a pointer to the currently-executing Thread object.
Definition thread.h:109
PipelineCycler
This class maintains different copies of a page of data between stages of the graphics pipeline (or a...
Definition pipelineCycler.h:46
PipelineCycler::cheat
CycleDataType * cheat() const
Returns a pointer without counting it.
Definition pipelineCycler.I:342