Panda3D
cycleDataWriter.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 cycleDataWriter.h
10  * @author drose
11  * @date 2002-02-21
12  */
13 
14 #ifndef CYCLEDATAWRITER_H
15 #define CYCLEDATAWRITER_H
16 
17 #include "pandabase.h"
18 
19 #include "cycleData.h"
20 #include "pipelineCycler.h"
21 #include "cycleDataLockedReader.h"
22 #include "thread.h"
23 
24 /**
25  * This template class calls PipelineCycler::write() in the constructor and
26  * PipelineCycler::release_write() in the destructor. In the interim, it
27  * provides a transparent read-write access to the CycleData.
28  *
29  * It exists as a syntactic convenience to access the data in the CycleData.
30  * It also allows the whole system to compile down to nothing if DO_PIPELINING
31  * is not defined.
32  */
33 template<class CycleDataType>
35 public:
36  // By hiding this template from interrogate, we improve compile-time speed
37  // and memory utilization.
38 #ifndef CPPPARSER
40  Thread *current_thread = Thread::get_current_thread());
41  INLINE CycleDataWriter(PipelineCycler<CycleDataType> &cycler, bool force_to_0,
42  Thread *current_thread = Thread::get_current_thread());
44  CycleDataType *locked_cdata,
45  Thread *current_thread = Thread::get_current_thread());
47  INLINE CycleDataWriter(CycleDataWriter<CycleDataType> &&from) noexcept;
48 
50  INLINE CycleDataWriter(PipelineCycler<CycleDataType> &cycler, CycleDataLockedReader<CycleDataType> &take_from, bool force_to_0);
51 
52  INLINE void operator = (CycleDataWriter<CycleDataType> &&from) noexcept;
53  INLINE void operator = (const CycleDataWriter<CycleDataType> &copy);
54 
55  INLINE ~CycleDataWriter();
56 
57  INLINE CycleDataType *operator -> ();
58  INLINE const CycleDataType *operator -> () const;
59 
60  INLINE operator CycleDataType * ();
61 
62  INLINE Thread *get_current_thread() const;
63 
64 private:
65 #ifdef DO_PIPELINING
66  // This is the data stored for a real pipelining implementation.
68  Thread *_current_thread;
69  CycleDataType *_pointer;
70 #else // !DO_PIPELINING
71  // This is all we need for the trivial, do-nothing implementation.
72  CycleDataType *_pointer;
73 #endif // DO_PIPELINING
74 #endif // CPPPARSER
75 };
76 
77 #include "cycleDataWriter.I"
78 
79 #endif
cycleDataWriter.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Thread::get_current_thread
get_current_thread
Returns a pointer to the currently-executing Thread object.
Definition: thread.h:109
CycleDataWriter
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
Definition: cycleDataWriter.h:34
cycleData.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
cycleDataLockedReader.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
CycleDataWriter::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: cycleDataWriter.I:333
pipelineCycler.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
CycleDataLockedReader
This template class calls PipelineCycler::read() in the constructor and PipelineCycler::release_read(...
Definition: cycleDataLockedReader.h:40
Thread
A thread; that is, a lightweight process.
Definition: thread.h:46
thread.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
CycleDataWriter::operator->
CycleDataType * operator->()
This provides an indirect member access to the actual CycleData data.
Definition: cycleDataWriter.I:304
PipelineCycler
This class maintains different copies of a page of data between stages of the graphics pipeline (or a...
Definition: pipelineCycler.h:46