From 256c4467052d580d38f977ccac6c0412f72f8982 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 7 Feb 2026 23:56:29 +0100 Subject: [PATCH] BufferProvider: consider to disentangle diagnostics and default implementation The implementation code for `DiagnosticOutputProvider` and `TrackingHeapBlockProvider` look very confusing and tangled. It seems, instrumentation for tests got mixed up with the effort to provide a simplistic prototype implementation. What we need foremost here is the latter; most tests that import the DiagnosticOutputProvider do not even use any instrumentation.... --- .../engine/diagnostic-buffer-provider.cpp | 2 +- ...ock-provider.cpp => heap-mem-provider.cpp} | 6 ++-- ...ock-provider.hpp => heap-mem-provider.hpp} | 30 +++++++++---------- src/steam/engine/render-environment.cpp | 6 ++-- src/steam/engine/render-environment.hpp | 19 ++++++------ src/steam/play/render-configurator.cpp | 2 ++ tests/47engine.tests | 6 ++-- .../basics/dependency-configuration-test.cpp | 2 +- ...pp => diagnostic-buffer-provider-test.cpp} | 20 ++++++------- .../steam/play/diagnostic-output-slot.hpp | 2 +- 10 files changed, 48 insertions(+), 47 deletions(-) rename src/steam/engine/{tracking-heap-block-provider.cpp => heap-mem-provider.cpp} (97%) rename src/steam/engine/{tracking-heap-block-provider.hpp => heap-mem-provider.hpp} (80%) rename tests/core/steam/engine/{tracking-heap-block-provider-test.cpp => diagnostic-buffer-provider-test.cpp} (90%) diff --git a/src/steam/engine/diagnostic-buffer-provider.cpp b/src/steam/engine/diagnostic-buffer-provider.cpp index 82429073f..3ef43f281 100644 --- a/src/steam/engine/diagnostic-buffer-provider.cpp +++ b/src/steam/engine/diagnostic-buffer-provider.cpp @@ -24,7 +24,7 @@ #include "lib/meta/function.hpp" #include "steam/engine/diagnostic-buffer-provider.hpp" -#include "steam/engine/tracking-heap-block-provider.hpp" +#include "steam/engine/heap-mem-provider.hpp" namespace steam { diff --git a/src/steam/engine/tracking-heap-block-provider.cpp b/src/steam/engine/heap-mem-provider.cpp similarity index 97% rename from src/steam/engine/tracking-heap-block-provider.cpp rename to src/steam/engine/heap-mem-provider.cpp index 996f082e5..e719e15e2 100644 --- a/src/steam/engine/tracking-heap-block-provider.cpp +++ b/src/steam/engine/heap-mem-provider.cpp @@ -1,5 +1,5 @@ /* - TrackingHeapBlockProvider - plain heap allocating BufferProvider implementation for tests + HeapMemProvider - plain heap allocating BufferProvider implementation for tests Copyright (C) 2011, Hermann Vosseler @@ -12,7 +12,7 @@ * *****************************************************************/ -/** @file tracking-heap-block-provider.cpp +/** @file heap-mem-provider.cpp ** Implementation details of a mock engine::BufferProvider for unit testing */ @@ -22,7 +22,7 @@ #include "lib/scoped-ptrvect.hpp" #include "lib/util-foreach.hpp" -#include "steam/engine/tracking-heap-block-provider.hpp" +#include "steam/engine/heap-mem-provider.hpp" #include #include diff --git a/src/steam/engine/tracking-heap-block-provider.hpp b/src/steam/engine/heap-mem-provider.hpp similarity index 80% rename from src/steam/engine/tracking-heap-block-provider.hpp rename to src/steam/engine/heap-mem-provider.hpp index 74a308b00..4286e6f1e 100644 --- a/src/steam/engine/tracking-heap-block-provider.hpp +++ b/src/steam/engine/heap-mem-provider.hpp @@ -1,5 +1,5 @@ /* - TRACKING-HEAP-BLOCK-PROVIDER.hpp - plain heap allocating BufferProvider implementation for tests + HEAP-MEM-PROVIDER.hpp - plain heap allocating BufferProvider implementation for tests Copyright (C) 2011, Hermann Vosseler @@ -11,27 +11,27 @@ */ -/** @file tracking-heap-block-provider.hpp +/** @file heap-mem-provider.hpp ** Dummy implementation of the BufferProvider interface to support writing unit tests. - ** This BufferProvider is especially straight forward and brain dead: it just claims - ** more and more heap blocks and never releases any memory dynamically. This allows - ** to investigate additional tracking status flags for each allocated block after - ** the fact. + ** This BufferProvider implementation is notably straight forward and silly: it just + ** claims more and more heap blocks and never releases any memory dynamically. This allows + ** to investigate additional tracking status flags for each allocated block after the fact. ** - ** The allocated buffers are numbered with a simple ascending sequence of integers, - ** used as LocalTag (see BufferMetadata). Clients can just request a Buffer with the - ** given number, causing that block to be allocated. There is a "backdoor", allowing - ** to access any allocated block, even if it is considered "released" by the terms - ** of the usual lifecycle. Only when the provider object itself gets destroyed, - ** all allocated blocks will be discarded. + ** @todo 1/2026 for sake of implementation clarity, the following instrumentation functionality + ** must be relocated into the DiagnosticOutputProvider: Allocated buffers are numbered + ** with a simple ascending sequence of integers, used as LocalTag (see BufferMetadata). + ** Clients can request a Buffer with the given number, causing that block to be allocated. + ** There is a "backdoor", allowing to access any allocated block, even if it is considered + ** "released" by the terms of the usual lifecycle. Only when the provider object itself + ** gets destroyed, all allocated blocks will be discarded. ** ** @see DiagnosticOutputSlot ** @see DiagnosticBufferProvider ** @see buffer-provider-protocol-test.cpp */ -#ifndef STEAM_ENGINE_TRACKING_HEAP_BLOCK_PROVIDER_H -#define STEAM_ENGINE_TRACKING_HEAP_BLOCK_PROVIDER_H +#ifndef STEAM_ENGINE_HEAP_MEM_PROVIDER_H +#define STEAM_ENGINE_HEAP_MEM_PROVIDER_H #include "lib/error.hpp" @@ -178,4 +178,4 @@ namespace engine { }} // namespace steam::engine -#endif +#endif /*STEAM_ENGINE_HEAP_MEM_PROVIDER_H*/ diff --git a/src/steam/engine/render-environment.cpp b/src/steam/engine/render-environment.cpp index 0984bdde6..81d9649a4 100644 --- a/src/steam/engine/render-environment.cpp +++ b/src/steam/engine/render-environment.cpp @@ -25,7 +25,7 @@ #include "steam/engine/render-environment.hpp" #include "steam/engine/engine-facilities.hpp" #include "steam/engine/buffer-provider.hpp" -#include "steam/engine/tracking-heap-block-provider.hpp" +#include "steam/engine/heap-mem-provider.hpp" namespace steam { @@ -46,12 +46,12 @@ namespace engine{ /* ===== Render Environment Implementation ===== */ - /////////////////////////////////////////////////////////////TODO + ///////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1409 : actually build that! right now (1/2026) it is a conceptual placeholder /// The real Render Engine needs a well defined life cycle; /// services must be booted and shut down. /// Notably a dedicated serivce-like subclass of EngineCtx /// must be created here and installed for lib::Depend - /// + /// /* ===== Access to Render Engine Facilities ===== */ diff --git a/src/steam/engine/render-environment.hpp b/src/steam/engine/render-environment.hpp index 47227b7af..061e65809 100644 --- a/src/steam/engine/render-environment.hpp +++ b/src/steam/engine/render-environment.hpp @@ -13,15 +13,14 @@ /** @file render-environment.hpp - ** The active core within a CalcStream, causing the render mechanism to re-trigger repeatedly. - ** Rendering is seen as an open-ended, ongoing process, and thus the management and planning - ** of the render process itself is performed chunk wise and embedded into the other rendering - ** calculations. The _"rendering-as-it-is-planned-right-now"_ can be represented as a closure - ** to the jobs, which perform and update this plan on the go. And in fact, the head of the - ** planning process, the CalcStream, maintains this closure instance, as parametrised - ** with the appropriate configuration for the specific playback/render process underway. - ** Enclosed into this instance lives the actual job planning pipeline, connected at the - ** rear to the dispatcher and thus to the fixture and the low-level model + ** A configuration context for processing within the Render Engine. + ** This context can be accessed from within the ongoing render processes to query + ** strategy settings; actually, all the global support facilities within the Render Engine + ** are attached here. Thus it might also be used to control the lifecycle (2026 not clear yet) + ** @todo 2026 the concept is quite old, but I have reestablished it now to use it as an anchor. + ** it is not clear yet if there will be several sub environments for different playback + ** configurations; effectively, this is a conceptual placeholder now and needs to be + ** put into actual use to see where this leads us to.... ////////////////////////////////////////////TICKET #1409 ** ** @todo 4/2023 »Playback Vertical Slice« -- effort towards first integration of render process ////////////TICKET #1221 */ @@ -37,7 +36,7 @@ namespace steam { -namespace engine { +namespace engine{ diff --git a/src/steam/play/render-configurator.cpp b/src/steam/play/render-configurator.cpp index 58f5ed405..40661f82f 100644 --- a/src/steam/play/render-configurator.cpp +++ b/src/steam/play/render-configurator.cpp @@ -16,6 +16,8 @@ ** Implementation functionality to bridge between engine::PlayService and engine::EngineService. ** The former allows to start playback (or rendering) as a high-level activity, while the latter ** can manage and perform [calculation streams](\ref CalcStream) + ** + ** @todo 2026 : the concept seems valid, but needs to be refined and integrated with play processing ///////TICKET #868 */ diff --git a/tests/47engine.tests b/tests/47engine.tests index 40cb864df..0a9690d21 100644 --- a/tests/47engine.tests +++ b/tests/47engine.tests @@ -7,17 +7,17 @@ return: 0 END -TEST "Test support: dummy buffer provider" TrackingHeapBlockProvider_test <response = 11; CHECK (11 == dumm().probe() ); // NOTE: now returning the response changed on the mock instance - CHECK (!mockDummy3); // the second mock is still in not yet created state... + CHECK (!mockDummy3); // the second mock is still in 'not yet created' state... CHECK ((1+5+7+3) == checksum ); CHECK (-1 == depp().probe() ); CHECK ((1+5+7+3+3) == checksum ); // ...and now we got a second mock instance! diff --git a/tests/core/steam/engine/tracking-heap-block-provider-test.cpp b/tests/core/steam/engine/diagnostic-buffer-provider-test.cpp similarity index 90% rename from tests/core/steam/engine/tracking-heap-block-provider-test.cpp rename to tests/core/steam/engine/diagnostic-buffer-provider-test.cpp index a7477f3dd..28c030ad1 100644 --- a/tests/core/steam/engine/tracking-heap-block-provider-test.cpp +++ b/tests/core/steam/engine/diagnostic-buffer-provider-test.cpp @@ -1,5 +1,5 @@ /* - TrackingHeapBlockProvider(Test) - verify a support facility for diagnostic/test purposes + DiagnosticBufferProvider(Test) - verify a support facility for diagnostic/test purposes Copyright (C) 2011, Hermann Vosseler @@ -12,13 +12,13 @@ * *****************************************************************/ /** @file tracking-heap-block-provider-test.cpp - ** unit test \ref TrackingHeapBlockProvider_test + ** unit test \ref DiagnosticBufferProvider_test */ #include "lib/error.hpp" #include "lib/test/run.hpp" -#include "steam/engine/tracking-heap-block-provider.hpp" +#include "steam/engine/heap-mem-provider.hpp" #include "steam/engine/buffhandle-attach.hpp" #include "steam/engine/testframe.hpp" @@ -59,13 +59,13 @@ namespace test { /******************************************************************//** - * @test verify a test support facility, used to write mock components - * to test the lumiera engine. The TrackingHeapBlockProvider is a - * braindead implementation of the BufferProvider interface: it just - * claims new heap blocks and never de-allocates them, allowing other - * test and mock objects to verify allocated buffers after the fact. + * @test verify support to write mock components for buffer management. + * - HeapMemProvider is a „braindead“ implementation of the BufferProvider + * interface: it just claims new heap blocks and never de-allocates them. + * - adding a layer of instrumentation, the DiagnosticBufferProvider allows + * to count and verify allocated buffers and their content after the fact. */ - class TrackingHeapBlockProvider_test : public Test + class DiagnosticBufferProvider_test : public Test { virtual void run (Arg) @@ -210,7 +210,7 @@ namespace test { /** Register this test class... */ - LAUNCHER (TrackingHeapBlockProvider_test, "unit player"); + LAUNCHER (DiagnosticBufferProvider_test, "unit player"); diff --git a/tests/core/steam/play/diagnostic-output-slot.hpp b/tests/core/steam/play/diagnostic-output-slot.hpp index 47721d627..44ef6554e 100644 --- a/tests/core/steam/play/diagnostic-output-slot.hpp +++ b/tests/core/steam/play/diagnostic-output-slot.hpp @@ -29,7 +29,7 @@ #include "steam/play/output-slot-connection.hpp" #include "steam/asset/meta/time-grid.hpp" #include "steam/engine/buffhandle.hpp" -#include "steam/engine/tracking-heap-block-provider.hpp" +#include "steam/engine/heap-mem-provider.hpp" #include "lib/time/timevalue.hpp" #include "lib/scoped-ptrvect.hpp" #include "lib/iter-source.hpp"