From 4ceec90b9eff4d7dad56735142f515840139b4ae Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 28 Apr 2012 04:18:00 +0200 Subject: [PATCH] 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. --- src/proc/engine/job-ticket.cpp | 95 ++++++++++++++++++++++++++++++++++ src/proc/engine/job-ticket.hpp | 19 +++---- src/proc/engine/job.cpp | 5 +- src/proc/engine/job.hpp | 5 +- 4 files changed, 108 insertions(+), 16 deletions(-) create mode 100644 src/proc/engine/job-ticket.cpp diff --git a/src/proc/engine/job-ticket.cpp b/src/proc/engine/job-ticket.cpp new file mode 100644 index 000000000..a5df9a262 --- /dev/null +++ b/src/proc/engine/job-ticket.cpp @@ -0,0 +1,95 @@ +/* + JobTicket - execution plan for render jobs + + Copyright (C) Lumiera.org + 2012, Hermann Vosseler + + 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 diff --git a/src/proc/engine/job-ticket.hpp b/src/proc/engine/job-ticket.hpp index 7d6b973c9..cbcaf04bb 100644 --- a/src/proc/engine/job-ticket.hpp +++ b/src/proc/engine/job-ticket.hpp @@ -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. diff --git a/src/proc/engine/job.cpp b/src/proc/engine/job.cpp index bc7bd0bd9..8db0a5c77 100644 --- a/src/proc/engine/job.cpp +++ b/src/proc/engine/job.cpp @@ -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()); - ; } diff --git a/src/proc/engine/job.hpp b/src/proc/engine/job.hpp index 2e60f3c98..e9cfddcbd 100644 --- a/src/proc/engine/job.hpp +++ b/src/proc/engine/job.hpp @@ -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);