BPMN-OS
BPMN for optimization and simulation
Loading...
Searching...
No Matches
ExtensionElements.h
Go to the documentation of this file.
1#ifndef BPMNOS_Model_ExtensionElements_H
2#define BPMNOS_Model_ExtensionElements_H
3
4#include <memory>
5#include <vector>
6#include <string>
7#include <bpmn++.h>
8#include "Attribute.h"
9#include "AttributeRegistry.h"
10#include "Restriction.h"
11#include "Operator.h"
12#include "Choice.h"
13#include "MessageDefinition.h"
14#include "Guidance.h"
16
17namespace BPMNOS::Model {
18
19
20/**
21 * @brief Class holding extension elements representing execution data for nodes
22 **/
24public:
25 ExtensionElements(XML::bpmn::tBaseElement* baseElement, const AttributeRegistry attributeRegistry_, BPMN::Scope* parent = nullptr, std::vector<std::reference_wrapper<XML::bpmnos::tAttribute>> = {});
26 AttributeRegistry attributeRegistry; ///< Registry allowing to look up all status and data attributes by their names.
28
29// enum Index { Instance, Timestamp }; ///< Indices for instance and timestamp attribute.
30 struct Index {
31 static constexpr size_t Instance = 0;
32 static constexpr size_t Timestamp = 0;
33 };
34
35 std::vector< std::unique_ptr<Attribute> > attributes; ///< Vector containing new status attributes declared for the node.
36 std::vector< std::unique_ptr<Restriction> > restrictions; ///< Vector containing new restrictions provided for the node.
37 std::vector< std::unique_ptr<Operator> > operators;
38 std::vector< std::unique_ptr<Choice> > choices;
39
40 std::set<const Attribute*> entryDependencies; ///< Set containing all input attributes influencing the entry feasibility.
41 std::set<const Attribute*> exitDependencies; ///< Set containing all input attributes influencing the exit feasibility.
42 std::set<const Attribute*> operatorDependencies; ///< Set containing all input attributes influencing the result of applying all operators.
43 std::set<const Attribute*> choiceDependencies; ///< Set containing all input attributes influencing the result of making choices.
44
45 std::vector< std::unique_ptr<Attribute> > data; ///< Vector containing data attributes declared for data objects within the node's scope.
46
47 struct { std::vector<const Attribute*> attributes; bool global = false; } dataUpdate; ///< Struct containing data attributes that are modified through operators and a flag indicating whether a global value is changed.
48
49 std::vector< std::unique_ptr<MessageDefinition> > messageDefinitions; ///< Vector containing message definition(s) provided for the node.
50 const MessageDefinition* getMessageDefinition(size_t index) const;
51 const MessageDefinition* getMessageDefinition(const BPMNOS::Values& status) const;
52
53 std::vector< const BPMN::FlowNode* > messageCandidates; ///< Vector containing all potential sending or receiving nodes of a message.
54
55 std::vector< std::unique_ptr<Restriction> > conditions; ///< Vector containing conditions that may be provided for conditional events.
56
57 std::optional< std::unique_ptr<Parameter> > loopCardinality; ///< Number of instances to be generated.
58 std::optional< std::unique_ptr<Parameter> > loopIndex; ///< Attribute holding the automatically generated loop index.
59 std::optional< std::unique_ptr<Parameter> > loopCondition; ///< Boolean attribute indicating whether an exit condition holds.
60 std::optional< std::unique_ptr<Parameter> > loopMaximum; ///< Maximum number of iterations of a standard loop (requires loopIndex).
61
62 bool hasSequentialPerformer; ///< Boolean indicating whether element has a performer with name "Sequential".
63
64 template <typename DataType>
65 bool feasibleEntry(const BPMNOS::Values& status, const DataType& data, const BPMNOS::Values& globals) const;
66
67 template <typename DataType>
68 bool feasibleExit(const BPMNOS::Values& status, const DataType& data, const BPMNOS::Values& globals) const;
69
70 template <typename DataType>
71 bool satisfiesInheritedRestrictions(const BPMNOS::Values& status, const DataType& data, const BPMNOS::Values& globals) const;
72
73 template <typename DataType>
74 bool fullScopeRestrictionsSatisfied(const BPMNOS::Values& status, const DataType& data, const BPMNOS::Values& globals) const;
75
76 bool isInstantaneous; ///< Boolean indicating whether operators may modify timestamp.
77
78 template <typename DataType>
79 void computeInitialValues(BPMNOS::number currentTime, BPMNOS::Values& status, DataType& data, BPMNOS::Values& globals) const;
80
81 template <typename DataType>
82 void applyOperators(BPMNOS::Values& status, DataType& data, BPMNOS::Values& globals) const;
83
84 template <typename DataType>
85 BPMNOS::number getObjective(const BPMNOS::Values& status, const DataType& data, const BPMNOS::Values& globals) const; ///< Returns the total objective of all attributes provided.
86
87 template <typename DataType>
88 BPMNOS::number getContributionToObjective(const BPMNOS::Values& status, const DataType& data, const BPMNOS::Values& globals) const; ///< Returns the contribution to the objective by the attributes declared for the node.
89
90 std::optional< std::unique_ptr<Guidance> > messageDeliveryGuidance;
91 std::optional< std::unique_ptr<Guidance> > entryGuidance;
92 std::optional< std::unique_ptr<Guidance> > exitGuidance;
93 std::optional< std::unique_ptr<Guidance> > choiceGuidance;
94};
95
96} // namespace BPMNOS::Model
97
98#endif // BPMNOS_Model_ExtensionElements_H
Class holding extension elements representing execution data for nodes.
std::vector< std::unique_ptr< Operator > > operators
std::vector< const Attribute * > attributes
std::set< const Attribute * > operatorDependencies
Set containing all input attributes influencing the result of applying all operators.
std::vector< std::unique_ptr< Attribute > > attributes
Vector containing new status attributes declared for the node.
std::vector< std::unique_ptr< Restriction > > conditions
Vector containing conditions that may be provided for conditional events.
bool feasibleExit(const BPMNOS::Values &status, const DataType &data, const BPMNOS::Values &globals) const
void computeInitialValues(BPMNOS::number currentTime, BPMNOS::Values &status, DataType &data, BPMNOS::Values &globals) const
bool fullScopeRestrictionsSatisfied(const BPMNOS::Values &status, const DataType &data, const BPMNOS::Values &globals) const
struct BPMNOS::Model::ExtensionElements::@0 dataUpdate
Struct containing data attributes that are modified through operators and a flag indicating whether a...
BPMNOS::number getObjective(const BPMNOS::Values &status, const DataType &data, const BPMNOS::Values &globals) const
Returns the total objective of all attributes provided.
std::set< const Attribute * > exitDependencies
Set containing all input attributes influencing the exit feasibility.
bool isInstantaneous
Boolean indicating whether operators may modify timestamp.
std::optional< std::unique_ptr< Guidance > > messageDeliveryGuidance
std::optional< std::unique_ptr< Guidance > > choiceGuidance
std::optional< std::unique_ptr< Guidance > > exitGuidance
bool satisfiesInheritedRestrictions(const BPMNOS::Values &status, const DataType &data, const BPMNOS::Values &globals) const
ExtensionElements(XML::bpmn::tBaseElement *baseElement, const AttributeRegistry attributeRegistry_, BPMN::Scope *parent=nullptr, std::vector< std::reference_wrapper< XML::bpmnos::tAttribute > >={})
std::optional< std::unique_ptr< Parameter > > loopCardinality
Number of instances to be generated.
std::optional< std::unique_ptr< Guidance > > entryGuidance
bool feasibleEntry(const BPMNOS::Values &status, const DataType &data, const BPMNOS::Values &globals) const
BPMNOS::number getContributionToObjective(const BPMNOS::Values &status, const DataType &data, const BPMNOS::Values &globals) const
Returns the contribution to the objective by the attributes declared for the node.
std::optional< std::unique_ptr< Parameter > > loopIndex
Attribute holding the automatically generated loop index.
std::optional< std::unique_ptr< Parameter > > loopCondition
Boolean attribute indicating whether an exit condition holds.
std::vector< const BPMN::FlowNode * > messageCandidates
Vector containing all potential sending or receiving nodes of a message.
std::set< const Attribute * > choiceDependencies
Set containing all input attributes influencing the result of making choices.
std::vector< std::unique_ptr< Choice > > choices
std::set< const Attribute * > entryDependencies
Set containing all input attributes influencing the entry feasibility.
void applyOperators(BPMNOS::Values &status, DataType &data, BPMNOS::Values &globals) const
const MessageDefinition * getMessageDefinition(size_t index) const
std::vector< std::unique_ptr< Restriction > > restrictions
Vector containing new restrictions provided for the node.
AttributeRegistry attributeRegistry
Registry allowing to look up all status and data attributes by their names.
bool hasSequentialPerformer
Boolean indicating whether element has a performer with name "Sequential".
std::vector< std::unique_ptr< MessageDefinition > > messageDefinitions
Vector containing message definition(s) provided for the node.
std::vector< std::unique_ptr< Attribute > > data
Vector containing data attributes declared for data objects within the node's scope.
std::optional< std::unique_ptr< Parameter > > loopMaximum
Maximum number of iterations of a standard loop (requires loopIndex).
Base class for extension elements that may be provided for a BPMN element.
Definition bpmn++.h:16358
BaseElement * baseElement
Reference to the base element the extension elements are bound to.
Definition bpmn++.h:16391
Base class for BPMN elements that may contain a ChildNode elements.
Definition bpmn++.h:16510
BPMNOS_NUMBER_TYPE number
Definition Number.h:42