Lumiera  0.pre.03
»edit your freedom«
segmentation.hpp
Go to the documentation of this file.
1 /*
2  SEGMENTATION.hpp - 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 
45 #ifndef STEAM_FIXTURE_SEGMENTATION_H
46 #define STEAM_FIXTURE_SEGMENTATION_H
47 
48 
50 #include "lib/time/timevalue.hpp"
51 #include "lib/iter-adapter-stl.hpp"
52 #include "lib/format-string.hpp"
53 #include "lib/nocopy.hpp"
54 
55 #include <list>
56 #include <optional>
57 #include <functional>
58 
59 
60 namespace steam {
61 namespace fixture {
62 
63  namespace error = lumiera::error;
64 
65  using std::list;
67  using util::_Fmt;
68 
69  using OptTime = std::optional<lib::time::Time>;
70 
86  {
88  list<Segment> segments_;
89 
90  protected:
91  Segmentation()
92  : segments_{1}
93  { }
94 
95  public:
96  virtual ~Segmentation();
97 
98  size_t
99  size() const
100  {
101  return segments_.size();
102  }
103 
104  Segment const&
105  operator[] (TimeValue time) const
106  {
107  for (auto& seg : segments_)
108  if (seg.after() > time)
109  return seg;
110  throw error::State (_Fmt{"Fixture datastructure corrupted: Time %s not covered"} % time);
111  }
112 
113  auto
114  eachSeg() const
115  {
116  return lib::iter_stl::eachElm (segments_);
117  }
118 
119 
121  Segment const&
122  splitSplice (OptTime start, OptTime after, engine::ExitNodes&& modelLink =ExitNodes{});
123 
124 
125  protected:
127  void
129  {
130  for (fixture::Segment& seg : segments_)
131  seg.exitNode = move(rewrite (seg.exitNode));
132  }
133  };
134 
135 
136 
137 }} // namespace steam::fixture
138 #endif /*STEAM_FIXTURE_SEGMENTATION_H*/
For the purpose of building and rendering, the fixture (for each timeline) is partitioned such that e...
Any copy and copy construction prohibited.
Definition: nocopy.hpp:46
Front-end for printf-style string template interpolation.
Building block of the backbone of the low-level (render node) model.
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.
A front-end for using printf-style formatting.
Derived specific exceptions within Lumiera&#39;s exception hierarchy.
Definition: error.hpp:199
Mix-Ins to allow or prohibit various degrees of copying and cloning.
list< Segment > segments_
segments of the engine in ordered sequence.
Binding and access point from a given Segment to access the actual render nodes.
void adaptSpecification(std::function< NodeGraphAttachment(NodeGraphAttachment const &)> rewrite)
For the purpose of building and rendering, the fixture (for each timeline) is partitioned such that e...
Definition: segment.hpp:68
Preconfigured adapters for some STL container standard usage situations.
a family of time value like entities and their relationships.
basic constant internal time value.
Definition: timevalue.hpp:142
virtual ~Segmentation()
this is an interface