BPMN-OS
BPMN for optimization and simulation
Loading...
Searching...
No Matches
BestFirstExit.cpp
Go to the documentation of this file.
1#include "BestFirstExit.h"
3#include <cassert>
4
5using namespace BPMNOS::Execution;
6
8 : GreedyDispatcher(evaluator)
9{
10}
11
13 mediator->addSubscriber(this,
15 );
17}
18
19void BestFirstExit::notice(const Observable* observable) {
20 if ( observable->getObservableType() == Observable::Type::ExitRequest ) {
21 assert( dynamic_cast<const DecisionRequest*>(observable) );
22 auto request = static_cast<const DecisionRequest*>(observable);
23 auto decision = std::make_shared<ExitDecision>(request->token, evaluator);
24 decisionsWithoutEvaluation.emplace_back( request->token->weak_from_this(), request->weak_from_this(), decision );
25 }
26 else {
27 GreedyDispatcher::notice(observable);
28 }
29}
30
31
void notice(const Observable *observable) override
BestFirstExit(Evaluator *evaluator)
void connect(Mediator *mediator) override
Represents an abstract base class for a pending Evaluator.
Definition Evaluator.h:15
Class for dispatching the event with the best evaluation.
void notice(const Observable *observable) override
void connect(Mediator *mediator) override
void addSubscriber(Observer *subscriber, ObservableTypes... observableTypes)
Definition Notifier.h:16
Represents a pending decision.
Represents an abstract base class for a class that is an event listener and notifier.
Definition Mediator.h:13
virtual constexpr Type getObservableType() const =0