Lumiera  0.pre.03
»edit your freedom«
segment.hpp
Go to the documentation of this file.
1 /*
2  SEGMENT.hpp - Segment of the timeline for rendering.
3 
4  Copyright (C) Lumiera.org
5  2008, 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 
32 #ifndef STEAM_FIXTURE_SEGMENT_H
33 #define STEAM_FIXTURE_SEGMENT_H
34 
35 
36 #include "steam/common.hpp"
40 #include "lib/allocator-handle.hpp"
41 #include "lib/time/timevalue.hpp"
42 #include "lib/util.hpp"
43 
44 #include <utility>
45 #include <deque>
46 #include <tuple>
47 
48 
49 namespace steam {
50 namespace fixture {
51 
52  using mobject::ExplicitPlacement;
53  using lib::time::TimeSpan;
54  using lib::time::Time;
55  using util::unConst;
56  using std::move;
57 
68  class Segment
69  {
72  using PortTable = std::deque<std::reference_wrapper<JobTicket>>;
73 
74  protected:
75 
78 
81  PortTable portTable_;
82 
84 
85  std::deque<ExplicitPlacement> elements;
86  // TODO: actually necessary??
87  // TODO: ownership??
89  public:
90  explicit
91  Segment (TimeSpan span =TimeSpan::ALL)
92  : Segment{span, NodeGraphAttachment{}}
93  { }
94 
99  Segment (TimeSpan covered
100  ,NodeGraphAttachment&& modelLink)
101  : span_{covered}
102  , ticketAlloc_{}
103  , portTable_{}
104  , exitNode{move (modelLink)}
105  { }
106 
110  Segment (Segment const& original, TimeSpan changed)
111  : span_{changed}
112  , ticketAlloc_{} // Note: not cloning tickets owned by Segment
113  , portTable_{}
114  , exitNode{original.exitNode}
115  { }
116 
117  // default copy acceptable
118 
119  Time start() const { return span_.start(); }
120  Time after() const { return span_.end(); }
121 
124 
125 
131  jobTicket (size_t portNr) const
132  {
133  if (portNr >= portTable_.size())
134  unConst(this)->generateTickets_onDemand (portNr);
135  ASSERT (portNr < portTable_.size());
136  return portTable_[portNr];
137  }
138 
139  bool
140  empty() const
141  {
142  return exitNode.empty();
143  }
144 
145 
146  private:
147  void
148  generateTickets_onDemand (size_t portNr)
149  {
150  for (size_t i = portTable_.size(); i <= portNr; ++i)
151  if (isnil (exitNode[portNr])) // ‣ disable this slot
152  portTable_.emplace_back (engine::JobTicket::NOP);
153  else
154  {// Ticket was not generated yet...
155  JobTicket& newTicket = ticketAlloc_(exitNode[portNr], ticketAlloc_);
156  portTable_.emplace_back (newTicket); // ref to new ticket ‣ slot
157  }
158  }
159  };
160 
161 
162 
163 }} // namespace steam::fixture
164 #endif /*STEAM_FIXTURE_SEGMENT_H*/
Basic set of definitions and includes commonly used together.
Execution plan to generate render jobs within a specific render process.
Core abstraction: completely resolved placement of an MObject Within the session model, all media objects are attached with the help of mobject::Placement elements.
TimeSpan span_
begin of this timeline segment.
Definition: segment.hpp:77
A front-end/concept to allow access to custom memory management.
engine::JobTicket & jobTicket(size_t portNr) const
Access the JobTicket for this segment and the given portNr.
Definition: segment.hpp:131
Segment(Segment const &original, TimeSpan changed)
copy-and-remould an existing Segment to sit at another time span
Definition: segment.hpp:110
Steam-Layer implementation namespace root.
static JobTicket NOP
special »do nothing« JobTicket marker
Definition: job-ticket.hpp:136
std::deque< ExplicitPlacement > elements
relevant MObjects comprising this segment.
Definition: segment.hpp:85
Lumiera&#39;s internal time value datatype.
Definition: timevalue.hpp:308
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Binding and access point from a given Segment to access the actual render nodes.
Segment(TimeSpan covered, NodeGraphAttachment &&modelLink)
create a new Segment to cover the given TimeSpan and to offer the rendering capabilities exposed by m...
Definition: segment.hpp:99
NodeGraphAttachment exitNode
connection to the render nodes network
Definition: segment.hpp:123
Link from the Fixture datastructure into the render node network.
For the purpose of building and rendering, the fixture (for each timeline) is partitioned such that e...
Definition: segment.hpp:68
TicketAlloc ticketAlloc_
manage JobTicket: render plan / blueprint to use for this segment
Definition: segment.hpp:80
A time interval anchored at a specific point in time.
Definition: timevalue.hpp:582
a family of time value like entities and their relationships.
Segment(TimeSpan span=TimeSpan::ALL)
create empty Segment
Definition: segment.hpp:91
execution plan for pulling a specific exit node.
Definition: job-ticket.hpp:87