Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
dummy-builder-context.hpp
Go to the documentation of this file.
1/*
2 DUMMY-BUILDER-CONTEXT.hpp - fake simulated builder result for player tests
3
4 Copyright (C)
5 2011, 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
37#ifndef STEAM_PLAY_DUMMY_BUILDER_CONTEXT_H
38#define STEAM_PLAY_DUMMY_BUILDER_CONTEXT_H
39
40
46#include "steam/asset/pipe.hpp"
47#include "common/query.hpp"
48
49#include "lib/iter-source.hpp"
50#include "lib/nocopy.hpp"
51#include "lib/util.hpp"
52
53#include <vector>
54
55
56namespace steam{
57namespace play {
58namespace test {
59
61
62
68 {
69 BuffHandle claimBufferFor(FrameID) override { UNIMPLEMENTED ("claimBufferFor(FrameID)"); }
70 bool isTimely (FrameID, TimeValue) override { return true; }
71 void transfer (BuffHandle const&) override { UNIMPLEMENTED ("transfer (BuffHandle const&)"); }
72 void pushout (BuffHandle const&) override { UNIMPLEMENTED ("pushout (BuffHandle const&)"); }
73 void discard (BuffHandle const&) override { UNIMPLEMENTED ("discard (BuffHandle const&)"); }
74 void shutDown () override { UNIMPLEMENTED ("shutDown() Connection"); }
75
76 public:
79 };
80
81
82 using asset::Pipe;
83 using asset::PPipe;
84 using asset::Struct;
85 using asset::Timeline;
86 using asset::PTimeline;
89 using util::contains;
90 using lumiera::Query;
91
92
95
97 using DummyOutputLink = std::pair<mobject::ModelPort, play::DataSink>;
98
99
100 inline PID
101 getPipe (string id)
102 {
103 return Pipe::query ("id("+id+")");
104 }
105
106 inline TID
107 getTimeline (string id)
108 {
109 return asset::Struct::retrieve (Query<Timeline> ("id("+id+")"))->getID();
110 }
111
113 const string namePortA("bus-A");
114 const string namePortB("bus-B");
115
123 {
126
127 std::vector<ModelPort> modelPorts_;
128 std::vector<DataSink> dataSinks_;
129
132 : registry_()
133 , existingRegistry_(ModelPortRegistry::setActiveInstance (registry_))
134 {
136 }
137
146
147 void
149 {
150 PID pipeA = getPipe (namePortA);
151 PID pipeB = getPipe (namePortB);
152 TID someTimeline = getTimeline ("dummy_Timeline");
153
154 // start out with defining some new model ports......
155 registry_.definePort (pipeA, someTimeline);
156 registry_.definePort (pipeB, someTimeline);
157
159
160 // now "bus-A" and "bus-B" are known as model ports
161 modelPorts_.push_back (ModelPort(pipeA));
162 modelPorts_.push_back (ModelPort(pipeB));
163
164 // prepare corresponding placeholder DataSink (a fake active output connection)
165 dataSinks_.emplace_back().activate(std::make_shared<UnimplementedConnection>());
166 dataSinks_.emplace_back().activate(std::make_shared<UnimplementedConnection>());
167 }
168
169
172 {
174 }
175
178 {
179 REQUIRE (index < modelPorts_.size());
180 return {modelPorts_[index]
181 ,dataSinks_[index]
182 };
183 }
184 };
185
186
187}}} // namespace steam::play::test
188#endif /*STEAM_PLAY_DUMMY_BUILDER_CONTEXT_H*/
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition p.hpp:77
basic constant internal time value.
Generic interface to express a query for specifically typed result elements exposing some capabilitie...
Definition query.hpp:254
thin wrapper around a size_t hash ID used as primary key for all Asset objects.
Definition asset.hpp:98
structural asset corresponding to the part of the model forming a processing pipe for generating medi...
Definition pipe.hpp:72
static PPipe query(string const &properties)
convenience shortcut for retrieving default configured pipes
Definition pipe.cpp:57
key abstraction: structural asset Created automatically as a sideeffect of building the structure of ...
Definition struct.hpp:105
static StructFactory retrieve
storage for the static StructFactory instance
Definition struct.hpp:107
Handle for a buffer for processing data, abstracting away the actual implementation.
Management facility for tracking model ports.
ModelPortDescriptor const & definePort(PID pipe, StID element_exposing_this_port)
create and register a new model port entry, within the pending transaction
static void shutdown()
globally deactivate access to model ports
static ModelPortRegistry * setActiveInstance(ModelPortRegistry &newRegistry)
switch the implicit link to the global ModelPort registry to point to the given implementation instan...
void commit()
activate pending model port changes.
Handle designating a point within the model, where actually output data can be pulled.
unsigned int uint
Definition integral.hpp:29
Extension module to build an opaque data source, accessible as Lumiera Forward Iterator.
Mutation and management facility for model ports within the builder.
Organising the output data calculation possibilities.
_SeqT< CON >::Iter eachEntry(CON &container)
const string namePortB("bus-B")
std::pair< mobject::ModelPort, play::DataSink > DummyOutputLink
asset::ID< Struct > TID
const string namePortA("bus-A")
FrameCnt FrameID
Steam-Layer implementation namespace root.
Test runner and basic definitions for tests.
bool contains(MAP &map, typename MAP::key_type const &key)
shortcut for containment test on a map
Definition util.hpp:230
Mix-Ins to allow or prohibit various degrees of copying and cloning.
A global service to handle all external output connections.
Interface for concrete output implementations to talk to the OutputSlot frontend.
A "processing pipe" represented as Asset.
Basic and generic representation of an internal query.
helper for dummy render engine: Simulate the result of a build process, without actually running the ...
Top level structural element within the session.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...