BPMN-OS
BPMN for optimization and simulation
Loading...
Searching...
No Matches
Choice.h
Go to the documentation of this file.
1#ifndef BPMNOS_Model_Choice_H
2#define BPMNOS_Model_Choice_H
3
4#include <memory>
5#include <vector>
6#include <variant>
7#include <string>
8#include <bpmn++.h>
10#include "Attribute.h"
11#include "Expression.h"
12#include "AttributeRegistry.h"
13
14namespace BPMNOS::Model {
15
16/**
17 * @brief Class representing a choice to be made within a @ref BPMNOS::Model::DecisionTask.
18 *
19 * The choice to be made may be restricted through @ref BPMNOS::Model::Restriction "restrictions".
20 */
21class Choice {
22public:
27 std::optional< std::pair<std::unique_ptr<Expression>,bool> > lowerBound; // lower bound and flag indicating strict inequality
28 std::optional< std::pair<std::unique_ptr<Expression>,bool> > upperBound; // upper bound and flag indicating strict inequality
29 std::unique_ptr<Expression> multipleOf;
30 std::vector< std::unique_ptr<Expression> > enumeration;
31 std::set<const Attribute*> dependencies; // set of attribute used as input to lower bound, upper bound, or enumeration
32
33 template <typename DataType>
34 std::pair<BPMNOS::number,BPMNOS::number> getBounds(const BPMNOS::Values& status, const DataType& data, const BPMNOS::Values& globals) const; ///< Returns the minimal and maximal value the attribute may take.
35
36 template <typename DataType>
37 std::vector<BPMNOS::number> getEnumeration(const BPMNOS::Values& status, const DataType& data, const BPMNOS::Values& globals) const; ///< Returns the allowed values the attribute may take.
38private:
39 void parseEnumeration(const std::string& input);
40 void parseBounds(const std::string& input);
41 void parseDiscretizer(const std::string& input);
42};
43
44} // namespace BPMNOS::Model
45
46#endif // BPMNOS_Model_Choice_H
Class representing a choice to be made within a BPMNOS::Model::DecisionTask.
Definition Choice.h:21
std::optional< std::pair< std::unique_ptr< Expression >, bool > > upperBound
Definition Choice.h:28
std::set< const Attribute * > dependencies
Definition Choice.h:31
Choice(XML::bpmnos::tDecision *decision, const AttributeRegistry &attributeRegistry)
Definition Choice.cpp:10
std::optional< std::pair< std::unique_ptr< Expression >, bool > > lowerBound
Definition Choice.h:27
std::pair< BPMNOS::number, BPMNOS::number > getBounds(const BPMNOS::Values &status, const DataType &data, const BPMNOS::Values &globals) const
Returns the minimal and maximal value the attribute may take.
Definition Choice.cpp:159
std::vector< BPMNOS::number > getEnumeration(const BPMNOS::Values &status, const DataType &data, const BPMNOS::Values &globals) const
Returns the allowed values the attribute may take.
Definition Choice.cpp:188
XML::bpmnos::tDecision * element
Definition Choice.h:24
Attribute * attribute
Definition Choice.h:26
const AttributeRegistry & attributeRegistry
Definition Choice.h:25
std::unique_ptr< Expression > multipleOf
Definition Choice.h:29
std::vector< std::unique_ptr< Expression > > enumeration
Definition Choice.h:30