diff --git a/src/lib/par/type-registry.hpp b/src/lib/par/type-registry.hpp new file mode 100644 index 000000000..4ef32de88 --- /dev/null +++ b/src/lib/par/type-registry.hpp @@ -0,0 +1,101 @@ +/* + TYPE-REGISTRY.hpp - generic registry for type or policy descriptors + + Copyright (C) + 2026 Hermann Vosseler + +  **Lumiera** is free software; you can redistribute it and/or modify it +  under the terms of the GNU General Public License as published by the +  Free Software Foundation; either version 2 of the License, or (at your +  option) any later version. See the file COPYING for further details. + +*/ + + +/** @file type-registry.hpp + ** Generic registration table and access mechanism to type descriptors keyed by ID. + ** The implementation of parameters is based on layered virtual interfaces and implementations, + ** packaged into a fixed storage buffer that is transported with value semantics. This overall shape + ** implies a strict storage size regime and thus forces to _fold away_ the more flexible parts of + ** the behaviour variations into a second layer, retaining only an ID in the core implementation. + ** + ** The type registry for parameters provides the generic mechanism underlying this setup scheme: + ** - it is parametrised by an implementation type (of the descriptor) with a fixed size + ** - the storage is organised by a fixed-sized index table and heap allocated storage extents. + ** - entries are never discarded, and thus an atomic lock suffices _for read access_ + ** @remark while this scheme is defined in a generic way, it aims at one specific + ** usage pattern and should not be stretched beyond that. + ** + ** @todo WIP-WIP-WIP can be considered an initial draft and placeholder, as of 2026 + */ + + +#ifndef LIB_PAR_TYPE_REGISTRY_H +#define LIB_PAR_TYPE_REGISTRY_H + + +#include "lib/error.hpp" +#include "lib/nocopy.hpp" +//#include "lib/meta/trait.hpp" +//#include "lib/util.hpp" + +//#include +//#include + + +namespace lib { +namespace par { + + /** + * Management of descriptor entries keyed by numeric ID. + * Based on a fixed index table and extents added dynamically. + * Slots can be claimed, creating an entry with stable address. + * Creation and access are thread safe, Entries are never discarded. + */ + template + class TypeRegistry + : util::NonCopyable + { + public: + class ID; + + template + ID makeSlot (INIT&&...); + + ELM& operator[] (ID) const; + }; + + + /** type tagged numeric registry entry ID */ + template + class TypeRegistry::ID + { + uint idx_; + + public: + ID (uint ix =0) : idx_{ix} { } + operator uint() const { return idx_; } + // default copy operations + }; + + + + template + template + inline TypeRegistry::ID + TypeRegistry::makeSlot (INIT&&... initArg) + { + UNIMPLEMENTED ("allocate new slot, possibly grow extents, under mutex lock"); + } + + template + inline ELM& + TypeRegistry::operator[] (ID slot) const + { + UNIMPLEMENTED ("access slot by ID, protected by atomic acquire"); + } + + + +}} // namespace lib::par +#endif /*LIB_PAR_TYPE_REGISTRY_H*/ diff --git a/tests/16parameter.tests b/tests/16parameter.tests index dc8b34a41..36ed44aac 100644 --- a/tests/16parameter.tests +++ b/tests/16parameter.tests @@ -25,3 +25,8 @@ END PLANNED "Enumeration domains" NomSet_test << END return: 0 END + + +PLANNED "Parameter type registry" TypeRegistry_test << END +return: 0 +END diff --git a/tests/lib/par/type-registry-test.cpp b/tests/lib/par/type-registry-test.cpp new file mode 100644 index 000000000..ef828cdb7 --- /dev/null +++ b/tests/lib/par/type-registry-test.cpp @@ -0,0 +1,117 @@ +/* + TypeRegistry(Test) - verify nominal and ordinal scale enumerations + + Copyright (C) + 2026, Hermann Vosseler + +  **Lumiera** is free software; you can redistribute it and/or modify it +  under the terms of the GNU General Public License as published by the +  Free Software Foundation; either version 2 of the License, or (at your +  option) any later version. See the file COPYING for further details. + +* *****************************************************************/ + +/** @file type-registry.cpp + ** unit test \ref TypeRegistry_test + */ + + +#include "test/run.hpp" +//#include "test/test-helper.hpp" +#include "lib/par/type-registry.hpp" +#include "test/tracking-dummy.hpp" +#include "lib/util.hpp" +#include "test/diagnostic-output.hpp"/////////////TODO + +//#include +//#include +//#include + +//using std::string; +//using std::vector; +//using std::swap; +using util::isSameObject; + + +namespace lib { +namespace par { +namespace test{ + +// using lumiera::error::LUMIERA_ERROR_LOGIC; + + namespace {//Test fixture.... + + }//(End)Test fixture + + using ::test::Dummy; + using Registry = TypeRegistry; + using RegID = Registry::ID; + + + + + + + /**************************************************************************//** + * @test verify a index/extent based registration table for type descriptors + * - new slots can be claimed and then re-accessed by ID + * - storage is stable even while new extents are added, and not leaked + * - read access can happen concurrently with allocating new slots. + */ + class TypeRegistry_test : public Test + { + + virtual void + run (Arg) + { + seedRand(); + + simpleUsage(); + verify_storageSanity(); + verify_concurrentAccess(); + } + + + void + simpleUsage() + { + const int MARK = 1 + rani (1000); + + Registry registry; + RegID id = registry.makeSlot (MARK); + + Dummy& entry = registry[id]; + CHECK (MARK == entry.getID()); + CHECK (isSameObject (entry, registry[id])); + + VERIFY_FAIL ("not yet allocated", registry[12345]); + } + + + /** @test + * @todo WIP 9/26 🔁 define ⟶ implement + */ + void + verify_storageSanity() + { + UNIMPLEMENTED ("verify coherent storage handling and proper clean-up"); + } + + + /** @test + * @todo WIP 9/26 🔁 define ⟶ implement + */ + void + verify_concurrentAccess() + { + UNIMPLEMENTED ("press slot allocation and data access concurrently"); + } + }; + + + /** Register this test class... */ + LAUNCHER (TypeRegistry_test, "unit lib"); + + + +}}} // namespace lib::par::test diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index d069002ce..8e7f57d2a 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -84452,9 +84452,23 @@

