diff --git a/src/proc/engine/calc-plan-continuation.cpp b/src/proc/engine/calc-plan-continuation.cpp index a4c3f02a2..106727e59 100644 --- a/src/proc/engine/calc-plan-continuation.cpp +++ b/src/proc/engine/calc-plan-continuation.cpp @@ -22,16 +22,86 @@ #include "proc/engine/calc-plan-continuation.hpp" +#include "proc/engine/frame-coord.hpp" +#include "proc/engine/job-ticket.hpp" +#include "lib/time/timevalue.hpp" //#include "lib/frameid.hpp" //#include "proc/state.hpp" +#include + namespace proc { namespace engine { - - /** */ + + /** entry point (interface JobClosure): invoke the concrete job operation. + * In this case, the job operation is responsible for planning a chunk of actual render jobs. + */ + void + CalcPlanContinuation::invokeJobOperation (JobParameter parameter) + { + ASSERT (parameter.nominalTime == timings_.getFrameStartAt (parameter.invoKey.frameNumber)); + + this->performJobPlanningChunk (parameter.invoKey.frameNumber); + } + + + void + CalcPlanContinuation::signalFailure (JobParameter parameter, JobFailureReason reason) + { + UNIMPLEMENTED ("what needs to be done when a planning continuation cant be invoked?"); + } + + + bool + CalcPlanContinuation::verify (Time nominalJobTime) const + { + UNIMPLEMENTED ("verify the planning coordinates"); + return false; + } + + size_t + CalcPlanContinuation::hashOfInstance (InvocationInstanceID invoKey) const + { + return boost::hash_value (invoKey.frameNumber); + } + + + + + + Job + CalcPlanContinuation::prepareRenderPlanningFrom (int64_t startFrame) + { + InvocationInstanceID invoKey; + invoKey.frameNumber = startFrame; + Time nominalPlanningStartTime = timings_.getFrameStartAt (startFrame); + + return Job(*this, invoKey, nominalPlanningStartTime); + } + + + void + CalcPlanContinuation::performJobPlanningChunk(int64_t nextStartFrame) + { + TimeAnchor refPoint(timings_, nextStartFrame); + JobPlanningSequence jobs = dispatcher_.onCalcStream(modelPort_, channel_) + .establishNextJobs(refPoint); + + Job nextChunkOfPlanning = buildFollowUpJobFrom (refPoint); + + UNIMPLEMENTED ("the actual meat: access the scheduler and fed those jobs"); + } + + + Job + CalcPlanContinuation::buildFollowUpJobFrom (TimeAnchor const& refPoint) + { + return this->prepareRenderPlanningFrom( + refPoint.getNextAnchorPoint()); + } diff --git a/src/proc/engine/calc-plan-continuation.hpp b/src/proc/engine/calc-plan-continuation.hpp index b41cfb291..3cb3237e5 100644 --- a/src/proc/engine/calc-plan-continuation.hpp +++ b/src/proc/engine/calc-plan-continuation.hpp @@ -27,15 +27,11 @@ #include "proc/common.hpp" #include "proc/mobject/model-port.hpp" #include "proc/engine/time-anchor.hpp" -#include "proc/engine/frame-coord.hpp" -#include "proc/engine/job-ticket.hpp" #include "proc/engine/dispatcher.hpp" #include "proc/play/timings.hpp" #include "backend/engine/job.h" -#include "lib/time/timevalue.hpp" #include -//#include namespace proc { @@ -79,28 +75,13 @@ namespace engine { return META_JOB; } - bool - verify (Time nominalJobTime) const - { - UNIMPLEMENTED ("verify the planning coordinates"); - return false; - } + bool verify (Time nominalJobTime) const; + size_t hashOfInstance (InvocationInstanceID) const; - void - invokeJobOperation (JobParameter parameter) - { - ASSERT (parameter.nominalTime == timings_.getFrameStartAt (parameter.invoKey.frameNumber)); - - this->performJobPlanningChunk (parameter.invoKey.frameNumber); - } + void invokeJobOperation (JobParameter); + void signalFailure (JobParameter, JobFailureReason); - void - signalFailure (JobParameter parameter, JobFailureReason reason) - { - UNIMPLEMENTED ("what needs to be done when a planning continuation cant be invoked?"); - } - public: @@ -126,37 +107,12 @@ namespace engine { * @param startFrame where to begin rendering, relative to the nominal * time grid implicitly related to the ModelPort to be pulled */ - Job - prepareRenderPlanningFrom (int64_t startFrame) - { - InvocationInstanceID invoKey; - invoKey.frameNumber = startFrame; - Time nominalPlanningStartTime = timings_.getFrameStartAt (startFrame); - - return Job(*this, invoKey, nominalPlanningStartTime); - } + Job prepareRenderPlanningFrom (int64_t startFrame); private: - void - performJobPlanningChunk(int64_t nextStartFrame) - { - TimeAnchor refPoint(timings_, nextStartFrame); - JobPlanningSequence jobs = dispatcher_.onCalcStream(modelPort_, channel_) - .establishNextJobs(refPoint); - - Job nextChunkOfPlanning = buildFollowUpJobFrom (refPoint); - - UNIMPLEMENTED ("the actual meat: access the scheduler and fed those jobs"); - } - - - Job - buildFollowUpJobFrom (TimeAnchor const& refPoint) - { - return this->prepareRenderPlanningFrom( - refPoint.getNextAnchorPoint()); - } + void performJobPlanningChunk(int64_t nextStartFrame); + Job buildFollowUpJobFrom (TimeAnchor const& refPoint); };