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) Lumiera.org
5  2023, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 * *****************************************************/
22 
23 
30 #include "lib/error.hpp"
32 #include "lib/time/timevalue.hpp"
33 #include "lib/split-splice.hpp"
34 
35 using lib::time::Time;
37 
38 
39 namespace steam {
40 namespace fixture {
41 
42  namespace error = lumiera::error;
43 
44 
45  Segmentation::~Segmentation() { } // emit VTable here...
46 
47 
48  namespace {// Implementation details...
49 
50 
51  }//(End) impl
52 
53 
54 
76  Segment const&
77  Segmentation::splitSplice (OptTime start, OptTime after, engine::ExitNodes&& modelLink)
78  {
79  ASSERT (!start or !after or start != after);
80  using Iter = typename list<Segment>::iterator;
81 
82  auto getStart = [](Iter elm) -> Time { return elm->start(); };
83  auto getAfter = [](Iter elm) -> Time { return elm->after(); };
84  auto createSeg= [&](Iter pos, Time start, Time after) -> Iter { return segments_.emplace (pos, TimeSpan{start, after}, move(modelLink)); };
85  auto emptySeg = [&](Iter pos, Time start, Time after) -> Iter { return segments_.emplace (pos, TimeSpan{start, after}); };
86  auto cloneSeg = [&](Iter pos, Time start, Time after, Iter src) -> Iter { return segments_.emplace (pos, *src, TimeSpan{start, after}); };
87  auto discard = [&](Iter pos, Iter after) -> Iter { return segments_.erase (pos,after); };
88 
89 
90  lib::splitsplice::Algo splicer{ getStart
91  , getAfter
92  , createSeg
93  , emptySeg
94  , cloneSeg
95  , discard
96  , Time::NEVER
97  , segments_.begin(),segments_.end()
98  , start,after
99  };
100  splicer.determineRelations();
101  auto [s,n,e] = splicer.performSplitSplice();
102  return *n;
103  }
104 
105 
106 
107 }} // 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:308
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:68
static const Time NEVER
border condition marker value. NEVER >= any time value
Definition: timevalue.hpp:323
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:582
a family of time value like entities and their relationships.
virtual ~Segmentation()
this is an interface