bpmn++
A BPMN parser library, written in C++
Loading...
Searching...
No Matches
SequenceFlow.cpp
Go to the documentation of this file.
1#include "SequenceFlow.h"
2#include "FlowNode.h"
3#include "Scope.h"
4
5using namespace BPMN;
6
8 : BaseElement(sequenceFlow)
9 , element(sequenceFlow)
10 , source(findNode(sequenceFlow->sourceRef.value.value,scope))
11 , target(findNode(sequenceFlow->targetRef.value.value,scope))
12{
13 id = sequenceFlow->id.has_value() ? (std::string)sequenceFlow->id->get().value : "";
14}
15
16FlowNode* SequenceFlow::findNode(std::string& nodeId, Scope* scope) {
17 for ( auto& flowNode : scope->flowNodes ) {
18 if ( flowNode->get<>()->id.has_value() && nodeId == flowNode->get<>()->id->get().value.value ) {
19 return flowNode;
20 }
21 }
22
23 throw std::runtime_error("SequenceFlow: cannot find node '" + nodeId + "' within scope '" + scope->id + "'" );
24}
25
Base class for all core BPMN elements.
Definition BaseElement.h:15
std::string id
Id of element.
Definition BaseElement.h:23
Base class for BPMN elements that may contain incoming and outgoing sequence flows.
Definition FlowNode.h:20
Base class for BPMN elements that may contain a ChildNode elements.
Definition Scope.h:24
std::vector< FlowNode * > flowNodes
Vector containing pointers to all flow nodes within the scope of the nodes.
Definition Scope.h:33
FlowNode * findNode(std::string &id, Scope *scope)
SequenceFlow(XML::bpmn::tSequenceFlow *sequenceFlow, Scope *scope)
std::optional< std::reference_wrapper< Attribute > > id
Attribute value can be expected to be of type 'std::string'.
The BPMN namespace contains linked classes representing a BPMN model.