3#include "Engine/Parameter/Template.h"
4#include <boost/signals2.hpp>
11class ExpressionContext;
16using PrmValues = std::variant<std::vector<floatT>, std::vector<intT>, std::vector<String>>;
24 std::string getName()
const;
25 std::string getLabel()
const;
26 enzo::prm::Type getType()
const;
28 unsigned int getVectorSize()
const;
30 floatT evalFloat(
unsigned int index = 0)
const;
31 String evalString(
unsigned int index = 0)
const;
32 intT evalInt(
unsigned int index = 0)
const;
37 floatT evalFloat(
unsigned int index, String& error)
const;
38 intT evalInt(
unsigned int index, String& error)
const;
39 String evalString(
unsigned int index, String& error)
const;
44 std::vector<floatT> evalFloats()
const;
45 std::vector<String> evalStrings()
const;
46 std::vector<intT> evalInts()
const;
48 void setInt(intT value,
unsigned int index = 0);
49 void setFloat(floatT value,
unsigned int index = 0);
50 void setString(String value,
unsigned int index = 0);
55 void setExpression(String expression,
unsigned int index = 0);
56 void clearExpression(
unsigned int index = 0);
57 bool hasExpression(
unsigned int index = 0)
const;
61 std::optional<String>
getExpression(
unsigned int index = 0)
const;
72 PrmValues getValues()
const;
73 void setValues(
const PrmValues& values);
77 unsigned int getInstanceCount()
const;
78 const std::vector<std::shared_ptr<Parameter>>& getInstance(
unsigned int instanceIndex)
const;
79 std::shared_ptr<Parameter>
80 getInstanceField(
unsigned int instanceIndex, std::string_view fieldName)
const;
82 void removeInstance(
unsigned int instanceIndex);
83 void moveInstance(
unsigned int fromIndex,
unsigned int toIndex);
87 boost::signals2::signal<void()> valueChanged;
90 virtual void onFloatSet_(
const PrmValues& before) {}
91 void handleValueChange_();
107 floatT
clampToRange_(floatT value,
unsigned int index)
const;
114 floatT readFloatLiteral_(
unsigned int index)
const;
115 intT readIntLiteral_(
unsigned int index)
const;
116 String readStringLiteral_(
unsigned int index)
const;
117 std::vector<std::shared_ptr<Parameter>> buildInstance_(
unsigned int instanceIndex);
123 std::vector<std::optional<String>> expressions_;
124 std::vector<std::vector<std::shared_ptr<Parameter>>> instances_;
Basic attribute, parameter, and node types for Enzo.
ValueType
Which kind of value a parameter stores.
Definition Types.h:127
The world a single expression evaluation reads and writes to.
Definition ExpressionContext.h:21
Definition Parameter.h:19
std::optional< String > getExpressionError(unsigned int index=0) const
Evaluates a component's expression and reports any failure.
std::optional< String > getExpression(unsigned int index=0) const
The expression on a component.
Definition Parameter.cpp:302
virtual void submitExpressionDependencies_(const expr::ExpressionContext &context, unsigned int index) const
Hands the dependencies an expression captured to the network graph.
Definition Parameter.h:102
floatT clampToRange_(floatT value, unsigned int index) const
Returns the value pulled within a component's locked range bounds.
Definition Parameter.cpp:316
virtual std::unique_ptr< expr::ExpressionContext > makeExpressionContext_() const
The world an expression on this parameter reads, e.g. for prm().
Definition Parameter.cpp:133