bpmn++
A BPMN parser library, written in C++
Loading...
Searching...
No Matches
Scope.cpp
Go to the documentation of this file.
1#include "Scope.h"
2#include "FlowNode.h"
3#include "Activity.h"
6#include "EventSubProcess.h"
7#include "SequenceFlow.h"
8
9using namespace BPMN;
10
12 : Node(element)
13 , compensationEventSubProcess(nullptr)
14{
15}
16
17void Scope::add(std::unique_ptr<Node> node) {
18 childNodes.push_back(std::move(node));
19 auto& childNode = childNodes.back();
20 if ( auto flowNode = childNode.get()->represents<FlowNode>(); flowNode ) {
21 if ( flowNode->represents<CompensateBoundaryEvent>() ) {
22 // nothing to be done for CompensateBoundaryEvent
23 }
24 else if ( auto activity = flowNode->represents<Activity>();
25 activity && activity->isForCompensation
26 ) {
27 compensationActivities.push_back(activity);
28 }
29 else {
30 flowNodes.push_back(flowNode);
31 }
32 }
33 else if ( auto eventSubProcess = childNode.get()->represents<EventSubProcess>(); eventSubProcess ) {
34 // compensation event subprocesses are moved later
35 eventSubProcesses.push_back(eventSubProcess);
36 }
37 else {
38 throw std::logic_error("Scope: illegal child node '" + childNode.get()->id + "'");
39 }
40}
41
42void Scope::add(std::unique_ptr<SequenceFlow> sequenceFlow) {
43 sequenceFlows.push_back(std::move(sequenceFlow));
44}
45
46void Scope::add(std::unique_ptr<DataObject> dataObject) {
47 dataObjects.push_back(std::move(dataObject));
48}
49
bool isForCompensation
Definition Activity.h:22
Base class for BPMN elements that may contain incoming and outgoing sequence flows.
Definition FlowNode.h:20
Base class for all nodes in a BPMN model.
Definition Node.h:24
std::vector< Activity * > compensationActivities
Vector containing pointers to all compensation activities within the scope.
Definition Scope.h:45
std::vector< EventSubProcess * > eventSubProcesses
Vector containing pointers to all event subprocesses within the scope of the nodes.
Definition Scope.h:36
std::vector< FlowNode * > flowNodes
Vector containing pointers to all flow nodes within the scope of the nodes.
Definition Scope.h:33
Scope(XML::bpmn::tBaseElement *element)
Definition Scope.cpp:11
void add(std::unique_ptr< Node > node)
Definition Scope.cpp:17
std::vector< std::unique_ptr< SequenceFlow > > sequenceFlows
Vector containing all sequence flows within the scope.
Definition Scope.h:42
std::vector< std::unique_ptr< DataObject > > dataObjects
Vector containing all data objects within the scope.
Definition Scope.h:51
std::vector< std::unique_ptr< Node > > childNodes
Vector containing all child nodes within the scope of the nodes.
Definition Scope.h:30
The BPMN namespace contains linked classes representing a BPMN model.