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)
5  2008, 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 
23 #ifndef STEAM_FIXTURE_SEGMENT_H
24 #define STEAM_FIXTURE_SEGMENT_H
25 
26 
27 #include "steam/common.hpp"
31 #include "lib/allocator-handle.hpp"
32 #include "lib/time/timevalue.hpp"
33 #include "lib/util.hpp"
34 
35 #include <utility>
36 #include <deque>
37 #include <tuple>
38 
39 
40 namespace steam {
41 namespace fixture {
42 
43  using mobject::ExplicitPlacement;
44  using lib::time::TimeSpan;
45  using lib::time::Time;
46  using util::unConst;
47  using std::move;
48 
59  class Segment
60  {
63  using PortTable = std::deque<std::reference_wrapper<JobTicket>>;
64 
65  protected:
66 
69 
72  PortTable portTable_;
73 
75 
76  std::deque<ExplicitPlacement> elements;
77  // TODO: actually necessary??
78  // TODO: ownership??
80  public:
81  explicit
82  Segment (TimeSpan span =TimeSpan::ALL)
83  : Segment{span, NodeGraphAttachment{}}
84  { }
85 
90  Segment (TimeSpan covered
91  ,NodeGraphAttachment&& modelLink)
92  : span_{covered}
93  , ticketAlloc_{}
94  , portTable_{}
95  , exitNode{move (modelLink)}
96  { }
97 
101  Segment (Segment const& original, TimeSpan changed)
102  : span_{changed}
103  , ticketAlloc_{} // Note: not cloning tickets owned by Segment
104  , portTable_{}
105  , exitNode{original.exitNode}
106  { }
107 
108  // default copy acceptable
109 
110  Time start() const { return span_.start(); }
111  Time after() const { return span_.end(); }
112 
115 
116 
122  jobTicket (size_t portNr) const
123  {
124  if (portNr >= portTable_.size())
125  unConst(this)->generateTickets_onDemand (portNr);
126  ASSERT (portNr < portTable_.size());
127  return portTable_[portNr];
128  }
129 
130  bool
131  empty() const
132  {
133  return exitNode.empty();
134  }
135 
136 
137  private:
138  void
139  generateTickets_onDemand (size_t portNr)
140  {
141  for (size_t i = portTable_.size(); i <= portNr; ++i)
142  if (isnil (exitNode[portNr])) // ‣ disable this slot
143  portTable_.emplace_back (engine::JobTicket::NOP);
144  else
145  {// Ticket was not generated yet...
146  JobTicket& newTicket = ticketAlloc_(exitNode[portNr], ticketAlloc_);
147  portTable_.emplace_back (newTicket); // ref to new ticket ‣ slot
148  }
149  }
150  };
151 
152 
153 
154 }} // namespace steam::fixture
155 #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:68
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:122
Segment(Segment const &original, TimeSpan changed)
copy-and-remould an existing Segment to sit at another time span
Definition: segment.hpp:101
Steam-Layer implementation namespace root.
static JobTicket NOP
special »do nothing« JobTicket marker
Definition: job-ticket.hpp:127
std::deque< ExplicitPlacement > elements
relevant MObjects comprising this segment.
Definition: segment.hpp:76
Lumiera&#39;s internal time value datatype.
Definition: timevalue.hpp:299
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:90
NodeGraphAttachment exitNode
connection to the render nodes network
Definition: segment.hpp:114
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:59
TicketAlloc ticketAlloc_
manage JobTicket: render plan / blueprint to use for this segment
Definition: segment.hpp:71
A time interval anchored at a specific point in time.
Definition: timevalue.hpp:573
a family of time value like entities and their relationships.
Segment(TimeSpan span=TimeSpan::ALL)
create empty Segment
Definition: segment.hpp:82
execution plan for pulling a specific exit node.
Definition: job-ticket.hpp:78