Files
WFR-lib/include/wfr/enactment/EnactmentEngine.h
T
2017-04-11 15:49:21 +02:00

67 lines
1.3 KiB
C++
Executable File

#pragma once
#include <wfr/common/types/LwdTypes.h>
#include <mutex>
#include <queue>
#include <memory>
#include <condition_variable>
namespace wfr {
//Forward declarations
namespace wfs {
class Workflow;
class ActivityInstance;
}
namespace wep {
class WorkflowExecutionPlan;
}
namespace scheduling {
class AbstractScheduler;
}
// Main namespace
namespace enactment {
class EnactmentEngine {
// Mutable properties that need to be accessed via getter-/setter-functions.
private:
std::shared_ptr<wep::WorkflowExecutionPlan> wep;
bool breakExecutionLoop = false;
std::queue<wfs::ActivityInstance*> updateQueue;
std::mutex updateMutex;
std::condition_variable updateCondition;
bool enableWepDotFileWriter;
bool enableEarlyEvaluation;
// Invariant properties that can be accessed directly.
public:
wfs::Workflow& workflow;
scheduling::AbstractScheduler& scheduler;
// Public static functions
public:
static void init(int argc, char** argv);
static void finish();
// Public functions
public:
EnactmentEngine(wfs::Workflow& workflow, scheduling::AbstractScheduler& scheduler) noexcept;
void workflowExecutionLoop(lwd::_wfr_lwd* input, lwd::_wfr_lwd* output);
void notifyActivityInstanceStateUpdate(wfs::ActivityInstance& ai, scheduling::AbstractScheduler& scheduler);
};
} /* namespace wep */
} /* namespace wfr */