Panda3D
Loading...
Searching...
No Matches
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 */
23template<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 */
36template<class CycleDataType>
39 _cycler(copy._cycler),
40 _current_thread(copy._current_thread),
41 _pointer(copy._pointer)
42{
43}
44
45/**
46 *
47 */
48template<class CycleDataType>
51 nassertv(_current_thread == copy._current_thread);
52
53 _cycler = copy._cycler;
54 _pointer = copy._pointer;
55}
56
57/**
58 *
59 */
60template<class CycleDataType>
63}
64
65/**
66 * This provides an indirect member access to the actual CycleData data.
67 */
68template<class CycleDataType>
69INLINE const CycleDataType *CycleDataReader<CycleDataType>::
70operator -> () 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 */
78template<class CycleDataType>
80operator 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 */
88template<class CycleDataType>
89INLINE const CycleDataType *CycleDataReader<CycleDataType>::
90p() 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 */
98template<class CycleDataType>
100get_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 */
110template<class CycleDataType>
113 _pointer = cycler.cheat();
114}
115
116/**
117 *
118 */
119template<class CycleDataType>
122 _pointer(copy._pointer)
123{
124}
125
126/**
127 *
128 */
129template<class CycleDataType>
132 _pointer = copy._pointer;
133}
134
135/**
136 *
137 */
138template<class CycleDataType>
141}
142
143/**
144 * This provides an indirect member access to the actual CycleData data.
145 */
146template<class CycleDataType>
147INLINE const CycleDataType *CycleDataReader<CycleDataType>::
148operator -> () 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 */
156template<class CycleDataType>
158operator 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 */
166template<class CycleDataType>
167INLINE const CycleDataType *CycleDataReader<CycleDataType>::
168p() 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 */
176template<class CycleDataType>
181
182#endif // DO_PIPELINING
183#endif // CPPPARSER
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
Thread * get_current_thread() const
Returns the Thread pointer of the currently-executing thread, as passed to the constructor of this ob...
const CycleDataType * operator->() const
This provides an indirect member access to the actual CycleData data.
const CycleDataType * p() const
This allows the CycleDataReader to be passed to any function that expects a const CycleDataType point...
A thread; that is, a lightweight process.
Definition thread.h:46
get_current_thread
Returns a pointer to the currently-executing Thread object.
Definition thread.h:109
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.