BPMN-OS
BPMN for optimization and simulation
Loading...
Searching...
No Matches
Signal.cpp
Go to the documentation of this file.
1#include "Signal.h"
2#include "ExtensionElements.h"
7
8using namespace BPMNOS::Model;
9
11 : BPMN::ExtensionElements( baseElement )
12 , parent(parent)
13 , attributeRegistry(parent->extensionElements->as<BPMNOS::Model::ExtensionElements>()->attributeRegistry)
14{
15 if ( !element ) return;
16
17 // get signal definition
18 if ( auto signal = element->getOptionalChild<XML::bpmnos::tSignal>(); signal.has_value() ) {
19 name = BPMNOS::to_number(signal.value().get().name.value.value,STRING);
20
21 for ( XML::bpmnos::tContent& content : signal.value().get().content ) {
22 contentMap.emplace(content.key.value.value,std::make_unique<Content>(&content,attributeRegistry));
23 }
24
26 // add data attributes modified by signal to dataUpdateOnCompletion (global values must not be updated by signals)
27 for ( auto& [key,content] : contentMap ) {
28 Attribute* attribute = content->attribute;
29 if ( attribute->category == Attribute::Category::DATA ) {
30 updatedData.push_back(attribute);
31 }
32 else if ( attribute->category == Attribute::Category::GLOBAL ) {
33 throw std::runtime_error("Signal: illegal update of global attribute'" + (std::string)attribute->id + "' for content '" + (std::string)content->key + "'.");
34 }
35 }
36 }
37 }
38}
39
Class holding extension elements representing execution data for nodes.
Represents a BPMN model with all its processes.
Definition Model.h:21
Signal(XML::bpmn::tBaseElement *baseElement, BPMN::Scope *parent)
Definition Signal.cpp:10
T * is()
Attempts to return the element in the specified type T.
Definition bpmn++.h:16305
BaseElement * baseElement
Reference to the base element the extension elements are bound to.
Definition bpmn++.h:16391
XML::bpmn::tExtensionElements * element
Definition bpmn++.h:16362
Base class for BPMN elements that may contain a ChildNode elements.
Definition bpmn++.h:16510
std::optional< std::reference_wrapper< T > > getOptionalChild()
Get an optional child of type T.
Definition bpmn++.h:288
The BPMN namespace contains linked classes representing a BPMN model.
Definition bpmn++.h:16221