diff --git a/src/steam/engine/buffer-provider.hpp b/src/steam/engine/buffer-provider.hpp index 622f24f3b..02bdc2ba8 100644 --- a/src/steam/engine/buffer-provider.hpp +++ b/src/steam/engine/buffer-provider.hpp @@ -181,23 +181,30 @@ namespace engine { protected: bool was_created_by_this_provider (BuffDescr const&) const; + using Buff = StreamType::ImplFacade::DataBuffer; ///< marker type for an actual data buffer + class BufferStage : public BufferMetadata /////////////////////////////////////////////////////////////////////TICKET #1410 : mix-in exiting old implementation -- for sake of refactoring only! { protected: - using Key = metadata::Key; + using ID = metadata::Key const&; public: virtual ~BufferStage() { } ///< this is an interface - using BufferMetadata::BufferMetadata; ///////////////////////////////////////////////////////////TICKET #1410 : actual implementation structures should move down into this classes implementation + + virtual ID lookup (HashVal) =0; + virtual ID mark_locked (ID typeKey, Buff*, LocalTag) =0; + virtual ID mark_emitted (HashVal stateKey) =0; + virtual ID mark_released (HashVal stateKey) =0; + virtual ID abandon (HashVal, bool destroy=false) =0; + virtual void discard (HashVal stateKey) =0; }; class BufferStore : util::NonCopyable { protected: - using Buff = StreamType::ImplFacade::DataBuffer; ///< marker type for an actual data buffer using Slot = std::tuple; public: virtual ~BufferStore() { } ///< this is an interface diff --git a/src/steam/engine/simple-buffer-state-registry.hpp b/src/steam/engine/simple-buffer-state-registry.hpp index fdd2b41ae..24259c1b6 100644 --- a/src/steam/engine/simple-buffer-state-registry.hpp +++ b/src/steam/engine/simple-buffer-state-registry.hpp @@ -37,6 +37,7 @@ namespace engine { namespace error = lumiera::error; + using metadata::Buff; // using std::unique_ptr; // using lib::HashVal; @@ -49,9 +50,51 @@ namespace engine { : public BufferProviderSetup::Stage { ///////////////////////////////////////////////////////////////////////////////////////////////////////TICKET 1410 : rather hold BufferMetatdata object here - public: + /* === BufferStage interface === */ + ID + lookup (HashVal key) override + { + return this->get (key); + } + + ID + mark_locked (ID typeKey, Buff* storage, LocalTag implMark) override + { + return this->markLocked (typeKey, storage, implMark); + } + + ID + mark_emitted (HashVal stateKey) override + { + metadata::Entry& metaEntry = this->get (stateKey); + metaEntry.mark(EMITTED); + return metaEntry; // contains also the key + } + + ID + mark_released (HashVal stateKey) override + { + metadata::Entry& metaEntry = this->get (stateKey); + metaEntry.mark(FREE); // might invoke embedded dtor function + return metaEntry; + } + + ID + abandon (HashVal stateKey, bool invokeDtor) override + { + metadata::Entry& metaEntry = this->get (stateKey); + metaEntry.invalidate (invokeDtor); + return metaEntry; + } + + void + discard (HashVal stateKey) override + { + this->release (stateKey); + } + public: SimpleBufferStateRegistry (Literal implementationID)