BPMN-OS
BPMN for optimization and simulation
Loading...
Searching...
No Matches
TaskCompletionHandler.cpp
Go to the documentation of this file.
1
#include "
TaskCompletionHandler.h
"
2
#include "
execution/engine/src/SystemState.h
"
3
#include "
execution/engine/src/Token.h
"
4
#include "
execution/engine/src/events/CompletionEvent.h
"
5
6
using namespace
BPMNOS::Execution
;
7
8
std::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
}
CompletionEvent.h
SystemState.h
TaskCompletionHandler.h
Token.h
BPMNOS::Execution::SystemState
A class representing the state that the execution or simulation of a given scenario is in.
Definition
SystemState.h:21
BPMNOS::Execution::SystemState::scenario
const BPMNOS::Model::Scenario * scenario
Pointer to the corresponding scenario.
Definition
SystemState.h:32
BPMNOS::Execution::SystemState::tokensAwaitingCompletionEvent
auto_set< BPMNOS::number, std::weak_ptr< Token > > tokensAwaitingCompletionEvent
Sorted container holding all tokens awaiting a task completion event.
Definition
SystemState.h:72
BPMNOS::Execution::TaskCompletionHandler::dispatchEvent
std::shared_ptr< Event > dispatchEvent(const SystemState *systemState) override
Definition
TaskCompletionHandler.cpp:8
BPMNOS::Model::Scenario::getTaskCompletionStatus
virtual BPMNOS::Values getTaskCompletionStatus(const BPMNOS::number instanceId, const BPMN::Node *task) const
Get the completion status for a task.
Definition
Scenario.h:117
BPMNOS::Execution
Definition
Controller.h:9