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 /// Construct expression using attributeRegistry's limexHandle
22 bool newTarget = false);
23 /// Construct expression using a custom LIMEX handle (for stochastic expressions)
24 Expression(const LIMEX::Handle<double>& handle, const std::string expression,
25 const AttributeRegistry& attributeRegistry, bool newTarget = false);
26 Expression(const Expression&) = delete;
28 Expression& operator=(const Expression&) = delete;
31 const LIMEX::Handle<double>& handle;
32 const std::string expression;
33 const LIMEX::Expression<double> compiled;
34 const Type type;
35 std::optional<const Attribute*> target;
36 std::set<const Attribute*> inputs; ///< Vector containing all input attributes and collections used by the expression.
37 std::vector<const Attribute*> variables; ///< Vector containing all input attributes used by the expression.
38 std::vector<const Attribute*> collections; ///< Vector containing all input collections used by the expression.
39 const Attribute* isAttribute() const; ///< Returns pointer to the attribute if and only if expression contains nothing else
40 template <typename DataType>
41 std::optional<BPMNOS::number> execute(const BPMNOS::Values& status, const DataType& data, const BPMNOS::Values& globals) const;
42private:
43 LIMEX::Expression<double> getExpression(const std::string& input) const;
44 Type getType() const;
45};
46
47} // namespace BPMNOS::Model
48
49#endif // BPMNOS_Model_Expression_H
Class representing a mathematical expression.
Definition Expression.h:17
const AttributeRegistry & attributeRegistry
Definition Expression.h:30
Expression(Expression &&)=delete
Expression(const Expression &)=delete
Expression(const std::string expression, const AttributeRegistry &attributeRegistry, bool newTarget=false)
Construct expression using attributeRegistry's limexHandle.
Definition Expression.cpp:9
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:36
Expression & operator=(const Expression &)=delete
Expression & operator=(Expression &&)=delete
std::optional< const Attribute * > target
Definition Expression.h:35
const LIMEX::Expression< double > compiled
Definition Expression.h:33
std::vector< const Attribute * > variables
Vector containing all input attributes used by the expression.
Definition Expression.h:37
const std::string expression
Definition Expression.h:32
std::vector< const Attribute * > collections
Vector containing all input collections used by the expression.
Definition Expression.h:38
const LIMEX::Handle< double > & handle
Definition Expression.h:31
std::optional< BPMNOS::number > execute(const BPMNOS::Values &status, const DataType &data, const BPMNOS::Values &globals) const