Lumiera  0.pre.03
»edityourfreedom«
dummy-play-connection.hpp
Go to the documentation of this file.
1 /*
2  DUMMY-PLAY-CONNECTION.hpp - simplified test setup for playback
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 
77 #ifndef PROC_PLAY_DUMMY_PLAY_CONNECTION_H
78 #define PROC_PLAY_DUMMY_PLAY_CONNECTION_H
79 
80 
81 //#include "include/dummy-player-facade.h"
82 //#include "include/display-facade.h"
83 //#include "common/instancehandle.hpp"
84 //#include "lib/singleton-ref.hpp"
87 #include "lib/time/timequant.hpp"
88 //#include "lib/scoped-collection.hpp"
90 #include "proc/asset/timeline.hpp"
91 #include "proc/asset/pipe.hpp"
92 #include "common/query.hpp"
93 
94 #include "lib/iter-source.hpp"
95 #include "lib/nocopy.hpp"
96 #include "lib/util.hpp"
97 
98 #include <vector>
99 
100 
101 namespace proc {
102 namespace play {
103 
104 // using std::string;
105 // using lumiera::Subsys;
106 // using lumiera::Display;
107 // using lumiera::DummyPlayer;
108  using lib::time::Duration;
109 
111 
112 
114  {
115 
116  };
117 
118 
119  namespace { // simulated builder environment
120 
121  using asset::Pipe;
122  using asset::PPipe;
123  using asset::Struct;
124  using asset::Timeline;
125  using asset::PTimeline;
126  using mobject::ModelPort;
128  using util::contains;
129  using lumiera::Query;
130 // using lib::ScopedCollection;
131 // using lib::Literal;
132 
133  typedef asset::ID<Pipe> PID;
134  typedef asset::ID<Struct> TID;
135 
136 // typedef ModelPortRegistry::ModelPortDescriptor const& MPDescriptor;
137 
138 
139  inline PID
140  getPipe (string id)
141  {
142  return Pipe::query ("id("+id+")");
143  }
144 
145  inline TID
146  getTimeline (string id)
147  {
148  return asset::Struct::retrieve (Query<Timeline> ("id("+id+")"))->getID();
149  }
150 
151  const uint NUMBER_OF_PORTS = 2;
152  const string namePortA("bus-A");
153  const string namePortB("bus-B");
154 
161  struct SimulatedBuilderContext
162  {
163  ModelPortRegistry registry_;
164  ModelPortRegistry* existingRegistry_;
165 
166  std::vector<ModelPort> modelPorts_;
167 
169  SimulatedBuilderContext()
170  : registry_()
171  , existingRegistry_(ModelPortRegistry::setActiveInstance (registry_))
172  {
173  performMockBuild();
174  }
175 
177  ~SimulatedBuilderContext()
178  {
179  if (existingRegistry_)
180  ModelPortRegistry::setActiveInstance (*existingRegistry_);
181  else
182  ModelPortRegistry::shutdown();
183  }
184 
185  void
186  performMockBuild()
187  {
188  PID pipeA = getPipe (namePortA);
189  PID pipeB = getPipe (namePortB);
190  TID someTimeline = getTimeline ("dummy_Timeline");
191 
192  // start out with defining some new model ports......
193  registry_.definePort (pipeA, someTimeline);
194  registry_.definePort (pipeB, someTimeline);
195 
196  registry_.commit();
197 
198  // now "bus-A" and "bus-B" are known as model ports
199  modelPorts_.push_back (ModelPort(pipeA));
200  modelPorts_.push_back (ModelPort(pipeB));
201  }
202 
203 
204  ModelPorts
205  getAllModelPorts()
206  {
207  return lib::iter_source::eachEntry (modelPorts_.begin(), modelPorts_.end());
208  }
209  };
210  }
211 
212 
213  /****************************************************************/
223  template<class DEF>
226  {
227  SimulatedBuilderContext mockBuilder_;
228 
229  public:
230 
231  ModelPorts
233  {
234  return mockBuilder_.getAllModelPorts();
235  }
236 
239  {
240  UNIMPLEMENTED ("provide a suitable output sink simulation");
241  }
242 
243 
244  /* === Test Support API === */
245 
246  bool
248  {
249  UNIMPLEMENTED ("is this dummy in activated state?");
250  }
251 
252  Duration
254  {
255  UNIMPLEMENTED ("manage the a planned test duration");
256  }
257 
262  void
264  {
265  UNIMPLEMENTED ("do a blocking wait, while an output test is performed in other threads");
266  }
267 
268  bool
270  {
271  UNIMPLEMENTED ("verify proper operation by inspecting the provided test dummy components");
272  }
273  };
274 
275 
276 
277 
278 }} // namespace proc::play
279 #endif /*PROC_PLAY_DUMMY_PLAY_CONNECTION_H*/
Organising the output data calculation possibilities.
void waitUntilDue()
test helper: blocking wait during an output test.
A "processing pipe" represented as Asset.
_SeqT< CON >::Iter eachEntry(CON &container)
Basic and generic representation of an internal query.
Any copy and copy construction prohibited.
Definition: nocopy.hpp:46
Mutation and management facility for model ports within the builder.
lib::P< Timeline > PTimeline
Definition: timeline.hpp:87
lib::P< Pipe > PPipe
Definition: pipe.hpp:51
Handle denoting a point within the model, where actually output data can be pulled.
Definition: model-port.hpp:104
key abstraction: structural asset Created automatically as a sideeffect of building the structure of ...
Definition: struct.hpp:113
static StructFactory retrieve
storage for the static StructFactory instance
Definition: struct.hpp:116
Mix-Ins to allow or prohibit various degrees of copying and cloning.
bool contains(MAP &map, typename MAP::key_type const &key)
shortcut for containment test on a map
Definition: util.hpp:205
OutputDesignation::PID PID
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Support library to represent grid-aligned time specifications This is part of Lumiera&#39;s time and time...
A global service to handle all external output connections.
structural asset corresponding to the part of the model forming a processing pipe for generating medi...
Definition: pipe.hpp:79
Duration is the internal Lumiera time metric.
Definition: timevalue.hpp:380
Management facility for tracking model ports.
Proc-Layer implementation namespace root.
Definition: id-scheme.hpp:63
Extension module to build an opaque data source, accessible as Lumiera Forward Iterator.
Generic interface to express a query for specifically typed result elements exposing some capabilitie...
Definition: query.hpp:279
Top level structural element within the session.
Framework for dummy playback and rendering.
lib::IterSource< mobject::ModelPort >::iterator ModelPorts