2011-05-23 04:43:56 +02:00
|
|
|
/*
|
2011-05-23 05:46:40 +02:00
|
|
|
DISPATCHER.hpp - translating calculation streams into frame jobs
|
2011-05-23 04:43:56 +02:00
|
|
|
|
|
|
|
|
Copyright (C) Lumiera.org
|
2011-05-23 05:46:40 +02:00
|
|
|
2011, Hermann Vosseler <Ichthyostega@web.de>
|
2011-05-23 04:43:56 +02:00
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2011-05-23 05:46:40 +02:00
|
|
|
#ifndef PROC_ENGINE_DISPATCHER_H
|
|
|
|
|
#define PROC_ENGINE_DISPATCHER_H
|
2011-05-23 04:43:56 +02:00
|
|
|
|
|
|
|
|
#include "proc/common.hpp"
|
2012-02-09 22:24:05 +01:00
|
|
|
//#include "proc/state.hpp"
|
2012-02-24 00:29:59 +01:00
|
|
|
#include "proc/mobject/model-port.hpp"
|
2012-02-09 22:24:05 +01:00
|
|
|
#include "proc/engine/time-anchor.hpp"
|
|
|
|
|
#include "proc/engine/frame-coord.hpp"
|
2012-02-13 00:37:57 +01:00
|
|
|
#include "proc/engine/job-ticket.hpp"
|
2012-07-01 03:42:50 +02:00
|
|
|
#include "proc/engine/job-planning.hpp"
|
2011-05-23 04:43:56 +02:00
|
|
|
#include "lib/time/timevalue.hpp"
|
|
|
|
|
|
2012-02-04 22:20:21 +01:00
|
|
|
#include <boost/noncopyable.hpp>
|
2012-04-26 04:11:31 +02:00
|
|
|
#include <tr1/functional>
|
2011-05-23 04:43:56 +02:00
|
|
|
|
|
|
|
|
|
2011-12-02 16:10:03 +01:00
|
|
|
namespace proc {
|
2011-05-23 04:43:56 +02:00
|
|
|
namespace engine {
|
|
|
|
|
|
2012-04-26 04:11:31 +02:00
|
|
|
using std::tr1::function;
|
2012-02-24 00:29:59 +01:00
|
|
|
using mobject::ModelPort;
|
2011-05-28 01:46:06 +02:00
|
|
|
using lib::time::TimeSpan;
|
|
|
|
|
using lib::time::FSecs;
|
|
|
|
|
using lib::time::Time;
|
2011-05-23 05:46:40 +02:00
|
|
|
//
|
|
|
|
|
// class ExitNode;
|
2011-05-23 04:43:56 +02:00
|
|
|
|
|
|
|
|
/**
|
2011-12-17 02:20:48 +01:00
|
|
|
* @todo 11/11 extremely fuzzy at the moment
|
2011-05-23 04:43:56 +02:00
|
|
|
*/
|
2011-05-23 05:46:40 +02:00
|
|
|
class Dispatcher
|
2012-02-04 22:20:21 +01:00
|
|
|
: boost::noncopyable
|
2011-05-23 04:43:56 +02:00
|
|
|
{
|
2012-04-26 04:11:31 +02:00
|
|
|
struct JobBuilder
|
2012-02-24 00:29:59 +01:00
|
|
|
{
|
|
|
|
|
Dispatcher& dispatcher_;
|
|
|
|
|
ModelPort modelPort_;
|
|
|
|
|
uint channel_;
|
|
|
|
|
|
2012-10-06 02:29:19 +02:00
|
|
|
/////TODO need storage for the continuation
|
|
|
|
|
|
2012-04-26 04:11:31 +02:00
|
|
|
FrameCoord relativeFrameLocation (TimeAnchor refPoint, uint frameCountOffset);
|
|
|
|
|
|
|
|
|
|
JobBuilder& establishNextJobs (TimeAnchor refPoint);
|
|
|
|
|
|
|
|
|
|
JobBuilder& prepareContinuation (function<void(TimeAnchor)> delayedAction);
|
|
|
|
|
|
2012-07-01 03:42:50 +02:00
|
|
|
operator JobPlanningSequence()
|
2012-04-26 04:11:31 +02:00
|
|
|
{
|
|
|
|
|
UNIMPLEMENTED ("how to represent the closure for defining and scheduling jobs");
|
|
|
|
|
|
2012-10-06 02:29:19 +02:00
|
|
|
////////TODO: use a closure based on FrameCoord plus a back-reference to the Dispatcher.
|
|
|
|
|
//////////// Thus actually we need a *generator* for a sequence of FrameCoord
|
|
|
|
|
//////////// This generator is then wrapped up into an evaluation-Monad (IterExplorer)
|
2012-04-26 04:11:31 +02:00
|
|
|
}
|
|
|
|
|
|
2012-02-24 00:29:59 +01:00
|
|
|
};
|
2011-05-23 04:43:56 +02:00
|
|
|
|
|
|
|
|
public:
|
2012-02-04 22:20:21 +01:00
|
|
|
virtual ~Dispatcher(); ///< this is an interface
|
|
|
|
|
|
2012-04-26 04:11:31 +02:00
|
|
|
JobBuilder onCalcStream (ModelPort modelPort, uint channel);
|
2012-02-04 22:20:21 +01:00
|
|
|
|
2012-02-18 00:49:53 +01:00
|
|
|
JobTicket& accessJobTicket (FrameCoord const&);
|
2011-05-23 04:43:56 +02:00
|
|
|
|
2012-10-06 02:29:19 +02:00
|
|
|
protected:
|
|
|
|
|
virtual FrameCoord locateRelative (FrameCoord, uint frameCountOffset) =0;
|
|
|
|
|
virtual FrameCoord locateRelative (TimeAnchor, uint frameCountOffset) =0;
|
2011-05-23 04:43:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-12-02 16:10:03 +01:00
|
|
|
}} // namespace proc::engine
|
2011-05-23 04:43:56 +02:00
|
|
|
#endif
|