BPMN-OS
BPMN for optimization and simulation
Loading...
Searching...
No Matches
DeterministicTaskCompletion.cpp
Go to the documentation of this file.
1
#include "
DeterministicTaskCompletion.h
"
2
#include "
execution/engine/src/events/CompletionEvent.h
"
3
#include <cassert>
4
5
using namespace
BPMNOS::Execution
;
6
7
DeterministicTaskCompletion::DeterministicTaskCompletion
()
8
{
9
}
10
11
std::shared_ptr<Event>
DeterministicTaskCompletion::dispatchEvent
(
const
SystemState
* systemState ) {
12
for
(
auto
[time,token_ptr] : systemState->
tokensAwaitingCompletionEvent
) {
13
if
( time <= systemState->getTime() ) {
14
if
(
auto
token = token_ptr.lock() ) {
15
assert( token );
16
return
std::make_shared<CompletionEvent>(token.get());
17
}
18
}
19
}
20
return
nullptr
;
21
}
CompletionEvent.h
DeterministicTaskCompletion.h
BPMNOS::Execution::DeterministicTaskCompletion::DeterministicTaskCompletion
DeterministicTaskCompletion()
Definition
DeterministicTaskCompletion.cpp:7
BPMNOS::Execution::DeterministicTaskCompletion::dispatchEvent
std::shared_ptr< Event > dispatchEvent(const SystemState *systemState) override
Definition
DeterministicTaskCompletion.cpp:11
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::tokensAwaitingCompletionEvent
auto_set< BPMNOS::number, std::weak_ptr< Token > > tokensAwaitingCompletionEvent
Sorted container holding all tokens awaiting a task completion event.
Definition
SystemState.h:77
BPMNOS::Execution
Definition
Controller.h:9