BPMN-OS
BPMN for optimization and simulation
Loading...
Searching...
No Matches
Model.h
Go to the documentation of this file.
1#ifndef BPMNOS_Model_Model_H
2#define BPMNOS_Model_Model_H
3
4#include <memory>
5#include <vector>
6#include <string>
7#include <bpmn++.h>
8#include <limex.h>
14
15namespace BPMNOS::Model {
16
17/**
18 * @brief Represents a BPMN model with all its processes.
19 *
20 * The `Model` class encapsulates all processes with their nodes and sequence flows of a BPMN model.
21 */
22class Model : public BPMN::Model {
23public:
24 Model(const std::string filename, const std::vector<std::string> folders = {});
25 const std::string filename; ///< File name of the BPMN model
26 const std::vector<std::string> folders; ///< Folders containing lookup tables
27 LIMEX::Handle<double> limexHandle;
28
29 std::vector<std::reference_wrapper<XML::bpmnos::tAttribute>> getAttributes(XML::bpmn::tBaseElement* element);
30 std::vector<std::reference_wrapper<XML::bpmnos::tAttribute>> getData(XML::bpmn::tBaseElement* element);
31
32 std::unique_ptr<LookupTable> createLookupTable(XML::bpmnos::tTable* table);
33 std::unique_ptr<XML::XMLObject> createRoot(const std::string& filename) override;
34
35 std::unique_ptr<BPMN::Process> createProcess(XML::bpmn::tProcess* process) override;
36 std::unique_ptr<BPMN::EventSubProcess> createEventSubProcess(XML::bpmn::tSubProcess* subProcess, BPMN::Scope* parent) override;
37 std::unique_ptr<BPMN::FlowNode> createActivity(XML::bpmn::tActivity* activity, BPMN::Scope* parent) override;
38 std::unique_ptr<BPMN::SequenceFlow> createSequenceFlow(XML::bpmn::tSequenceFlow* sequenceFlow, BPMN::Scope* scope) override;
39 std::unique_ptr<BPMN::FlowNode> createAdHocSubProcess(XML::bpmn::tAdHocSubProcess* adHocSubProcess, BPMN::Scope* parent) override;
40 std::unique_ptr<BPMN::FlowNode> createTask(XML::bpmn::tTask* task, BPMN::Scope* parent) override;
41
42 std::unique_ptr<BPMN::FlowNode> createTimerStartEvent(XML::bpmn::tStartEvent* startEvent, BPMN::Scope* parent) override;
43 std::unique_ptr<BPMN::FlowNode> createTimerBoundaryEvent(XML::bpmn::tBoundaryEvent* boundaryEvent, BPMN::Scope* parent) override;
44 std::unique_ptr<BPMN::FlowNode> createTimerCatchEvent(XML::bpmn::tCatchEvent* catchEvent, BPMN::Scope* parent) override;
45
46 std::unique_ptr<BPMN::FlowNode> createSignalStartEvent(XML::bpmn::tStartEvent* startEvent, BPMN::Scope* parent) override;
47 std::unique_ptr<BPMN::FlowNode> createSignalBoundaryEvent(XML::bpmn::tBoundaryEvent* boundaryEvent, BPMN::Scope* parent) override;
48 std::unique_ptr<BPMN::FlowNode> createSignalCatchEvent(XML::bpmn::tCatchEvent* catchEvent, BPMN::Scope* parent) override;
49 std::unique_ptr<BPMN::FlowNode> createSignalThrowEvent(XML::bpmn::tThrowEvent* throwEvent, BPMN::Scope* parent) override;
50
51 std::unique_ptr<BPMN::FlowNode> createConditionalStartEvent(XML::bpmn::tStartEvent* startEvent, BPMN::Scope* parent) override;
52 std::unique_ptr<BPMN::FlowNode> createConditionalBoundaryEvent(XML::bpmn::tBoundaryEvent* boundaryEvent, BPMN::Scope* parent) override;
53 std::unique_ptr<BPMN::FlowNode> createConditionalCatchEvent(XML::bpmn::tCatchEvent* catchEvent, BPMN::Scope* parent) override;
54
55 std::unique_ptr<BPMN::FlowNode> createMessageStartEvent(XML::bpmn::tStartEvent* startEvent, BPMN::Scope* parent) override;
56 std::unique_ptr<BPMN::FlowNode> createMessageBoundaryEvent(XML::bpmn::tBoundaryEvent* boundaryEvent, BPMN::Scope* parent) override;
57 std::unique_ptr<BPMN::FlowNode> createMessageCatchEvent(XML::bpmn::tCatchEvent* catchEvent, BPMN::Scope* parent) override;
58 std::unique_ptr<BPMN::FlowNode> createMessageThrowEvent(XML::bpmn::tThrowEvent* throwEvent, BPMN::Scope* parent) override;
59
60 void createMessageFlows() override;
61 bool messageMayBeCaught( BPMN::Process* sendingProcess, BPMN::FlowNode* throwingMessageEvent, BPMN::Process* receivingProcess, BPMN::FlowNode* catchingMessageEvent );
62 bool messageMayBeThrown( BPMN::Process* sendingProcess, BPMN::FlowNode* throwingMessageEvent, BPMN::Process* receivingProcess, BPMN::FlowNode* catchingMessageEvent );
63 void createMessageCandidates( BPMN::Process* sendingProcess, BPMN::FlowNode* throwingMessageEvent, BPMN::Process* receivingProcess, BPMN::FlowNode* catchingMessageEvent );
64 std::vector<BPMN::MessageFlow*>& determineMessageFlows(BPMN::FlowNode* messageEvent, auto getMessageFlows);
65
66 static bool hasSequentialPerformer(const std::vector< std::reference_wrapper<XML::bpmn::tResourceRole> >& resources);
67
68 AttributeRegistry attributeRegistry; ///< Registry allowing to look up all status and data attributes by their names.
69 std::vector< std::unique_ptr<LookupTable> > lookupTables; ///< Vector containing lookup tables declared in model.
70 std::vector< std::unique_ptr<Attribute> > attributes; ///< Vector containing new global attributes declared for the model.
71};
72
73} // namespace BPMNOS::Model
74
75#endif // BPMNOS_Model_Model_H
Represents a BPMN model with all its processes.
Definition Model.h:22
std::unique_ptr< BPMN::FlowNode > createTimerStartEvent(XML::bpmn::tStartEvent *startEvent, BPMN::Scope *parent) override
Definition Model.cpp:176
std::unique_ptr< BPMN::FlowNode > createSignalCatchEvent(XML::bpmn::tCatchEvent *catchEvent, BPMN::Scope *parent) override
Definition Model.cpp:216
void createMessageCandidates(BPMN::Process *sendingProcess, BPMN::FlowNode *throwingMessageEvent, BPMN::Process *receivingProcess, BPMN::FlowNode *catchingMessageEvent)
Definition Model.cpp:477
std::unique_ptr< BPMN::FlowNode > createSignalThrowEvent(XML::bpmn::tThrowEvent *throwEvent, BPMN::Scope *parent) override
Definition Model.cpp:224
std::unique_ptr< BPMN::FlowNode > createSignalBoundaryEvent(XML::bpmn::tBoundaryEvent *boundaryEvent, BPMN::Scope *parent) override
Definition Model.cpp:208
std::unique_ptr< LookupTable > createLookupTable(XML::bpmnos::tTable *table)
Definition Model.cpp:59
std::vector< std::reference_wrapper< XML::bpmnos::tAttribute > > getData(XML::bpmn::tBaseElement *element)
Definition Model.cpp:41
std::vector< std::reference_wrapper< XML::bpmnos::tAttribute > > getAttributes(XML::bpmn::tBaseElement *element)
Definition Model.cpp:29
std::vector< BPMN::MessageFlow * > & determineMessageFlows(BPMN::FlowNode *messageEvent, auto getMessageFlows)
Definition Model.cpp:372
std::unique_ptr< BPMN::SequenceFlow > createSequenceFlow(XML::bpmn::tSequenceFlow *sequenceFlow, BPMN::Scope *scope) override
Definition Model.cpp:148
std::unique_ptr< BPMN::FlowNode > createMessageBoundaryEvent(XML::bpmn::tBoundaryEvent *boundaryEvent, BPMN::Scope *parent) override
Definition Model.cpp:292
std::unique_ptr< XML::XMLObject > createRoot(const std::string &filename) override
Definition Model.cpp:65
std::vector< std::unique_ptr< Attribute > > attributes
Vector containing new global attributes declared for the model.
Definition Model.h:70
void createMessageFlows() override
Definition Model.cpp:340
std::unique_ptr< BPMN::FlowNode > createMessageStartEvent(XML::bpmn::tStartEvent *startEvent, BPMN::Scope *parent) override
Definition Model.cpp:256
bool messageMayBeThrown(BPMN::Process *sendingProcess, BPMN::FlowNode *throwingMessageEvent, BPMN::Process *receivingProcess, BPMN::FlowNode *catchingMessageEvent)
Definition Model.cpp:435
std::unique_ptr< BPMN::Process > createProcess(XML::bpmn::tProcess *process) override
Definition Model.cpp:104
std::unique_ptr< BPMN::FlowNode > createConditionalCatchEvent(XML::bpmn::tCatchEvent *catchEvent, BPMN::Scope *parent) override
Definition Model.cpp:248
std::unique_ptr< BPMN::FlowNode > createAdHocSubProcess(XML::bpmn::tAdHocSubProcess *adHocSubProcess, BPMN::Scope *parent) override
Definition Model.cpp:156
const std::string filename
File name of the BPMN model.
Definition Model.h:25
bool messageMayBeCaught(BPMN::Process *sendingProcess, BPMN::FlowNode *throwingMessageEvent, BPMN::Process *receivingProcess, BPMN::FlowNode *catchingMessageEvent)
Definition Model.cpp:393
std::unique_ptr< BPMN::FlowNode > createMessageCatchEvent(XML::bpmn::tCatchEvent *catchEvent, BPMN::Scope *parent) override
Definition Model.cpp:312
const std::vector< std::string > folders
Folders containing lookup tables.
Definition Model.h:26
std::unique_ptr< BPMN::FlowNode > createTimerCatchEvent(XML::bpmn::tCatchEvent *catchEvent, BPMN::Scope *parent) override
Definition Model.cpp:192
std::unique_ptr< BPMN::FlowNode > createMessageThrowEvent(XML::bpmn::tThrowEvent *throwEvent, BPMN::Scope *parent) override
Definition Model.cpp:332
AttributeRegistry attributeRegistry
Registry allowing to look up all status and data attributes by their names.
Definition Model.h:68
std::unique_ptr< BPMN::FlowNode > createConditionalBoundaryEvent(XML::bpmn::tBoundaryEvent *boundaryEvent, BPMN::Scope *parent) override
Definition Model.cpp:240
std::unique_ptr< BPMN::FlowNode > createActivity(XML::bpmn::tActivity *activity, BPMN::Scope *parent) override
Definition Model.cpp:118
LIMEX::Handle< double > limexHandle
Definition Model.h:27
std::vector< std::unique_ptr< LookupTable > > lookupTables
Vector containing lookup tables declared in model.
Definition Model.h:69
std::unique_ptr< BPMN::FlowNode > createSignalStartEvent(XML::bpmn::tStartEvent *startEvent, BPMN::Scope *parent) override
Definition Model.cpp:200
std::unique_ptr< BPMN::FlowNode > createTask(XML::bpmn::tTask *task, BPMN::Scope *parent) override
Definition Model.cpp:160
std::unique_ptr< BPMN::FlowNode > createConditionalStartEvent(XML::bpmn::tStartEvent *startEvent, BPMN::Scope *parent) override
Definition Model.cpp:232
std::unique_ptr< BPMN::FlowNode > createTimerBoundaryEvent(XML::bpmn::tBoundaryEvent *boundaryEvent, BPMN::Scope *parent) override
Definition Model.cpp:184
std::unique_ptr< BPMN::EventSubProcess > createEventSubProcess(XML::bpmn::tSubProcess *subProcess, BPMN::Scope *parent) override
Definition Model.cpp:111
static bool hasSequentialPerformer(const std::vector< std::reference_wrapper< XML::bpmn::tResourceRole > > &resources)
Definition Model.cpp:521
Base class for BPMN elements that may contain incoming and outgoing sequence flows.
Definition bpmn++.h:16694
Represents a BPMN model with all its processes and message flows.
Definition bpmn++.h:17948
Base class for BPMN elements that may contain a ChildNode elements.
Definition bpmn++.h:16510