Lumiera  0.pre.03
»edit your freedom«
segmentation.cpp
Go to the documentation of this file.
1 /*
2  Segmentation - Partitioning of a timeline for organising the render graph.
3 
4  Copyright (C)
5  2023, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 * *****************************************************************/
13 
14 
21 #include "lib/error.hpp"
23 #include "lib/time/timevalue.hpp"
24 #include "lib/split-splice.hpp"
25 
26 using lib::time::Time;
28 
29 
30 namespace steam {
31 namespace fixture {
32 
33  namespace error = lumiera::error;
34 
35 
36  Segmentation::~Segmentation() { } // emit VTable here...
37 
38 
39  namespace {// Implementation details...
40 
41 
42  }//(End) impl
43 
44 
45 
67  Segment const&
68  Segmentation::splitSplice (OptTime start, OptTime after, engine::ExitNodes&& modelLink)
69  {
70  ASSERT (!start or !after or start != after);
71  using Iter = typename list<Segment>::iterator;
72 
73  auto getStart = [](Iter elm) -> Time { return elm->start(); };
74  auto getAfter = [](Iter elm) -> Time { return elm->after(); };
75  auto createSeg= [&](Iter pos, Time start, Time after) -> Iter { return segments_.emplace (pos, TimeSpan{start, after}, move(modelLink)); };
76  auto emptySeg = [&](Iter pos, Time start, Time after) -> Iter { return segments_.emplace (pos, TimeSpan{start, after}); };
77  auto cloneSeg = [&](Iter pos, Time start, Time after, Iter src) -> Iter { return segments_.emplace (pos, *src, TimeSpan{start, after}); };
78  auto discard = [&](Iter pos, Iter after) -> Iter { return segments_.erase (pos,after); };
79 
80 
81  lib::splitsplice::Algo splicer{ getStart
82  , getAfter
83  , createSeg
84  , emptySeg
85  , cloneSeg
86  , discard
87  , Time::NEVER
88  , segments_.begin(),segments_.end()
89  , start,after
90  };
91  splicer.determineRelations();
92  auto [s,n,e] = splicer.performSplitSplice();
93  return *n;
94  }
95 
96 
97 
98 }} // namespace steam::fixture
Segment const & splitSplice(OptTime start, OptTime after, engine::ExitNodes &&modelLink=ExitNodes{})
rework the existing Segmentation to include a new Segment as specified
Steam-Layer implementation namespace root.
Lumiera&#39;s internal time value datatype.
Definition: timevalue.hpp:299
list< Segment > segments_
segments of the engine in ordered sequence.
Lumiera error handling (C++ interface).
For the purpose of building and rendering, the fixture (for each timeline) is partitioned such that e...
Definition: segment.hpp:59
static const Time NEVER
border condition marker value. NEVER >= any time value
Definition: timevalue.hpp:314
Part of the Fixture datastructure to manage time segments of constant structure.
Implementation of »SplitSplice« algorithm.
A time interval anchored at a specific point in time.
Definition: timevalue.hpp:573
a family of time value like entities and their relationships.
virtual ~Segmentation()
this is an interface