stub all the job generating functions required for the dispatcher interface

This commit is contained in:
Fischlurch 2012-04-26 04:11:31 +02:00
parent 0ab773ab7c
commit bb43c03ef9
5 changed files with 64 additions and 14 deletions

View file

@ -34,7 +34,7 @@ namespace engine {
/** */
Dispatcher::CoordBuilder
Dispatcher::JobBuilder
Dispatcher::onCalcStream (ModelPort modelPort, uint channel)
{
UNIMPLEMENTED ("build coordinates of frame to render");
@ -43,12 +43,32 @@ namespace engine {
/** */
FrameCoord
Dispatcher::CoordBuilder::relativeFrameLocation (TimeAnchor refPoint, uint frameCountOffset)
Dispatcher::JobBuilder::relativeFrameLocation (TimeAnchor refPoint, uint frameCountOffset)
{
UNIMPLEMENTED ("build coordinates of frame to render");
}
/** */
Dispatcher::JobBuilder&
Dispatcher::JobBuilder::establishNextJobs (TimeAnchor refPoint)
{
UNIMPLEMENTED ("job planning and generation");
return *this;
}
/** */
Dispatcher::JobBuilder&
Dispatcher::JobBuilder::prepareContinuation (function<void(TimeAnchor)> delayedAction)
{
UNIMPLEMENTED ("wrap already planned jobs, appending a continuation to pick up later");
return *this;
}
/** */
JobTicket&
Dispatcher::accessJobTicket (FrameCoord const& frameID)

View file

@ -33,12 +33,13 @@
#include "lib/time/timevalue.hpp"
#include <boost/noncopyable.hpp>
#include <tr1/functional>
namespace proc {
namespace engine {
using std::tr1::function;
using mobject::ModelPort;
using lib::time::TimeSpan;
using lib::time::FSecs;
@ -52,19 +53,32 @@ namespace engine {
class Dispatcher
: boost::noncopyable
{
struct CoordBuilder
struct JobBuilder
{
Dispatcher& dispatcher_;
ModelPort modelPort_;
uint channel_;
FrameCoord relativeFrameLocation (TimeAnchor refPoint, uint frameCountOffset);
FrameCoord relativeFrameLocation (TimeAnchor refPoint, uint frameCountOffset);
JobBuilder& establishNextJobs (TimeAnchor refPoint);
JobBuilder& prepareContinuation (function<void(TimeAnchor)> delayedAction);
operator JobTicket::JobsPlanning()
{
UNIMPLEMENTED ("how to represent the closure for defining and scheduling jobs");
////////TODO: use a closure based on the JobTicket (which can be accessed through the dispatcher backlink)
//////////// Because this closure is what backs the IterSource, it needs to have a reliable storage though.
}
};
public:
virtual ~Dispatcher(); ///< this is an interface
CoordBuilder onCalcStream (ModelPort modelPort, uint channel);
JobBuilder onCalcStream (ModelPort modelPort, uint channel);
JobTicket& accessJobTicket (FrameCoord const&);

View file

@ -99,8 +99,8 @@ namespace engine {
}
JobsPlanning
createJobsFor (FrameCoord coordinates)
Job
createJobFor (FrameCoord coordinates)
{
UNIMPLEMENTED ("job planning and generation");
}

View file

@ -42,6 +42,13 @@ enum JobState
ABORTED ///< got aborted
};
enum JobKind
{
CALC_JOB, ///< calculating frame data, CPU bound
LOAD_JOB, ///< accessing prerequisites, IO bound
META_JOB ///< render process self organisation
};
/**
* closure representing the execution context of a job.
@ -109,7 +116,8 @@ typedef lumiera_jobDescriptor* LumieraJobDescriptor;
#ifdef __cplusplus /* ============== C++ Interface ================= */
#include "proc/common.hpp"
//#include "proc/common.hpp"
#include "lib/error.hpp"
//#include "proc/state.hpp"
#include "lib/time/timevalue.hpp"
//#include "lib/time/timequant.hpp"
@ -172,9 +180,16 @@ using lib::time::Time;
return this->parameter.invoKey;
}
JobKind getKind() const;
bool isValid() const;
};
inline JobKind
Job::getKind() const
{
UNIMPLEMENTED ("need a better C-representation of the job");
}
}} // namespace proc::engine

View file

@ -156,10 +156,10 @@ namespace test {
JobTicket& executionPlan = dispatcher.accessJobTicket (coordinates);
CHECK (executionPlan.isValid());
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #880
Job frameJob = executionPlan.createJobFor (coordinates);
CHECK (frameJob.getNominalTime() == coordinates.absoluteNominalTime);
CHECK (0 < frameJob.getInvocationInstanceID());
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #880
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #880
}
@ -179,7 +179,6 @@ namespace test {
TimeAnchor refPoint = TimeAnchor::build (timings, startFrame);
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #880
JobTicket::JobsPlanning jobs = dispatcher.onCalcStream(modelPort,channel)
.establishNextJobs(refPoint);
@ -192,7 +191,8 @@ namespace test {
uint chunksize = plannedChunk.size();
CHECK (chunksize == timings.getPlanningChunkSize());
TimeVar nextFrameStart = refPoint;
TimeVar nextFrameStart (refPoint);
InvocationInstanceID prevInvocationID(0);
Offset expectedTimeIncrement (1, FrameRate::PAL);
for (uint i=0; i < chunksize; ++i )
{
@ -203,6 +203,7 @@ namespace test {
prevInvocationID = thisJob.getInvocationInstanceID();
nextFrameStart += expectedTimeIncrement;
}
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #880
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #880
}
@ -228,14 +229,13 @@ namespace test {
function<void(TimeAnchor)> testFunc = verify_invocation_of_Continuation;
TimeAnchor refPoint = TimeAnchor::build (timings, startFrame);
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #880
JobTicket::JobsPlanning jobs = dispatcher.onCalcStream(modelPort,channel)
.establishNextJobs(refPoint)
.prepareContinuation(testFunc);
// an additional "continuation" Job has been prepared....
Job continuation = lib::pull_last(jobs);
CHECK (META_JOB = continuation.getKind());
CHECK (META_JOB == continuation.getKind());
uint nrJobs = timings.getPlanningChunkSize();
Duration frameDuration (1, FrameRate::PAL);
@ -247,6 +247,7 @@ namespace test {
// Since we passed testFunc as action for the continuation, we expect the invocation
// of the function verify_invocation_of_Continuation()
continuation.triggerJob();
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #880
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #880
}