From 705bd3d2e03f2cc891cc7cf13597c30ecaf1d07d Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Wed, 11 Mar 2026 17:52:04 +0100 Subject: [PATCH] BufferProvider: rename OutputSlot implementation parts The state of connectedness is represented as class, which actually is a three step deep hierarchy. This design seems plausible, since we get - an interface visible for clients (`Allocation`) - an internal interface - the actual implementation, templated to the actual connection At least we can try to choose names that better indicate these three related levels. --- src/vault/mem/diagnostic-buffer-provider.hpp | 2 +- src/vault/out/diagnostic-output-slot.cpp | 49 ++++++++++++++++++++ src/vault/out/diagnostic-output-slot.hpp | 9 ++-- src/vault/out/output-slot-connection.hpp | 26 +++++------ src/vault/out/output-slot.cpp | 2 +- src/vault/out/output-slot.hpp | 6 +-- 6 files changed, 72 insertions(+), 22 deletions(-) create mode 100644 src/vault/out/diagnostic-output-slot.cpp diff --git a/src/vault/mem/diagnostic-buffer-provider.hpp b/src/vault/mem/diagnostic-buffer-provider.hpp index 394ceb838..eb7bf3eb3 100644 --- a/src/vault/mem/diagnostic-buffer-provider.hpp +++ b/src/vault/mem/diagnostic-buffer-provider.hpp @@ -1,5 +1,5 @@ /* - DIAGNOSTIC-BUFFER-PROVIDER.hpp - helper for testing against the BufferProvider interf,ttace + DIAGNOSTIC-BUFFER-PROVIDER.hpp - helper for testing against the BufferProvider interface Copyright (C) 2011,2026 Hermann Vosseler diff --git a/src/vault/out/diagnostic-output-slot.cpp b/src/vault/out/diagnostic-output-slot.cpp new file mode 100644 index 000000000..0185bcec2 --- /dev/null +++ b/src/vault/out/diagnostic-output-slot.cpp @@ -0,0 +1,49 @@ +/* + DiagnosticOutputSlot - helper for testing against the OutputSlot interface + + 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 diagnostic-output-slot.cpp + ** Internal implementation parts of a state-tracking dummy implementation + ** of the OutputSlot interface and framework. + */ + + +#include "lib/error.hpp" +#include "vault/out/diagnostic-output-slot.hpp" +//#include "vault/out/output-slot-connection.hpp" + +//#include + + +namespace vault { +namespace out { + namespace err = lumiera::error; + +// using std::vector; + + + + + +// OutputSlot::~OutputSlot() { } // emit VTables here.... + + + + + + /** */ + + + + +}} // namespace vault::out diff --git a/src/vault/out/diagnostic-output-slot.hpp b/src/vault/out/diagnostic-output-slot.hpp index cb7a09587..262c656ca 100644 --- a/src/vault/out/diagnostic-output-slot.hpp +++ b/src/vault/out/diagnostic-output-slot.hpp @@ -62,6 +62,7 @@ namespace out { using vault::mem::BuffDescr; using std::shared_ptr; + using std::make_unique; using PGrid = lib::P; @@ -362,9 +363,9 @@ namespace out { * thus allowing to verify the handling of individual buffers */ class SimulatedOutputSequences - : public ConnectionManager + : public AllocStateHub { - typedef ConnectionManager _Base; + typedef AllocStateHub _Base; void buildConnection(ConnectionStorage storage) @@ -385,10 +386,10 @@ namespace out { /** hook into the OutputSlot frontend */ - ConnectionState* + unique_ptr buildState() { - return new SimulatedOutputSequences( + return make_unique ( getOutputChannelCount()); } diff --git a/src/vault/out/output-slot-connection.hpp b/src/vault/out/output-slot-connection.hpp index 4a3b53b1b..d00209429 100644 --- a/src/vault/out/output-slot-connection.hpp +++ b/src/vault/out/output-slot-connection.hpp @@ -16,7 +16,7 @@ ** The OutputSlot concept helps to decouple the render engine implementation from the details ** of handling external output connections. For this to work, a concrete implementation of such ** an external output needs to integrate with the generic OutputSlot frontend, as used by the - ** engine. This generic frontend uses a PImpl, pointing to a ConnectionState object, which embodies + ** engine. This generic frontend uses a PImpl, pointing to a AllocState object, which embodies ** the actual implementation. Moreover, this actual implementation is free to use specifically crafted ** OutputSlot::Connection elements to handle the ongoing output for individual channels. The latter ** thus becomes the central implementation side API for providing actual output capabilities. @@ -75,7 +75,7 @@ namespace out { * Actually, this extension point towards the implementation * of the actual output handling carries the core API of OutputSlot. * Thus, the task of actually implementing an OutputSlot boils down - * to implementing this interface and providing a ConnectionState. + * to implementing this interface and providing a AllocState. * - `lock()` announces this FrameID and the corresponding buffer * to be in exclusive use by the client from now on * - `transfer()` ends the client sided processing and initiates @@ -104,17 +104,17 @@ namespace out { /** * Extension point for Implementation. - * The ConnectionState is where the concrete output + * The AllocState is where the concrete output * handling implementation is expected to reside. * OutputSlot is a frontend and accesses - * ConnectionState in the way of a PImpl. + * AllocState in the way of a PImpl. */ - class OutputSlot::ConnectionState + class OutputSlot::AllocState : public OutputSlot::Allocation , util::NonCopyable { public: - virtual ~ConnectionState() { } + virtual ~AllocState() { } virtual Connection& access (uint) const =0; }; @@ -130,7 +130,7 @@ namespace out { { protected: template - class ConnectionManager; + class AllocStateHub; }; @@ -142,7 +142,7 @@ namespace out { * representing the "active points" in several media channels * connected through this OutputSlot. These Connection subclasses * are what is referenced by the DataSink smart-ptrs handed out - * to the client code. As ConnectionState implements the Allocation + * to the client code. As AllocState implements the Allocation * API, it has the liability to create these DataSink smart-ptrs, * which means to wire them appropriately and also provide an * deleter function (here #shutdownConnection) to be invoked @@ -152,8 +152,8 @@ namespace out { * manages a collection of active Connection subclass objects. */ template - class OutputSlotImplBase::ConnectionManager - : public OutputSlot::ConnectionState + class OutputSlotImplBase::AllocStateHub + : public OutputSlot::AllocState { typedef lib::ScopedCollection Connections; typedef OutputSlot::OpenedSinks OpenedSinks; @@ -195,7 +195,7 @@ namespace out { init() ///< derived classes need to invoke this to build the actual connections { //////////////////////////TICKET #878 really build all at once? or on demand? - connections_.populate_by (&ConnectionManager::buildConnection, this); + connections_.populate_by (&AllocStateHub::buildConnection, this); } using ConnectionStorage = Connections::ElementHolder&; @@ -205,13 +205,13 @@ namespace out { virtual void buildConnection(ConnectionStorage) =0; - ConnectionManager(uint numChannels) + AllocStateHub(uint numChannels) : connections_(numChannels) { } public: virtual - ~ConnectionManager() + ~AllocStateHub() { } diff --git a/src/vault/out/output-slot.cpp b/src/vault/out/output-slot.cpp index 6567215d4..eecd8d4f0 100644 --- a/src/vault/out/output-slot.cpp +++ b/src/vault/out/output-slot.cpp @@ -75,7 +75,7 @@ namespace out { if (not isFree()) throw err::Logic ("Attempt to open/allocate an OutputSlot already in use."); - state_.reset (this->buildState()); + state_ = this->buildState(); return *state_; } diff --git a/src/vault/out/output-slot.hpp b/src/vault/out/output-slot.hpp index f5c9b4c4f..7dcdaea59 100644 --- a/src/vault/out/output-slot.hpp +++ b/src/vault/out/output-slot.hpp @@ -105,14 +105,14 @@ namespace out { protected: /** active connections through this OutputSlot */ - class ConnectionState; + class AllocState; - unique_ptr state_; + unique_ptr state_; /** build the \em connected state, * based on the existing configuration * within this concrete OutputSlot */ - virtual ConnectionState* buildState() =0; + virtual unique_ptr buildState() =0; public: