Panda3D
cycleDataReader.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 cycleDataReader.I
10  * @author drose
11  * @date 2002-02-21
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>
26  Thread *current_thread) :
27  _cycler(&cycler),
28  _current_thread(current_thread)
29 {
30  _pointer = _cycler->read_unlocked(_current_thread);
31 }
32 
33 /**
34  *
35  */
36 template<class CycleDataType>
39  _cycler(copy._cycler),
40  _current_thread(copy._current_thread),
41  _pointer(copy._pointer)
42 {
43 }
44 
45 /**
46  *
47  */
48 template<class CycleDataType>
51  nassertv(_current_thread == copy._current_thread);
52 
53  _cycler = copy._cycler;
54  _pointer = copy._pointer;
55 }
56 
57 /**
58  *
59  */
60 template<class CycleDataType>
63 }
64 
65 /**
66  * This provides an indirect member access to the actual CycleData data.
67  */
68 template<class CycleDataType>
69 INLINE const CycleDataType *CycleDataReader<CycleDataType>::
70 operator -> () const {
71  return _pointer;
72 }
73 
74 /**
75  * This allows the CycleDataReader to be passed to any function that expects a
76  * const CycleDataType pointer.
77  */
78 template<class CycleDataType>
80 operator const CycleDataType * () const {
81  return _pointer;
82 }
83 
84 /**
85  * This allows the CycleDataReader to be passed to any function that expects a
86  * const CycleDataType pointer.
87  */
88 template<class CycleDataType>
89 INLINE const CycleDataType *CycleDataReader<CycleDataType>::
90 p() const {
91  return _pointer;
92 }
93 
94 /**
95  * Returns the Thread pointer of the currently-executing thread, as passed to
96  * the constructor of this object.
97  */
98 template<class CycleDataType>
100 get_current_thread() const {
101  return _current_thread;
102 }
103 
104 #else // !DO_PIPELINING
105 // This is the trivial, do-nothing implementation.
106 
107 /**
108  *
109  */
110 template<class CycleDataType>
113  _pointer = cycler.cheat();
114 }
115 
116 /**
117  *
118  */
119 template<class CycleDataType>
122  _pointer(copy._pointer)
123 {
124 }
125 
126 /**
127  *
128  */
129 template<class CycleDataType>
132  _pointer = copy._pointer;
133 }
134 
135 /**
136  *
137  */
138 template<class CycleDataType>
141 }
142 
143 /**
144  * This provides an indirect member access to the actual CycleData data.
145  */
146 template<class CycleDataType>
147 INLINE const CycleDataType *CycleDataReader<CycleDataType>::
148 operator -> () const {
149  return _pointer;
150 }
151 
152 /**
153  * This allows the CycleDataReader to be passed to any function that expects a
154  * const CycleDataType pointer.
155  */
156 template<class CycleDataType>
158 operator const CycleDataType * () const {
159  return _pointer;
160 }
161 
162 /**
163  * This allows the CycleDataReader to be passed to any function that expects a
164  * const CycleDataType pointer.
165  */
166 template<class CycleDataType>
167 INLINE const CycleDataType *CycleDataReader<CycleDataType>::
168 p() const {
169  return _pointer;
170 }
171 
172 /**
173  * Returns the Thread pointer of the currently-executing thread, as passed to
174  * the constructor of this object.
175  */
176 template<class CycleDataType>
179  return Thread::get_current_thread();
180 }
181 
182 #endif // DO_PIPELINING
183 #endif // CPPPARSER
const CycleDataType * p() const
This allows the CycleDataReader to be passed to any function that expects a const CycleDataType point...
This class maintains different copies of a page of data between stages of the graphics pipeline (or a...
Thread * get_current_thread() const
Returns the Thread pointer of the currently-executing thread, as passed to the constructor of this ob...
CycleDataType * cheat() const
Returns a pointer without counting it.
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
A thread; that is, a lightweight process.
Definition: thread.h:46
const CycleDataType * operator ->() const
This provides an indirect member access to the actual CycleData data.