BPMN-OS
BPMN for optimization and simulation
Loading...
Searching...
No Matches
TaskCompletionHandler.cpp
Go to the documentation of this file.
5
6using namespace BPMNOS::Execution;
7
8std::shared_ptr<Event> TaskCompletionHandler::dispatchEvent(const SystemState* systemState) {
9 for (auto [time, token_ptr] : systemState->tokensAwaitingCompletionEvent) {
10 if (time <= systemState->getTime()) {
11 if (auto token = token_ptr.lock()) {
12 auto instanceId = token->getInstanceId();
13 auto status = systemState->scenario->getTaskCompletionStatus(instanceId, token->node);
14 return std::make_shared<CompletionEvent>(token.get(), std::move(status));
15 }
16 }
17 }
18 return nullptr;
19}
A class representing the state that the execution or simulation of a given scenario is in.
Definition SystemState.h:21
const BPMNOS::Model::Scenario * scenario
Pointer to the corresponding scenario.
Definition SystemState.h:32
auto_set< BPMNOS::number, std::weak_ptr< Token > > tokensAwaitingCompletionEvent
Sorted container holding all tokens awaiting a task completion event.
Definition SystemState.h:72
std::shared_ptr< Event > dispatchEvent(const SystemState *systemState) override
virtual BPMNOS::Values getTaskCompletionStatus(const BPMNOS::number instanceId, const BPMN::Node *task) const
Get the completion status for a task.
Definition Scenario.h:117