BPMN-OS
BPMN for optimization and simulation
Loading...
Searching...
No Matches
Expression.h
Go to the documentation of this file.
1#ifndef BPMNOS_Model_Expression_H
2#define BPMNOS_Model_Expression_H
3
4#include <limex.h>
5#include <set>
6
7#include "Attribute.h"
8#include "AttributeRegistry.h"
11
12namespace BPMNOS::Model {
13
14/**
15 * @brief Class representing a mathematical expression.
16 **/
18public:
20 Expression(const std::string expression, const AttributeRegistry& attributeRegistry, bool newTarget = false);
22 const std::string expression;
23 const LIMEX::Expression<double> compiled;
24 const Type type;
25 std::optional<const Attribute*> target;
26 std::set<const Attribute*> inputs; ///< Vector containing all input attributes and collections used by the expression.
27 std::vector<const Attribute*> variables; ///< Vector containing all input attributes used by the expression.
28 std::vector<const Attribute*> collections; ///< Vector containing all input collections used by the expression.
29 const Attribute* isAttribute() const; ///< Returns pointer to the attribute if and only if expression contains nothing else
30 template <typename DataType>
31 std::optional<BPMNOS::number> execute(const BPMNOS::Values& status, const DataType& data, const BPMNOS::Values& globals) const;
32private:
33 LIMEX::Expression<double> getExpression(const std::string& input) const;
34 Type getType() const;
35};
36
37} // namespace BPMNOS::Model
38
39#endif // BPMNOS_Model_Expression_H
Class representing a mathematical expression.
Definition Expression.h:17
const AttributeRegistry & attributeRegistry
Definition Expression.h:21
Expression(const std::string expression, const AttributeRegistry &attributeRegistry, bool newTarget=false)
Definition Expression.cpp:8
const Attribute * isAttribute() const
Returns pointer to the attribute if and only if expression contains nothing else.
std::set< const Attribute * > inputs
Vector containing all input attributes and collections used by the expression.
Definition Expression.h:26
std::optional< const Attribute * > target
Definition Expression.h:25
const LIMEX::Expression< double > compiled
Definition Expression.h:23
std::vector< const Attribute * > variables
Vector containing all input attributes used by the expression.
Definition Expression.h:27
const std::string expression
Definition Expression.h:22
std::vector< const Attribute * > collections
Vector containing all input collections used by the expression.
Definition Expression.h:28
std::optional< BPMNOS::number > execute(const BPMNOS::Values &status, const DataType &data, const BPMNOS::Values &globals) const