Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
buffhandle.hpp
Go to the documentation of this file.
1/*
2 BUFFHANDLE.hpp - Buffer handling support for the render engine
3
4 Copyright (C)
5 2008, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12*/
13
48#ifndef ENGINE_BUFFHANDLE_H
49#define ENGINE_BUFFHANDLE_H
50
51
52#include "lib/error.hpp"
53#include "lib/hash-value.h"
54#include "steam/streamtype.hpp"
55
56
57namespace steam {
58namespace engine {
59 namespace error = lumiera::error;
60
61 using lib::HashVal;
62
63 class BuffHandle;
64 class BufferProvider;
65
66
67
78 {
79 protected:
82
83 BuffDescr(BufferProvider& manager, HashVal detail)
84 : provider_(&manager)
85 , subClassification_(detail)
86 { }
87
88 friend class BufferProvider;
89 friend class BuffHandle;
90
91 public:
92 // using standard copy operations
93
94 bool verifyValidity() const;
95 size_t determineBufferSize() const;
96
97 operator HashVal() const { return subClassification_; }
98
100 uint announce (uint count);
102 };
103
104
105
106
112 {
114
117
118
119 public:
120 using PBuff = Buff*;
121
124 BuffHandle(BuffDescr const& typeInfo, void* storage = 0)
125 : descriptor_(typeInfo)
126 , pBuffer_(static_cast<PBuff>(storage))
127 { }
128
129 // using standard copy operations
130
131 explicit operator bool() const { return isValid(); }
132
133
134 void emit();
135 void release();
136
137
138 template<typename BU>
139 BU& create();
140
141 template<typename BU>
142 BU& accessAs();
143
144
147 Buff&
149 {
150 ENSURE (pBuffer_);
151 return *pBuffer_;
152 }
153
154 bool
155 isValid() const
156 {
157 return bool(pBuffer_)
159 }
160
161 HashVal
162 entryID() const
163 {
164 return HashVal(descriptor_);
165 }
166
167 size_t
168 size() const
169 {
171 }
172
173 private:
174 template<typename BU>
175 void takeOwnershipFor();
176 void takeOwnershipFor(BuffDescr const& type);
177
178 void emergencyCleanup();
179 };
180
181
182
183
184}} // namespace steam::engine
185#endif
placeholder type for the contents of a data buffer.
An opaque descriptor to identify the type and further properties of a data buffer.
BufferProvider * provider_
BuffDescr(BufferProvider &manager, HashVal detail)
uint announce(uint count)
convenience shortcut to start a buffer handling cycle
Handle for a buffer for processing data, abstracting away the actual implementation.
BuffHandle(BuffDescr const &typeInfo, void *storage=0)
BU & accessAs()
convenience shortcut: access the buffer contents casted to a specific type.
BU & create()
convenience shortcut: place and maintain an object within the buffer.
Interface: a facility providing and managing working buffers for media calculations.
Lumiera error handling (C++ interface).
Hash value types and utilities.
unsigned int uint
Definition integral.hpp:29
size_t HashVal
a STL compatible hash value
Definition hash-value.h:52
Steam-Layer implementation namespace root.
Framework for classification of media streams.