diff --git a/src/lib/hash-value.h b/src/lib/hash-value.h index 26a6cfb85..c4601e9ed 100644 --- a/src/lib/hash-value.h +++ b/src/lib/hash-value.h @@ -33,7 +33,7 @@ #include -/** +/** * storage for a Lumiera unique ID, * based on a 128bit random number */ diff --git a/tests/core/steam/engine/testframe.cpp b/tests/core/steam/engine/testframe.cpp index 710077770..ba379b200 100644 --- a/tests/core/steam/engine/testframe.cpp +++ b/tests/core/steam/engine/testframe.cpp @@ -18,12 +18,13 @@ #include "lib/error.hpp" #include "lib/random.hpp" +#include "lib/hash-standard.hpp" +#include "lib/hash-combine.hpp" #include "steam/engine/testframe.hpp" #include "lib/nocopy.hpp" #include "lib/util.hpp" #include -#include #include #include @@ -33,10 +34,8 @@ namespace steam { namespace engine { namespace test { - using lib::HashVal; + using util::unConst; using std::vector; - using std::memcpy; - using lib::rani; /** @note using a random-congruential engine to generate the payload data */ using PseudoRandom = lib::RandomSequencer; @@ -69,14 +68,16 @@ namespace test { HashVal dataSeed{drawSeed(lib::entropyGen)}; /** @internal helper for generating unique test frames. - * This "discriminator" is used as a random seed when filling the test frame data buffers. + * This »discriminator« is used as a random seed when filling the test frame data buffers. * It is generated to be very likely different on adjacent frames of the same series, * as well as to differ to all nearby neighbouring channels. + * @note the #dataSeed hash is limited by #SEQUENCE_SPREAD to prevent „risky“ families; + * the extreme case would be dataSeed+family ≡ 0 (all frames would be equal then) * @param seq the sequence number of the frame within the channel * @param family the channel this frame belongs to */ uint64_t - generateDistinction(uint seq, uint family) + generateDiscriminator(uint seq, uint family) { // use the family as stepping return (seq+1) * (dataSeed+family); @@ -99,6 +100,15 @@ namespace test { } }; + /** @return a stable characteristic memory marker for the metadata record */ + HashVal + stampHeader() + { + static const HashVal MARK = lib::entropyGen.hash() + | 0b1000'1000'1000'1000'1000'1000'1000'1000; + return MARK; + } + /** @internal build a PRNG starting from the referred fixed seed */ auto buildDataGenFrom (uint64_t const& anchor) @@ -225,43 +235,68 @@ namespace test { /* ===== TestFrame class ===== */ + TestFrame::Meta::Meta (uint seq, uint family) + : _MARK_{stampHeader()} + , checksum{0} + , distinction{generateDiscriminator (seq,family)} + , stage{CREATED} + { } + TestFrame::~TestFrame() { - stage_ = DISCARDED; + header_.stage = DISCARDED; } - TestFrame::TestFrame(uint seq, uint family) - : distinction_(generateDistinction (seq,family)) - , stage_(CREATED) + TestFrame::TestFrame (uint seq, uint family) + : header_{seq,family} { - ASSERT (0 < distinction_); - buildData(); + ASSERT (0 < header_.distinction); + header_.checksum = buildData(); + ENSURE (CREATED == header_.stage); + ENSURE (isPristine()); } TestFrame::TestFrame (TestFrame const& o) - : distinction_(o.distinction_) - , stage_(CREATED) + : header_{o.header_} { - memcpy (buffer_, o.buffer_, BUFFSIZ); + data() = o.data(); + header_.stage = CREATED; } TestFrame& TestFrame::operator= (TestFrame const& o) { - if (DISCARDED == stage_) - throw new error::Logic ("target TestFrame is already dead"); + if (not isAlive()) + throw new error::Logic ("target TestFrame already dead or unaccessible"); if (not util::isSameAdr (this, o)) { - distinction_ = o.distinction_; - stage_ = CREATED; - memcpy (buffer_, o.buffer_, BUFFSIZ); + data() = o.data(); + header_ = o.header_; + header_.stage = CREATED; } return *this; } + TestFrame::Meta& + TestFrame::accessHeader() + { + return header_; + } + TestFrame::Meta const& + TestFrame::accessHeader() const + { + ///////////////////////OOO detect if valid header present and else throw + return unConst(this)->accessHeader(); + } + + TestFrame::StageOfLife + TestFrame::currStage() const + { + ///////////////////////OOO detect if valid header present and then access + } /** @note performing an unchecked conversion of the given * memory location to be accessed as TestFrame. @@ -301,47 +336,74 @@ namespace test { return true; } + + HashVal + TestFrame::buildData() + { + auto gen = buildDataGenFrom (accessHeader().distinction); + for (uint i=0; i; - - uint64_t distinction_; - StageOfLife stage_; + + struct Meta + { + HashVal _MARK_; + HashVal checksum; + uint64_t distinction; + StageOfLife stage; + + Meta (uint seq, uint family); + }; /** inline storage buffer for the payload media data */ alignas(uint64_t) std::byte buffer_[sizeof(_Arr)]; + /** Metadata record located behind the data buffer */ + Meta header_; + public: /** discard all cached #testData and recalibrate data generation */ static void reseed(); @@ -86,9 +97,11 @@ namespace test { * an already destroyed TestFrame instance */ static bool isDead (void* memLocation); - bool isAlive() const; - bool isDead() const; - bool isSane() const; + bool isAlive() const; + bool isDead() const; + bool isSane() const; + bool isValid() const; + bool isPristine() const; bool operator== (void* memLocation) const; @@ -102,7 +115,12 @@ namespace test { private: bool contentEquals (TestFrame const& o) const; bool verifyData() const; - void buildData (); + HashVal buildData(); + Meta& accessHeader(); + Meta const& accessHeader() const; + StageOfLife currStage() const; + HashVal computeChecksum() const; + bool hasValidChecksum() const; }; diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index d3838ffd2..32829ca5a 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -17766,9 +17766,7 @@ - - - +

