WIP: move building of the follow-up anchor into the new closure

This commit is contained in:
Fischlurch 2013-06-16 04:36:32 +02:00
parent 84281d5b60
commit 1f1d478da2
4 changed files with 25 additions and 42 deletions

View file

@ -87,7 +87,7 @@ namespace engine {
void
invokeJobOperation (JobParameter parameter)
{
UNIMPLEMENTED ("representation of the job functor, especially the invocation instance idea for this planning chunk");
UNIMPLEMENTED ("representation of the job functor, especially the invocation instance ID for this planning chunk");
}
@ -127,12 +127,18 @@ namespace engine {
void
performJobPlanningChunk()
{
UNIMPLEMENTED ("the actual meat: do the planning for a chunk of jobs");
JobPlanningSequence jobs = dispatcher_->onCalcStream(modelPort_, channel_)
.establishNextJobs(refPoint_);
UNIMPLEMENTED ("the actual meat: access the scheduler and fed those jobs");
}
Job
buildFollowUpJobFromThis()
{
refPoint_.setNextAnchorPoint();
UNIMPLEMENTED ("create the follow-up job, wired with this closure");
}
};

View file

@ -50,24 +50,6 @@ namespace engine {
}
/** */
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;
}

View file

@ -74,7 +74,6 @@ namespace engine {
struct JobBuilder
{
Dispatcher& dispatcher_;
TimeAnchor refPoint_;
ModelPort modelPort_;
uint channel_;
@ -82,23 +81,18 @@ namespace engine {
/////////TODO somehow need to represent the dimensions of a "planning chunk"...
FrameCoord relativeFrameLocation (TimeAnchor refPoint, uint frameCountOffset =0);
FrameCoord relativeFrameLocation (TimeAnchor& refPoint, uint frameCountOffset =0);
JobBuilder& establishNextJobs (TimeAnchor refPoint);
operator JobPlanningSequence()
JobPlanningSequence
establishNextJobs (TimeAnchor& refPoint)
{
TimeAnchor nextPlanningAnchor = refPoint_.buildNextAnchor();
TODO ("build the continuation job if necessary, wrap the sequence");
return JobPlanningSequence(
relativeFrameLocation(refPoint_),
dispatcher_);
}
};
public:
virtual ~Dispatcher(); ///< this is an interface

View file

@ -87,7 +87,7 @@ namespace engine {
int64_t anchorPoint_;
Time relatedRealTime_;
Time
static Time
expectedTimeofArival (play::Timings const& timings, int64_t startFrame, Offset startDelay)
{
Duration totalLatency = startDelay
@ -133,19 +133,20 @@ namespace engine {
}
/** create a follow-up TimeAnchor.
/** set a follow-up TimeAnchor point.
* After planning a chunk of jobs, the dispatcher uses
* this function to set up a new breaking point (TimeAnchor)
* and places a continuation job to resume the planning activity.
* @return new TimeAchor which precisely satisfies the <i>planning
* chunk duration</i>: it will be anchored at the following
* grid point, resulting in seamless coverage of the timeline
* @note precisely satisfies the <i>planning chunk duration</i>:
* afterwards the start point will be anchored at the grid point
* following the end of the previous planning chunk, resulting
* in a seamless coverage of the timeline
*/
TimeAnchor
buildNextAnchor() const
void
setNextAnchorPoint()
{
int64_t nextStart = timings_.establishNextPlanningChunkStart (this->anchorPoint_);
return TimeAnchor(this->timings_, nextStart);
this->anchorPoint_ = timings_.establishNextPlanningChunkStart (this->anchorPoint_);
this->relatedRealTime_ = expectedTimeofArival(this->timings_,this->anchorPoint_, Offset::ZERO);
}