design decision how to invoke a job
without any trickery, we'll always get two indirections. Thus, the decision is to turn the 2nd indirection into a VTable call; this way, basically the JobClosure also acts as job functor itself.
This commit is contained in:
parent
0320bc4b2c
commit
4ceec90b9e
4 changed files with 108 additions and 16 deletions
95
src/proc/engine/job-ticket.cpp
Normal file
95
src/proc/engine/job-ticket.cpp
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
JobTicket - execution plan for render jobs
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2012, Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
* *****************************************************/
|
||||
|
||||
|
||||
/** @file job-ticket.cpp
|
||||
** Implementation details of preparing and performing job invocations.
|
||||
**
|
||||
** @todo WIP-WIP-WIP 3/2012
|
||||
** @see Job
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#include "proc/engine/job-ticket.hpp"
|
||||
|
||||
|
||||
namespace proc {
|
||||
namespace engine {
|
||||
|
||||
namespace { // Details...
|
||||
|
||||
} // (END) Details...
|
||||
|
||||
|
||||
// using mobject::Placement;
|
||||
// using mobject::session::Effect;
|
||||
|
||||
|
||||
JobClosure::~JobClosure() { }
|
||||
|
||||
|
||||
|
||||
class FrameJobClosure
|
||||
: public JobClosure
|
||||
{
|
||||
// data members?
|
||||
|
||||
private: /* === JobClosure Interface === */
|
||||
|
||||
JobKind
|
||||
getJobKind() const
|
||||
{
|
||||
return CALC_JOB;
|
||||
}
|
||||
|
||||
bool
|
||||
verify (Time nominalJobTime) const
|
||||
{
|
||||
UNIMPLEMENTED ("access the underlying JobTicket and verify the given job time is within the relevant timeline segment");
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
invokeJobOperation (JobParameter parameter)
|
||||
{
|
||||
UNIMPLEMENTED ("representation of the job functor");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
signalFailure (JobParameter parameter)
|
||||
{
|
||||
UNIMPLEMENTED ("what needs to be done when a job cant be invoked?");
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** */
|
||||
|
||||
|
||||
}} // namespace proc::engine
|
||||
|
|
@ -56,23 +56,18 @@ namespace engine {
|
|||
: public lumiera_jobClosure
|
||||
{
|
||||
public:
|
||||
virtual ~JobClosure(); ///< this is an interface
|
||||
|
||||
JobKind
|
||||
getJobKind() const
|
||||
{
|
||||
UNIMPLEMENTED ("representation of JobTicket and JobClosure");
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
verify (Time nominalJobTime) const
|
||||
{
|
||||
UNIMPLEMENTED ("access the underlying JobTicket and verify the given job time is within the relevant timeline segment");
|
||||
return false;
|
||||
}
|
||||
virtual void invokeJobOperation (JobParameter parameter) =0;
|
||||
virtual void signalFailure (JobParameter parameter) =0;
|
||||
|
||||
JobKind getJobKind() const =0;
|
||||
bool verify (Time nominalJobTime) const =0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* execution plan for pulling a specific exit node.
|
||||
* Usable as blue print for generating actual render jobs.
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ namespace engine {
|
|||
void
|
||||
Job::triggerJob () const
|
||||
{
|
||||
UNIMPLEMENTED ("how to access the JobTicket and build the RenderInvocation");
|
||||
myClosure(this).invokeJobOperation (parameter);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -82,7 +82,7 @@ namespace engine {
|
|||
Job::getKind() const
|
||||
{
|
||||
REQUIRE (isValid());
|
||||
myClosure(this).getJobKind();
|
||||
return myClosure(this).getJobKind();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -96,7 +96,6 @@ namespace engine {
|
|||
return this->jobClosure
|
||||
&& this->parameter.invoKey > 0
|
||||
&& myClosure(this).verify (getNominalTime());
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -135,6 +135,9 @@ using lib::time::Time;
|
|||
//
|
||||
//class ExitNode;
|
||||
|
||||
typedef lumiera_jobParameter const& JobParameter;
|
||||
|
||||
|
||||
/**
|
||||
* Frame rendering task, represented as closure.
|
||||
* This functor encodes all information necessary to trigger
|
||||
|
|
@ -201,7 +204,7 @@ void lumiera_job_invoke (lumiera_jobDefinition);
|
|||
/** signal inability to invoke this job
|
||||
* @todo decide what and how to communicate details of the failure
|
||||
* @remarks the purpose of this function is to allow for reliable checkpoints
|
||||
* within the network of dependent jobs invocations, even after
|
||||
* within the network of dependent job invocations, even after
|
||||
* missing deadlines or aborting a sequence of jobs */
|
||||
void lumiera_job_failure (lumiera_jobDefinition);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue