Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
buffer-proxy-provider.hpp
Go to the documentation of this file.
1/*
2 BUFFER-PROXY-PROVIDER.hpp - Adapter to access existing allocation via buffer handling protocol
3
4 Copyright (C)
5 2024, 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
22#ifndef STEAM_ENGINE_BUFFER_PROXY_PROVIDER_H
23#define STEAM_ENGINE_BUFFER_PROXY_PROVIDER_H
24
25
26#include "lib/error.hpp"
27#include "lib/symbol.hpp"
28#include "lib/meta/util.hpp"
29//#include "lib/hash-value.h"
32//#include "steam/engine/engine-ctx.hpp"
33//#include "steam/engine/type-handler.hpp"
34//#include "steam/engine/buffer-local-tag.hpp"
35#include "lib/nocopy.hpp"
36
37#include <functional>
38#include <utility>
39//#include <memory>
40
41
42namespace steam {
43namespace engine {
44
45 using lib::Literal;
46// using std::unique_ptr;
47// using std::forward;
48
49
50
51
58 {
59
60 using Listener = std::function<void(size_t,BufferState)>;
61
63 : public BufferProvider
64 {
66
67 /* === BufferProvider API === */
68
69 uint
70 prepareBuffers (uint, HashVal) override
71 {
72 NOTREACHED ("this part of the API should not be used");
73 return 1; // can not sensibly do anything for "pre-allocation",
74 } // other than telling the caller that we only "have one buffer to provide"
75
77 provideLockedBuffer (HashVal typeID) override
78 {
80// return buildHandle (typeID, asBuffer(newBlock.accessMemory()), &newBlock);
81 }
82
83 void
84 mark_emitted (HashVal, LocalTag const&) override
85 {
86
87 }
88
89 void
90 detachBuffer (HashVal, LocalTag const&, Buff&) override
91 {
92
93 }
94 public:
96 : BufferProvider{"BufferProxyProvider"}
97 , listener_{std::move (listener)}
98 { }
99 };
100
102
103
104 public:
105 template<class LIS, typename = lib::meta::disable_if_self<BufferProxyProvider, LIS>>
106 BufferProxyProvider (LIS&& listener)
107 : passThroughProvider_{std::forward<LIS> (listener)}
108 { }
109
110 template<typename TAR>
112 lockBuffer (TAR& dataBlock)
113 {
115 UNIMPLEMENTED ("setup type handler and then create a locked BuffHandle");
116 }
117
118 };
119
120
121
122
123 /* === Implementation === */
124
128}} // namespace steam::engine
129#endif /*STEAM_ENGINE_BUFFER_PROXY_PROVIDER_H*/
Metadata for managing and accessing buffers.
Abstraction to represent buffer management and lifecycle within the render engine.
Inline string literal.
Definition symbol.hpp:78
placeholder type for the contents of a data buffer.
Handle for a buffer for processing data, abstracting away the actual implementation.
Interface: a facility providing and managing working buffers for media calculations.
void detachBuffer(HashVal, LocalTag const &, Buff &) override
Adapter to expose access to data blocks via BuffHandle and the BufferProvider protocol.
std::function< void(size_t, BufferState)> Listener
an opaque mark to be used by the BufferProvider implementation.
Any copy and copy construction prohibited.
Definition nocopy.hpp:38
Lumiera error handling (C++ interface).
unsigned int uint
Definition integral.hpp:29
Simple and lightweight helpers for metaprogramming and type detection.
STL namespace.
BufferState
Buffer states usable within BufferProvider and stored within the metadata.
Steam-Layer implementation namespace root.
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Marker types to indicate a literal string and a Symbol.