41 #ifndef STEAM_ENGINE_TEST_MOCK_DISPATCHER_H 42 #define STEAM_ENGINE_TEST_MOCK_DISPATCHER_H 70 using std::make_tuple;
80 using fixture::Segmentation;
106 :
Job{
build (nominalTime,additionalKey)}
110 static bool was_invoked (
Job const& job);
111 static Time invocationTime (
Job const& job);
112 static Time invocationNominalTime (
Job const& job);
113 static int invocationAdditionalKey (
Job const& job);
150 return ExitNode{seed, DUMMY_JOB_RUNTIME
157 :
JobTicket{defineSimpleSpec(), allocator()}
161 :
JobTicket{defineSimpleSpec (seed), allocator()}
167 bool verify_associated (
Job const&)
const;
168 static bool isAssociated (
Job const&,
JobTicket const&);
205 for (
auto& spec : specs)
207 auto start = spec.retrieveAttribute<
Time> (
"start");
208 auto after = spec.retrieveAttribute<
Time> (
"after");
210 ,ExitNodes{buildExitNodeFromSpec (spec)}
217 buildExitNodeFromSpec (
GenNode const& spec)
221 ,buildPrerequisites (spec)
226 void duplicateExitNodeSpec (uint times);
232 buildSeed (
GenNode const& spec)
239 buildRuntime (
GenNode const& spec)
242 return runtime? *runtime : DUMMY_JOB_RUNTIME;
246 buildPrerequisites (
GenNode const& spec)
248 ExitNodes prerequisites;
249 for (
auto& child : spec.getChildren())
250 prerequisites.emplace_back (
251 buildExitNodeFromSpec (child));
252 return prerequisites;
273 return Spec{ExitNodes(times, spec[0])};
289 return this->isValid()
290 and this->verifyInstance(functor, invoKey, nominalTime);
334 DummyPlaybackSetup dummySetup_;
337 using PortIdxMap = std::map<ModelPort, size_t>;
339 const PortIdxMap portIdx_;
347 auto entry = portIdx_.find(modelPort);
348 if (
entry == portIdx_.end())
349 throw error::Logic{
"Invalid ModelPort for this Dispatcher"};
351 return entry->second;
358 auto& seg = mockSeg_[nominalTime];
359 return seg.jobTicket(portIDX);
366 , mockSeg_{MakeRec().genNode()}
367 , portIdx_{buildPortIndex()}
375 , portIdx_{buildPortIndex()}
382 provideMockModelPort()
384 ModelPorts mockModelPorts = dummySetup_.getAllModelPorts();
385 return *mockModelPorts;
397 play::test::DummyOutputLink
400 return dummySetup_.getModelPort (index);
408 if (not dummySetup_.isSupported (port, sink))
return false;
410 TimeValue nominalTime{job.parameter.nominalTime};
411 size_t portIDX = resolveModelPort (port);
412 JobTicket& ticket = getJobTicketFor (portIDX, nominalTime);
423 for (
auto it=dummySetup_.getAllModelPorts()
Organising the output data calculation possibilities.
size_t resolveModelPort(ModelPort modelPort) override
translate a generic ModelPort spec into the specific index number applicable at the Timeline referred...
Execution plan to generate render jobs within a specific render process.
static JobClosure & getFunctor()
JobTicket & getJobTicketFor(size_t portIDX, TimeValue nominalTime) override
Core Dispatcher operation: locate the appropriate Segment and retrieve/derive a »blueprint« for rende...
Mock setup for a JobTicket to generate dummy render Job invocations.
Framework for dummy playback and rendering.
For the purpose of building and rendering, the fixture (for each timeline) is partitioned such that e...
AnyPair entry(Query< TY > const &query, typename WrapReturn< TY >::Wrapper &obj)
helper to simplify creating mock table entries, wrapped correctly
bool verify_associated(Job const &) const
verify the given job instance was actually generated from this JobTicket.
Service abstraction within the render engine for generating render jobs.
A mocked frame Dispatcher setup without any backing model.
void duplicateExitNodeSpec(uint times)
This is some trickery to allow handling of multiple ModelPort(s) in MockDispatcher; actually the code...
A front-end/concept to allow access to custom memory management.
int rani(uint bound=_iBOUND())
Internal abstraction: a service within the engine for translating a logical calculation stream (corre...
Segment const & splitSplice(OptTime start, OptTime after, engine::ExitNodes &&modelLink=ExitNodes{})
rework the existing Segmentation to include a new Segment as specified
Mock setup for a render Job with NO action but built-in diagnostics.
denotes an opened connection ready to receive media data for output.
play::test::DummyOutputLink getDummyConnection(uint index)
The faked builder/playback setup provides some preconfigured ModelPort and corresponding DataSink han...
Steam-Layer implementation namespace root.
Placeholder implementation for a custom allocator.
Lumiera's internal time value datatype.
Derived specific exceptions within Lumiera's exception hierarchy.
static ExitNode defineSimpleSpec(HashVal seed=ranHash())
provide a test specification wired to MockJob
Dummy and test setup of playback and rendering, omitting most of the Lumiera engine.
A top-level point in the render node network where data generation can be driven. ...
bool verify(Job const &job, ModelPort const &port, play::DataSink const &sink)
Test support: verify the given Job is consistent with this Dispatcher.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Generic building block for tree shaped (meta)data structures.
Binding and access point from a given Segment to access the actual render nodes.
Mock setup for a complete Segmentation to emulate the structure of the actual fixture, without the need of building a low-level Model.
A collection of frequently used helper functions to support unit testing.
static Job build()
uses random job definition values
Intrusive single linked list with optional ownership.
std::optional< X > retrieveAttribute(string key) const
mismatch tolerant convenience shortcut to peek into the attributes of a nested Record ...
void adaptSpecification(std::function< NodeGraphAttachment(NodeGraphAttachment const &)> rewrite)
Definition of a render job.
Singleton services and Dependency Injection.
static bool isAssociated(Job const &, JobTicket const &)
convenience shortcut to perform this test on arbitrary JobTicket and Job instances.
Handle designating a point within the model, where actually output data can be pulled.
Link from the Fixture datastructure into the render node network.
opaque ID attached to each individual job invocation.
size_t HashVal
a STL compatible hash value
static bool isNopJob(Job const &)
Interface of the closure for frame rendering jobs.
Duration is the internal Lumiera time metric.
Part of the Fixture datastructure to manage time segments of constant structure.
Convenience frontend to access the current raw system time.
Individual frame rendering task, forwarding to a closure.
a family of time value like entities and their relationships.
Front-end for simplified access to the current wall clock time.
basic constant internal time value.
generic data element node within a tree
execution plan for pulling a specific exit node.
bool isSameObject(A const &a, B const &b)
compare plain object identity, based directly on the referee's memory identities. ...