From a9bdad2c66cfdf5852130b78e29681f02225fd4c Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Tue, 10 Feb 2026 21:11:02 +0100 Subject: [PATCH] BufferProvider: draft a new layout for the implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As a consequence of preceding experiments.. * I'll stick to the structure of the BufferProvider front-end interface * also the »code behind« will remain there; a purely abstract API has no merit here * however, the ''setup'' of the actual implementation will move into a derived class * this derived scope class, `BufferProviderSetup` will house two implementation classes * these two, now named `Stage` and `Store` provide the base implementation for the two "pillars" of the implementation Admitted, this structure is now much more elaborate, but it's the only path forward I'm currently able to come up in order to disentangle the existing implementation mess... --- src/steam/engine/buffer-metadata.hpp | 6 +-- src/steam/engine/buffer-provider-setup.hpp | 50 +++++++--------------- src/steam/engine/buffer-provider.cpp | 4 +- src/steam/engine/buffer-provider.hpp | 17 ++++++-- wiki/thinkPad.ichthyo.mm | 50 ++++++++++++++++++---- 5 files changed, 75 insertions(+), 52 deletions(-) diff --git a/src/steam/engine/buffer-metadata.hpp b/src/steam/engine/buffer-metadata.hpp index aeb92b856..4ca64d68e 100644 --- a/src/steam/engine/buffer-metadata.hpp +++ b/src/steam/engine/buffer-metadata.hpp @@ -573,9 +573,9 @@ namespace engine { * always created as children of a known type key. */ Key - key ( size_t storageSize - , TypeHandler instanceFunc =TypeHandler::RAW - , LocalTag specifics =LocalTag::UNKNOWN) + key (size_t storageSize + ,TypeHandler instanceFunc =TypeHandler::RAW + ,LocalTag specifics =LocalTag::UNKNOWN) { REQUIRE (storageSize); Key typeKey = trackKey (family_, storageSize); diff --git a/src/steam/engine/buffer-provider-setup.hpp b/src/steam/engine/buffer-provider-setup.hpp index e44eddc20..bef065774 100644 --- a/src/steam/engine/buffer-provider-setup.hpp +++ b/src/steam/engine/buffer-provider-setup.hpp @@ -50,50 +50,30 @@ namespace engine { /** - * Framework for configuring the actual BufferPovider backeind implementation. + * Framework for configuring the actual BufferPovider backend implementation. * * @todo WIP-WIP-WIP as of 2/2026 -- reworking BufferProvider implementation ////////////////////////////TICKET #1410 */ class BufferProviderSetup - : util::NonCopyable + : public BufferProvider { public: BufferProviderSetup (Literal implementationID); - - - uint announce (uint count, BuffDescr const&); - - BuffHandle lockBuffer (BuffDescr const&); - void emitBuffer (BuffHandle const&); - void releaseBuffer (BuffHandle const&); - - template - BuffHandle lockBufferFor (ARGS ...args); - - /** allow for attaching and owing an object within an already created buffer */ - void attachTypeHandler (BuffHandle const& target, BuffDescr const& reference); - - void emergencyCleanup (BuffHandle const& target, bool invokeDtor =false); - - - /** describe the kind of buffer managed by this provider */ - BuffDescr getDescriptorFor(size_t storageSize=0); - BuffDescr getDescriptorFor(size_t storageSize, TypeHandler specialTreatment); - - template - BuffDescr getDescriptor (ARGS ...args); - - - - /* === API for BuffHandle internal access === */ - - bool verifyValidity (BuffDescr const&) const; - size_t getBufferSize (HashVal typeID) const; + + class Stage + : protected BufferStage + { + + }; + + class Store + : protected BufferStore + { + + }; + protected: - BuffHandle buildHandle (HashVal typeID, Buff* storage, LocalTag const& =LocalTag::UNKNOWN); - - bool was_created_by_this_provider (BuffDescr const&) const; }; diff --git a/src/steam/engine/buffer-provider.cpp b/src/steam/engine/buffer-provider.cpp index ef65297ad..c20d2d9ab 100644 --- a/src/steam/engine/buffer-provider.cpp +++ b/src/steam/engine/buffer-provider.cpp @@ -19,7 +19,7 @@ #include "lib/error.hpp" #include "steam/engine/buffer-provider.hpp" -#include "steam/engine/buffer-metadata.hpp" +#include "steam/engine/buffer-metadata.hpp" /////////////////////////OOO must be removed from here #include "lib/util.hpp" using util::isSameAdr; @@ -47,7 +47,7 @@ namespace engine { * @param implementationID symbolic ID setting these family of buffers apart. */ BufferProvider::BufferProvider (Literal implementationID) - : bufferStage_(new BufferMetadata (implementationID)) + : bufferStage_(new BufferStage{implementationID}) { } BufferProvider::~BufferProvider() { } diff --git a/src/steam/engine/buffer-provider.hpp b/src/steam/engine/buffer-provider.hpp index b1f6ad87c..25962e37f 100644 --- a/src/steam/engine/buffer-provider.hpp +++ b/src/steam/engine/buffer-provider.hpp @@ -40,6 +40,7 @@ //#include "steam/engine/engine-ctx.hpp" #include "steam/engine/type-handler.hpp" #include "steam/engine/buffer-local-tag.hpp" +#include "steam/engine/buffer-metadata.hpp" /////////////////////////OOO must be removed from here #include "lib/nocopy.hpp" #include @@ -129,22 +130,30 @@ namespace engine { virtual void detachBuffer (HashVal, LocalTag const&, Buff&) =0; ///////////////////////////////////////////////////////////////////////////////OOO + class BufferStage + : public BufferMetadata /////////////////////////////////////////////////////////////////////TICKET #1410 : mix-in exiting old implementation -- for sake of refactoring only! + { + public: + virtual ~BufferStage() { } ///< this is an interface + + using BufferMetadata::BufferMetadata; ///////////////////////////////////////////////////////////TICKET #1410 : actual implementation structures should move down into this classes implementation + protected: + }; + class BufferStore : util::NonCopyable { public: virtual ~BufferStore() { } ///< this is an interface protected: - BufferStore() = default; - virtual uint prepareBuffers (uint count, HashVal typeID) =0; virtual BuffHandle provideLockedBuffer (HashVal typeID) =0; virtual void mark_emitted (HashVal, LocalTag const&) =0; virtual void detachBuffer (HashVal, LocalTag const&, Buff&) =0; }; - unique_ptr bufferStage_; /////////////////////////////////////////////////////////TICKET #1410 : must be turned into an internal interface - unique_ptr bufferStore_; + unique_ptr bufferStage_; ///////////////////////////////////////////////////////////TICKET #1410 : must be turned into an internal interface + unique_ptr bufferStore_; }; diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 57374d774..ab5f17c2c 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -110713,8 +110713,8 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -111488,8 +111488,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) wir haben hier nix zu verbergen

- - +
@@ -111656,7 +111655,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -111665,15 +111664,17 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension)

- + +
- - + + - + + @@ -111707,6 +111708,39 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) + + + + + + + +

+ ...was bedeutet, daß sie auch durch frei stehende Klassen implementiert werden können +

+ + +
+ + + + + + +

+ heißen: Stage und Store +

+ + +
+
+ + + + + + +