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)
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 
36 #ifndef STEAM_FIXTURE_SEGMENTATION_H
37 #define STEAM_FIXTURE_SEGMENTATION_H
38 
39 
41 #include "lib/time/timevalue.hpp"
42 #include "lib/iter-adapter-stl.hpp"
43 #include "lib/format-string.hpp"
44 #include "lib/nocopy.hpp"
45 
46 #include <list>
47 #include <optional>
48 #include <functional>
49 
50 
51 namespace steam {
52 namespace fixture {
53 
54  namespace error = lumiera::error;
55 
56  using std::list;
58  using util::_Fmt;
59 
60  using OptTime = std::optional<lib::time::Time>;
61 
77  {
79  list<Segment> segments_;
80 
81  protected:
82  Segmentation()
83  : segments_{1}
84  { }
85 
86  public:
87  virtual ~Segmentation();
88 
89  size_t
90  size() const
91  {
92  return segments_.size();
93  }
94 
95  Segment const&
96  operator[] (TimeValue time) const
97  {
98  for (auto& seg : segments_)
99  if (seg.after() > time)
100  return seg;
101  throw error::State (_Fmt{"Fixture datastructure corrupted: Time %s not covered"} % time);
102  }
103 
104  auto
105  eachSeg() const
106  {
107  return lib::iter_stl::eachElm (segments_);
108  }
109 
110 
112  Segment const&
113  splitSplice (OptTime start, OptTime after, engine::ExitNodes&& modelLink =ExitNodes{});
114 
115 
116  protected:
118  void
120  {
121  for (fixture::Segment& seg : segments_)
122  seg.exitNode = move(rewrite (seg.exitNode));
123  }
124  };
125 
126 
127 
128 }} // namespace steam::fixture
129 #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:37
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:190
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:59
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:133
virtual ~Segmentation()
this is an interface