From 139b0d4c7bdf590257e9bc3a2ada786f3b9ca34a Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Wed, 3 May 2023 04:42:17 +0200 Subject: [PATCH] Segmentation: make implementation generic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The algorithm coded thus far turns out to be rather generic, and thus it can be rewritten into a template, while all specific parts are supplied as λ-Functors. - instead of Time we use a generic ordering type - the Iterator is likewise turned into a template parameter - all the operations are directly supplied as functor types - C++17 is able to pick up all those λ-Types from the ctor call This change looks like "low hanging fruit"; the legibility of the code is not seriously hampered, yet we get the benefit to test this rather technical piece of logic by an isolated test (which for now is the primary motivation), and we can hope to re-use it for similar tasks. --- src/steam/fixture/segmentation.cpp | 184 ++++++++++++++++------------- wiki/thinkPad.ichthyo.mm | 39 ++++-- 2 files changed, 132 insertions(+), 91 deletions(-) diff --git a/src/steam/fixture/segmentation.cpp b/src/steam/fixture/segmentation.cpp index 6aaaa8eb8..df50ff864 100644 --- a/src/steam/fixture/segmentation.cpp +++ b/src/steam/fixture/segmentation.cpp @@ -2,7 +2,7 @@ Segmentation - Partitioning of a timeline for organising the render graph. Copyright (C) Lumiera.org - 2008, Hermann Vosseler + 2023, Hermann Vosseler This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -30,6 +30,7 @@ #include "steam/fixture/segmentation.hpp" //#include "steam/mobject/builder/fixture-change-detector.hpp" ///////////TODO #include "lib/time/timevalue.hpp" +#include "lib/meta/function.hpp" #include @@ -40,22 +41,22 @@ namespace fixture { namespace error = lumiera::error; -// typedef ModelPortRegistry::ModelPortDescriptor const& MPDescriptor; - - - /** storage for the link to the global - Registry instance currently in charge */ -// lib::OptionalRef ModelPortRegistry::theGlobalRegistry; - - Segmentation::~Segmentation() { } // emit VTable here... + namespace {// Implementation of Split-Splice algorithm - using lib::time::Time; - using lib::time::TimeVar; - using OptTime = std::optional