diff --git a/src/steam/engine/buffer-provider-setup.hpp b/src/steam/engine/buffer-provider-setup.hpp index c38e25b43..f8a8dfa0f 100644 --- a/src/steam/engine/buffer-provider-setup.hpp +++ b/src/steam/engine/buffer-provider-setup.hpp @@ -38,6 +38,7 @@ namespace engine { using lib::Literal; using std::unique_ptr; + using std::make_unique; // using std::forward; using std::move; @@ -68,19 +69,17 @@ namespace engine { bufferStage_ = move (confRec.buildStage()); bufferStore_ = move (confRec.buildStore()); } - + + + /* ======== Extension points ======== */ + class Stage : public BufferStage - { - public: - using BufferStage::BufferStage; ///////////////////////////////////////////////////////////TICKET #1410 : actual implementation structures should move down into this classes implementation - - }; - + { }; + class Store : public BufferStore - { - }; + { }; protected: diff --git a/src/steam/engine/buffer-provider.cpp b/src/steam/engine/buffer-provider.cpp index bccf91647..973e5e3b3 100644 --- a/src/steam/engine/buffer-provider.cpp +++ b/src/steam/engine/buffer-provider.cpp @@ -29,9 +29,11 @@ #include "lib/error.hpp" #include "steam/engine/buffer-provider.hpp" #include "steam/engine/buffer-metadata.hpp" /////////////////////////OOO must be removed from here -#include "steam/engine/simple-buffer-state-registry.hpp" /////////////OOO better use constexpr for hash-chaining? #include "lib/util.hpp" +#include + +using std::move; using util::isSameAdr; namespace steam { @@ -63,7 +65,7 @@ namespace engine { bool BufferProvider::isAccessible (HashVal id) const { - return bufferStage_->isUsageAllowed (id); + return bufferStage_->isAccessible (id); } size_t diff --git a/src/steam/engine/buffer-provider.hpp b/src/steam/engine/buffer-provider.hpp index d4821c51c..08424778a 100644 --- a/src/steam/engine/buffer-provider.hpp +++ b/src/steam/engine/buffer-provider.hpp @@ -118,7 +118,6 @@ #include "steam/engine/buffhandle.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 @@ -194,13 +193,12 @@ namespace engine { class BufferStage - : public BufferMetadata /////////////////////////////////////////////////////////////////////TICKET #1410 : mix-in exiting old implementation -- for sake of refactoring only! + : util::NonCopyable { protected: 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 defineBufferType (size_t, TypeHandler) =0; virtual ID lookup (HashVal) =0; @@ -209,7 +207,7 @@ namespace engine { virtual ID mark_released (HashVal stateKey) =0; virtual ID abandon (HashVal, bool destroy=false) =0; virtual void discard (HashVal stateKey) =0; - virtual bool isUsageAllowed (HashVal stateKey) const =0; + virtual bool isAccessible (HashVal stateKey) const =0; }; class BufferStore diff --git a/src/steam/engine/naive-buffer-setup.hpp b/src/steam/engine/naive-buffer-setup.hpp index e7db88b31..711f67686 100644 --- a/src/steam/engine/naive-buffer-setup.hpp +++ b/src/steam/engine/naive-buffer-setup.hpp @@ -60,7 +60,7 @@ namespace engine { { } auto buildStage() { return std::make_unique ("Naive_HeapAllocated"); } - auto buildStore() { return std::make_unique(); } /////////////////////////////////TICKET #1410 : turn into a subclass of BufferSetup::Store and push down implementation + auto buildStore() { return std::make_unique(); } }; diff --git a/src/steam/engine/simple-buffer-state-registry.hpp b/src/steam/engine/simple-buffer-state-registry.hpp index d3dfe7672..3fb91be6a 100644 --- a/src/steam/engine/simple-buffer-state-registry.hpp +++ b/src/steam/engine/simple-buffer-state-registry.hpp @@ -25,7 +25,6 @@ #include "lib/error.hpp" -//#include "lib/hash-value.h" #include "steam/engine/buffer-provider-setup.hpp" #include "steam/engine/buffer-metadata.hpp" @@ -38,8 +37,6 @@ namespace engine { namespace error = lumiera::error; using metadata::Buff; -// using std::unique_ptr; -// using lib::HashVal; /** @@ -49,39 +46,39 @@ namespace engine { class SimpleBufferStateRegistry : public BufferProviderSetup::Stage { - ///////////////////////////////////////////////////////////////////////////////////////////////////////TICKET 1410 : rather hold BufferMetatdata object here + BufferMetadata metadata_; /* === BufferStage interface === */ ID lookup (HashVal key) override { - return this->isKnown(key)? this->get (key) - : metadata::Key::INVALID; + return metadata_.isKnown(key)? metadata_.get (key) + : metadata::Key::INVALID; } bool - isUsageAllowed (HashVal stateKey) const override + isAccessible (HashVal stateKey) const override { - return this->isAccessible (stateKey); + return metadata_.isAccessible (stateKey); } ID defineBufferType (size_t buffSiz, TypeHandler handlerFunctions) { - return lookup (this->key (buffSiz, move (handlerFunctions))); + return lookup (metadata_.key (buffSiz, move (handlerFunctions))); } // deliberately: create storage, and return reference to it ID mark_locked (ID typeKey, Buff* storage, LocalTag implMark) override { - return this->markLocked (typeKey, storage, implMark); + return metadata_.markLocked (typeKey, storage, implMark); } ID mark_emitted (HashVal stateKey) override { - metadata::Entry& metaEntry = this->get (stateKey); + metadata::Entry& metaEntry = metadata_.get (stateKey); metaEntry.mark(EMITTED); return metaEntry; // contains also the key } @@ -89,7 +86,7 @@ namespace engine { ID mark_released (HashVal stateKey) override { - metadata::Entry& metaEntry = this->get (stateKey); + metadata::Entry& metaEntry = metadata_.get (stateKey); metaEntry.mark(FREE); // might invoke embedded dtor function return metaEntry; } @@ -97,7 +94,7 @@ namespace engine { ID abandon (HashVal stateKey, bool invokeDtor) override { - metadata::Entry& metaEntry = this->get (stateKey); + metadata::Entry& metaEntry = metadata_.get (stateKey); metaEntry.invalidate (invokeDtor); return metaEntry; } @@ -105,13 +102,13 @@ namespace engine { void discard (HashVal stateKey) override { - this->release (stateKey); + metadata_.release (stateKey); } public: SimpleBufferStateRegistry (Literal implementationID) - : BufferProviderSetup::Stage{implementationID} //////////////////////////////////////////////////TICKET 1410 : rather init BufferMetatdata + : metadata_{implementationID} { } private: