diff --git a/src/steam/engine/buffer-metadata.hpp b/src/steam/engine/buffer-metadata.hpp index 62420e12e..5af1ebef0 100644 --- a/src/steam/engine/buffer-metadata.hpp +++ b/src/steam/engine/buffer-metadata.hpp @@ -302,6 +302,16 @@ namespace engine { return bool(buffer_); } + /** is the client currently allowed to access the buffer memory? + * @remark implies #isLocked() but is more narrow */ + bool + isAccessible() const + { + ENSURE (isLocked()); + return bool(buffer_) + and LOCKED == state_; + } + /** is this Entry just an (abstract) placeholder for a type? * @return false if it's a real entry corresponding to a concrete buffer */ @@ -709,6 +719,14 @@ namespace engine { and entry->isLocked(); } + bool + isAccessible (HashVal key) const + { + const Entry* entry = table_.fetch (key); + return entry + and entry->isAccessible(); + } + /* == memory management operations == */ diff --git a/src/steam/engine/buffer-provider.cpp b/src/steam/engine/buffer-provider.cpp index da3307565..3396e6f2b 100644 --- a/src/steam/engine/buffer-provider.cpp +++ b/src/steam/engine/buffer-provider.cpp @@ -51,10 +51,16 @@ namespace engine { * currently locked and usable by client code */ bool - BufferProvider::verifyValidity (HashVal id) const + BufferProvider::isValid (HashVal id) const { return bool (bufferStage_->lookup (id)); } + + bool + BufferProvider::isAccessible (HashVal id) const + { + return bufferStage_->isUsageAllowed (id); + } size_t BufferProvider::getBufferSize (HashVal id) const @@ -214,12 +220,14 @@ namespace engine { BuffDescr::isValid() const { ENSURE (provider_); - return provider_->verifyValidity (*this); + return provider_->isValid (*this); } /** * A concrete Buffer Handle is considered valid, - * iff it is currently registered in the buffer metadata table. + * iff it is currently registered in the buffer metadata table, + * and the corresponding metadata::Entry indicates LOCKED state, + * but not yet emitted (or released). * @note this implies also that it is in some active state, and * indirectly (due to the _Buffer Provider Protocol_) also * that the _parent type_ is valid, which means that it was @@ -233,7 +241,7 @@ namespace engine { { ENSURE (descriptor_.provider_); return bool(pBuffer_) - and descriptor_.provider_->verifyValidity (*this); + and descriptor_.provider_->isAccessible (*this); } diff --git a/src/steam/engine/buffer-provider.hpp b/src/steam/engine/buffer-provider.hpp index f8ddafb18..7acfc9536 100644 --- a/src/steam/engine/buffer-provider.hpp +++ b/src/steam/engine/buffer-provider.hpp @@ -175,8 +175,9 @@ namespace engine { /* === API for BuffHandle internal access === */ - bool verifyValidity (BuffDescr const&) const; - size_t getBufferSize (HashVal typeID) const; + bool isValid (HashVal) const; + bool isAccessible (HashVal) const; + size_t getBufferSize (HashVal) const; protected: bool was_created_by_this_provider (BuffDescr const&) const; @@ -200,6 +201,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; }; class BufferStore diff --git a/src/steam/engine/simple-buffer-state-registry.hpp b/src/steam/engine/simple-buffer-state-registry.hpp index 7810c25bf..d3dfe7672 100644 --- a/src/steam/engine/simple-buffer-state-registry.hpp +++ b/src/steam/engine/simple-buffer-state-registry.hpp @@ -60,6 +60,12 @@ namespace engine { : metadata::Key::INVALID; } + bool + isUsageAllowed (HashVal stateKey) const override + { + return this->isAccessible (stateKey); + } + ID defineBufferType (size_t buffSiz, TypeHandler handlerFunctions) { diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 4fcdc1ac6..0003434ef 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -112867,9 +112867,9 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - - + + + @@ -112877,8 +112877,9 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - + + + @@ -112908,10 +112909,10 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - - - + + + + @@ -112923,6 +112924,28 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension)

+ + + + + + + + + + +

+ ...damit schreiben wir auch immer mehr die Bedeutung der BufferMetadata auf einer abstrakten Ebene fest; das halte ich für eine gute Tendenz +

+ +
+ +
+ + + + +
@@ -112946,10 +112969,13 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - - - + + + + + + + @@ -113138,7 +113164,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -113147,6 +113173,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension)

+
@@ -113206,7 +113233,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -113215,7 +113242,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension)

- + @@ -113243,7 +113270,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -113281,9 +113308,39 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - - + + + + + + + + + + + + + + + +

+ denn das ist es, wofür man einen bool-Check macht +

+ +
+
+ + + + +

+ ...im normalen Nutzungsmuster tritt dieses Prädikat nämlich nicht auf, denn wenn man sich brav an das Protokoll hält, ist man garantiert auf der sicheren Seite. Daher sehe ich das als ein Investment in die Zukunft — da ich inzwischen gelernt habe, daß hinreichend generisch formulierter Code immer irgendwann mißbraucht wird +

+ +
+ +
+