Ja, wir wollen das alte Blender-Modell: Selektion mit rechts, Aktion mit links @@ -18605,9 +18603,7 @@ - - - +

Bedingt durch das Aufrufschema können wir nicht zu Beginn steuernd eingreifen, sondern wir können nur erkennen, wenn das Sub-Widget (aus welchen Gründen auch immer) den extension-constraint verletzt. Und wir bekommen keine direkten Wirkfaktoren in die Hand (weil sich die Ausdehnung aus einem komplexen Zusammenspiel von Font, Pixelgröße und Styles ergibt) @@ -18907,9 +18903,7 @@ - - - +

BEDINUNG: cW > aktuelleWeite @@ -19247,9 +19241,7 @@ - - - +

  • @@ -20064,9 +20056,7 @@ - - - +

    ...denn ich ging von der Annahme aus, daß dieser Code erst im nachfolgenden draw()-Event aufgerufen wird; und diese Annahme hatte sich bisher stets bestätigt, obwohl im ctor von ElementBox direkt ein show_all() aufgerufen wird @@ -21315,9 +21305,7 @@ - - - +

    denn der Display/Manager bzw Canvas ist zwar "quasi global", aber eben nicht wirklich, denn er ist für eine Timeline zuständig. Also genau die Art Relation, für die man typischerweise DI macht @@ -24059,9 +24047,7 @@ - - - +

    Es ist sinnvoll, die Feststellung einer Änderung vom Berechnen der neuen Werte zu trennen. @@ -39574,9 +39560,7 @@ - - - +

    letztlich kein Problem. @@ -41915,9 +41899,7 @@ - - - +

    Wir nutzen explizit aus, daß das Ergebnis durch truncating quantisiert wird (Integer-Division). Daher können wir erst den ersten Dividenden (die Zeitspanne) aufteilen, und zwar erst mal in den Sekunden-Anteil, dann den Rest, und dann den Rest vom Rest @@ -43225,9 +43207,7 @@ - - - +

    minimale Pixel-Zahl 1px. Mit 1/10 Band dann 1.1, mit 1px-Band 2 @@ -44003,9 +43983,7 @@ - - - +

    Rat poison = (MAXI-88)/(MAXI/7); @@ -45687,9 +45665,7 @@ - - - +

    ...denn dann müßte das Attribut @@ -46019,9 +45995,7 @@ - - - +

    (GlobalCtx)->WindowLocator->UIComponentAccessor @@ -46219,9 +46193,7 @@ - - - +

    heißt: Element deregistriert sich am UI-Bus @@ -46334,9 +46306,7 @@ - - - +

    Nachricht an irgend ein Wurzel-Element @@ -56799,6 +56769,40 @@ + + + + +

    + Diskriminator-ID ≔ (seq+1) * (dataSeed+family) +

    + + +
    +
    + + + + +

    + Erläuterung: jede »family« hat ein eigenes Stepping +

    + + +
    +
    + + + + + +

    + ...weil es dann passieren könnte, daß für bestimmte Familien die Frames sich nicht mehr unterscheiden +

    + + +
    +
    @@ -56822,6 +56826,12 @@ + + + + + + @@ -56864,8 +56874,24 @@ + + + + + + + + + + + + + + + + + - @@ -90423,8 +90449,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    irgendwie binden wir hier einen Handler ein, der »hinten rum« am Lib-Plugin hängt und dafür einen (privaten) Datentyp konstruiert ⟹ diese  Info muß in den Prototyp eingehen

    - -
    +
    @@ -92295,14 +92320,13 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    wirft auch den internen Daten-Cache weg und re-seeded den Basis-Hash, auf dem die Distinction-ID dann aufbaut

    - - +
    - + @@ -92311,7 +92335,10 @@ Date:   Thu Apr 20 18:53:17 2023 +0200

    - + + + +
    @@ -92826,9 +92853,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    + -