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>
13
14namespace BPMNOS::Model {
15
16/**
17 * @brief Represents a BPMN model with all its processes.
18 *
19 * The `Model` class encapsulates all processes with their nodes and sequence flows of a BPMN model.
20 */
21class Model : public BPMN::Model {
22public:
23 Model(const std::string filename, const std::vector<std::string> folders = {});
24 ~Model();
25 const std::string filename; ///< File name of the BPMN model
26 const std::vector<std::string> folders; ///< Folders containing lookup tables
27
28public:
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:21
std::unique_ptr< BPMN::FlowNode > createTimerStartEvent(XML::bpmn::tStartEvent *startEvent, BPMN::Scope *parent) override
Definition Model.cpp:185
std::unique_ptr< BPMN::FlowNode > createSignalCatchEvent(XML::bpmn::tCatchEvent *catchEvent, BPMN::Scope *parent) override
Definition Model.cpp:225
void createMessageCandidates(BPMN::Process *sendingProcess, BPMN::FlowNode *throwingMessageEvent, BPMN::Process *receivingProcess, BPMN::FlowNode *catchingMessageEvent)
Definition Model.cpp:486
std::unique_ptr< BPMN::FlowNode > createSignalThrowEvent(XML::bpmn::tThrowEvent *throwEvent, BPMN::Scope *parent) override
Definition Model.cpp:233
std::unique_ptr< BPMN::FlowNode > createSignalBoundaryEvent(XML::bpmn::tBoundaryEvent *boundaryEvent, BPMN::Scope *parent) override
Definition Model.cpp:217
std::unique_ptr< LookupTable > createLookupTable(XML::bpmnos::tTable *table)
Definition Model.cpp:64
std::vector< std::reference_wrapper< XML::bpmnos::tAttribute > > getData(XML::bpmn::tBaseElement *element)
Definition Model.cpp:46
std::vector< std::reference_wrapper< XML::bpmnos::tAttribute > > getAttributes(XML::bpmn::tBaseElement *element)
Definition Model.cpp:34
std::vector< BPMN::MessageFlow * > & determineMessageFlows(BPMN::FlowNode *messageEvent, auto getMessageFlows)
Definition Model.cpp:381
std::unique_ptr< BPMN::SequenceFlow > createSequenceFlow(XML::bpmn::tSequenceFlow *sequenceFlow, BPMN::Scope *scope) override
Definition Model.cpp:157
std::unique_ptr< BPMN::FlowNode > createMessageBoundaryEvent(XML::bpmn::tBoundaryEvent *boundaryEvent, BPMN::Scope *parent) override
Definition Model.cpp:301
std::unique_ptr< XML::XMLObject > createRoot(const std::string &filename) override
Definition Model.cpp:70
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:349
std::unique_ptr< BPMN::FlowNode > createMessageStartEvent(XML::bpmn::tStartEvent *startEvent, BPMN::Scope *parent) override
Definition Model.cpp:265
bool messageMayBeThrown(BPMN::Process *sendingProcess, BPMN::FlowNode *throwingMessageEvent, BPMN::Process *receivingProcess, BPMN::FlowNode *catchingMessageEvent)
Definition Model.cpp:444
std::unique_ptr< BPMN::Process > createProcess(XML::bpmn::tProcess *process) override
Definition Model.cpp:113
std::unique_ptr< BPMN::FlowNode > createConditionalCatchEvent(XML::bpmn::tCatchEvent *catchEvent, BPMN::Scope *parent) override
Definition Model.cpp:257
std::unique_ptr< BPMN::FlowNode > createAdHocSubProcess(XML::bpmn::tAdHocSubProcess *adHocSubProcess, BPMN::Scope *parent) override
Definition Model.cpp:165
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:402
std::unique_ptr< BPMN::FlowNode > createMessageCatchEvent(XML::bpmn::tCatchEvent *catchEvent, BPMN::Scope *parent) override
Definition Model.cpp:321
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:201
std::unique_ptr< BPMN::FlowNode > createMessageThrowEvent(XML::bpmn::tThrowEvent *throwEvent, BPMN::Scope *parent) override
Definition Model.cpp:341
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:249
std::unique_ptr< BPMN::FlowNode > createActivity(XML::bpmn::tActivity *activity, BPMN::Scope *parent) override
Definition Model.cpp:127
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:209
std::unique_ptr< BPMN::FlowNode > createTask(XML::bpmn::tTask *task, BPMN::Scope *parent) override
Definition Model.cpp:169
std::unique_ptr< BPMN::FlowNode > createConditionalStartEvent(XML::bpmn::tStartEvent *startEvent, BPMN::Scope *parent) override
Definition Model.cpp:241
std::unique_ptr< BPMN::FlowNode > createTimerBoundaryEvent(XML::bpmn::tBoundaryEvent *boundaryEvent, BPMN::Scope *parent) override
Definition Model.cpp:193
std::unique_ptr< BPMN::EventSubProcess > createEventSubProcess(XML::bpmn::tSubProcess *subProcess, BPMN::Scope *parent) override
Definition Model.cpp:120
static bool hasSequentialPerformer(const std::vector< std::reference_wrapper< XML::bpmn::tResourceRole > > &resources)
Definition Model.cpp:530
Base class for BPMN elements that may contain incoming and outgoing sequence flows.
Definition bpmn++.h:16670
Represents a BPMN model with all its processes and message flows.
Definition bpmn++.h:17924
Base class for BPMN elements that may contain a ChildNode elements.
Definition bpmn++.h:16510