- + + + + + + + +

+ Disposition ist das Implementation-Service-Interface; es ist die Grenze zwischen den Interface-Layern und dem (eigentlich opaquen) Implementierungs-Aufbau; somit ein guter Ort, einen IDRecord verbindlich bereitzustellen, denn die Festlegung, einen »slot« für Klassifikation und damit und damit verschiedene Dimensionen des »Typs« zu verbrauchen, erscheint angemessen und akzeptabel im Overhead. +

+ +
+ +
+
@@ -84764,6 +84778,7 @@ + @@ -85298,7 +85313,9 @@ - + + + @@ -86104,7 +86121,8 @@ - + + @@ -86273,6 +86291,21 @@ class ScaleRegistry + + + + + + + + + + + + + + + @@ -87389,6 +87422,25 @@ Prop.1: dist%3 1 2 0 1 2 0 + + + + + + + + + + + + + + + + + + + @@ -87873,7 +87925,7 @@ Prop.1: dist%3 1 2 0 1 2 0 - + @@ -87888,7 +87940,7 @@ Prop.1: dist%3 1 2 0 1 2 0 man könnte die Basis-Typen erweitern und die Diskrepanzen auf Ebene der Typ-Handler abfangen
  • - denkbar wäre auch eine alternative Implementierung der Disposition (ParamData) notwendig, so daß man das Quantisierungs-Grid geeignet darstellen kann und u.U. sogar einen TimeSpan (zwei Datenwerte) noch in der Standard-Buffer-Storage unterbringt + möglicherweise wäre auch eine alternative Implementierung der Disposition (ParamData) notwendig, so daß man das Quantisierungs-Grid geeignet darstellen kann und u.U. sogar einen TimeSpan (zwei Datenwerte) noch in der Standard-Buffer-Storage unterbringt
  • man könnte stattdessen solche Parameter in die Kategorie der »komplexen Parameter« einordnen, die ja durchaus sehr häufig sein werden (z.B Farbwerte sind Vektoren); demnach wäre eine Zeit-Entität eben auch ein komplexer Wert, der auch ein Grid bzw. einen Timecode-Quantisierer impliziert @@ -199589,6 +199641,24 @@ that situation will improve in forseeable future. + + + + + + + + + + + + + + + + + + @@ -215436,7 +215506,7 @@ actively maintained upstream. Please remove gdl from Debian. - + @@ -215472,7 +215542,44 @@ actively maintained upstream. Please remove gdl from Debian. - + + + + + + + + + + + + + + + +

    + Ein Assistent der den Charakter des Projekts kennt, mit dem Design-Stil und den Arbeitsmustern vertraut ist, und alle wesentlichen Elemente der Codebasis zuornen kann bezüglich Architektur, Vision, Entwicklungsstand +

    + +
    +
    + + + + +

    + Das soll ehr der »Köder« sein, damit Leute nicht mit ihren eigenen tollen Ideen um die Ecke gebogen kommen... +

    +

    + Das Projekt stellt gewisse Arbeits-Schemata und Prozeßbausteine bereit, wie z.B. Git-Flow-Aktionen, Release-Verifikation, ggfs. auch ein Codereview-Vorfilter. Dies sind Bausteine, die ich »in der Schublade liegen haben möchte« +

    + +
    +
    +
    +
    +
    +