Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
buffhandle-attach.hpp
Go to the documentation of this file.
1/*
2 BUFFHANDLE-ATTACH.hpp - Buffer handle extension to attach objects into the buffer
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
35#ifndef ENGINE_BUFFHANDLE_ATTACH_H
36#define ENGINE_BUFFHANDLE_ATTACH_H
37
38
39#include "lib/error.hpp"
42
43
44namespace steam {
45namespace engine {
46
47
48
49
50 /* === BuffHandle Implementation === */
51
52
53#define _EXCEPTION_SAFE_INVOKE(_CTOR_) \
54 try \
55 { \
56 return *new(pBuffer_) _CTOR_; \
57 } \
58 catch(...) \
59 { \
60 emergencyCleanup(); /* EX_FREE */ \
61 pBuffer_ = 0; \
62 throw; \
63 }
64
74 template<typename BU>
75 inline BU&
77 {
78 takeOwnershipFor<BU>();
80 }
81
82#undef _EXCEPTION_SAFE_INVOKE
83
84
85
93 template<typename BU>
94 inline void
96 {
97 BuffDescr howto_attach_object_automatically
99 takeOwnershipFor (howto_attach_object_automatically); // EX_STRONG
100 }
101
102
108 template<typename BU>
109 inline BU&
111 {
112 if (!pBuffer_)
113 throw error::Logic ("buffer not (yet) locked for access by clients"
114 , LERR_(LIFECYCLE));
115 return *reinterpret_cast<BU*> (pBuffer_);
116 }
117
118
119
120}} // namespace steam::engine
121#endif
Abstraction to represent buffer management and lifecycle within the render engine.
#define _EXCEPTION_SAFE_INVOKE(_CTOR_)
A front-end to support the buffer management within the render nodes.
An opaque descriptor to identify the type and further properties of a data buffer.
BufferProvider * provider_
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.
BuffDescr getDescriptor(ARGS ...args)
define a "buffer type" for automatically creating an instance of the template type embedded into the ...
Lumiera error handling (C++ interface).
#define LERR_(_NAME_)
Definition error.hpp:45
LumieraError< LERR_(LOGIC)> Logic
Definition error.hpp:207
Steam-Layer implementation namespace root.