Lumiera  0.pre.03
»edit your freedom«
engine-service.cpp
Go to the documentation of this file.
1 /*
2  EngineService - primary service access point for using the renderengine
3 
4  Copyright (C) Lumiera.org
5  2011, 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 
31 #include "lib/itertools.hpp"
32 
33 //#include <string>
34 //#include <memory>
35 #include <functional>
36 
37 
38 
39 namespace steam {
40 namespace engine{
41 
42 // using std::string;
43 // using lumiera::Subsys;
44  using std::function;
45  using std::bind;
46  using std::ref;
48  using lib::append_all;
49 
50 
51  namespace { // hidden local details of the service implementation....
52 
53  } // (End) hidden service impl details
54 
55 
56 
57 
58 
61 
62 
63 
65  EngineService::EngineService()
66  { }
67 
68 
69 
79  CalcStreams
81  Timings nominalTimings,
82  OutputConnection& output,
83  Quality serviceQuality)
84  {
85  RenderEnvironment& renderConfig = configureCalculation (mPort,nominalTimings,serviceQuality);
86  function<CalcStream(play::DataSink)> triggerRenderStart = bind (activateCalculation, _1, ref(renderConfig));
87 
88  CalcStreams runningCalculations;
89  append_all (transform (output.getOpenedSinks()
90  ,triggerRenderStart
91  )
92  ,runningCalculations);
93  return runningCalculations;
95 // treat_all(output.getOpenedSinks())
96 // .apply (activateCalculation, _1, renderConfig)
97 // .buildVector();
98  }
99 
100 
101 
103  CalcStreams
104  EngineService::calculateBackground(ModelPort mPort,
105  Timings nominalTimings,
106  Quality serviceQuality)
107  {
108  UNIMPLEMENTED ("build calculation streams for background rendering");
109  }
110 
111 
118  CalcStream
120  {
121  CalcStream calcStream(engineCallback);
122  calcStream.sendToOutput (sink);
123  return calcStream;
124  }
125 
126 
127 
149  Timings nominalTimings,
150  Quality serviceQuality)
151  {
152  UNIMPLEMENTED ("Access and wire to the Scheduler-frontend. "
153  "Then access the Segmentation and invoke a builder function for a suitable dispatcher table. "
154  "Package all of this into a suitable RenderEnvironementClosure subclass.");
155  RenderEnvironment* todo_fake(0);
156 
157  return *todo_fake;
158  }
159 
160 
161 
168  void
170  {
171  UNIMPLEMENTED ("tracing/diagnostics mode of the render engine");
172  }
173 
174  void
176  {
177  UNIMPLEMENTED ("tracing/diagnostics mode of the render engine");
179  }
180 
181 
182 
183 
184 
185  /* ===== Quality-of-Service ===== */
186 
187 
188  enum CalcType {
189  PLAYBACK,
190  RENDER,
191  BACKGROUND
192  };
193 
194 
196  : public EngineService::Quality
197  {
198  CalcType type_;
199 
200  public:
201  DefaultQoS (CalcType type)
202  : type_(type)
203  { }
204  };
205 
207  : public DefaultQoS
208  {
209 
210  public:
211  PriorityQoS ()
212  : DefaultQoS(PLAYBACK)
213  { }
214  };
215 
217  : public DefaultQoS
218  {
219 
220  public:
221  Compromise (CalcType type)
222  : DefaultQoS(type)
223  { }
224  };
225 
226 
227  EngineService::QoS_Definition EngineService::QoS_DEFAULT = QoS_Definition::build<DefaultQoS> (PLAYBACK);
228  EngineService::QoS_Definition EngineService::QoS_BACKGROUND = QoS_Definition::build<DefaultQoS> (BACKGROUND);
229  EngineService::QoS_Definition EngineService::QoS_COMPROMISE = QoS_Definition::build<Compromise> (PLAYBACK);
230  EngineService::QoS_Definition EngineService::QoS_PERFECT_RESULT = QoS_Definition::build<DefaultQoS> (RENDER);
231  EngineService::QoS_Definition EngineService::QoS_SYNC_PRIORITY = QoS_Definition::build<PriorityQoS>();
232 
233 
234 
235 }} // namespace steam::engine
Access point for the (core) calculation service of the render engine.
void activateTracing()
Switch the complete engine into diagnostics mode.
CalcStreams calculate(ModelPort mPort, Timings nominalTimings, OutputConnection &output, Quality serviceQuality=QoS_DEFAULT)
core operation: activate the Lumiera Render Engine.
Generic frame timing specification.
Definition: timings.hpp:95
denotes an opened connection ready to receive media data for output.
Steam-Layer implementation namespace root.
static lib::Depend< EngineService > instance
access point to the Engine Interface.
Access point to singletons and other kinds of dependencies designated by type.
Definition: depend.hpp:289
static CalcStream activateCalculation(play::DataSink, RenderEnvironment &)
Template to build polymorphic value objects.
A calculation stream groups and abstracts a series of calculation jobs, delivering frames into the co...
Definition: calc-stream.hpp:96
_TransformIterT< IT, FUN >::Iter transform(IT &&source, FUN processingFunc)
pipes a given Lumiera Forward Iterator through a transformation function and wraps the resulting tran...
Handle designating a point within the model, where actually output data can be pulled.
Definition: model-port.hpp:104
virtual RenderEnvironment & configureCalculation(ModelPort, Timings, Quality)
Helpers for working with iterators based on the pipeline model.
Quality-of-Service definition for an Render Engine usage.
Abstract definition of the environment hosting a given render activity (CalcStream).