Enzo
Loading...
Searching...
No Matches
enzo::prm::Parameter Class Reference
Inheritance diagram for enzo::prm::Parameter:
enzo::prm::NodeParameter

Public Member Functions

 Parameter (Template prmTemplate)
 
std::string getName () const
 
std::string getLabel () const
 
enzo::prm::Type getType () const
 
enzo::prm::ValueType getValueType () const
 
unsigned int getVectorSize () const
 
floatT evalFloat (unsigned int index=0) const
 
String evalString (unsigned int index=0) const
 
intT evalInt (unsigned int index=0) const
 
floatT evalFloat (unsigned int index, String &error) const
 
intT evalInt (unsigned int index, String &error) const
 
String evalString (unsigned int index, String &error) const
 
std::vector< floatT > evalFloats () const
 
std::vector< String > evalStrings () const
 
std::vector< intT > evalInts () const
 
void setInt (intT value, unsigned int index=0)
 
void setFloat (floatT value, unsigned int index=0)
 
void setString (String value, unsigned int index=0)
 
void setExpression (String expression, unsigned int index=0)
 
void clearExpression (unsigned int index=0)
 
bool hasExpression (unsigned int index=0) const
 
std::optional< String > getExpression (unsigned int index=0) const
 The expression on a component.
 
std::optional< String > getExpressionError (unsigned int index=0) const
 Evaluates a component's expression and reports any failure.
 
PrmValues getValues () const
 
void setValues (const PrmValues &values)
 
unsigned int getInstanceCount () const
 
const std::vector< std::shared_ptr< Parameter > > & getInstance (unsigned int instanceIndex) const
 
std::shared_ptr< ParametergetInstanceField (unsigned int instanceIndex, std::string_view fieldName) const
 
void addInstance ()
 
void removeInstance (unsigned int instanceIndex)
 
void moveInstance (unsigned int fromIndex, unsigned int toIndex)
 
const TemplategetTemplate ()
 

Public Attributes

boost::signals2::signal< void()> valueChanged
 

Protected Member Functions

virtual void onFloatSet_ (const PrmValues &before)
 
void handleValueChange_ ()
 
virtual std::unique_ptr< expr::ExpressionContextmakeExpressionContext_ () const
 The world an expression on this parameter reads, e.g. for prm().
 
virtual void submitExpressionDependencies_ (const expr::ExpressionContext &context, unsigned int index) const
 Hands the dependencies an expression captured to the network graph.
 
floatT clampToRange_ (floatT value, unsigned int index) const
 Returns the value pulled within a component's locked range bounds.
 
intT clampToRange_ (intT value, unsigned int index) const
 
floatT readFloatLiteral_ (unsigned int index) const
 
intT readIntLiteral_ (unsigned int index) const
 
String readStringLiteral_ (unsigned int index) const
 
std::vector< std::shared_ptr< Parameter > > buildInstance_ (unsigned int instanceIndex)
 

Protected Attributes

Template template_
 
PrmValues values_
 
std::vector< std::optional< String > > expressions_
 
std::vector< std::vector< std::shared_ptr< Parameter > > > instances_
 

Member Function Documentation

◆ getExpression()

std::optional< String > enzo::prm::Parameter::getExpression ( unsigned int index = 0) const

The expression on a component.

Returns
The expression when one is set, otherwise nullopt.

◆ getExpressionError()

std::optional< String > enzo::prm::Parameter::getExpressionError ( unsigned int index = 0) const

Evaluates a component's expression and reports any failure.

e.g. an expression of "1 +" reports a compile error while "5 + 5" reports nothing.

Returns
The error text when the expression fails to compile or run, otherwise nullopt, including when the component holds no expression.

◆ makeExpressionContext_()

std::unique_ptr< expr::ExpressionContext > enzo::prm::Parameter::makeExpressionContext_ ( ) const
protectedvirtual

The world an expression on this parameter reads, e.g. for prm().

Returns
A context, or null when the parameter has nothing to offer such as a bare parameter with no owning node.

Reimplemented in enzo::prm::NodeParameter.

◆ submitExpressionDependencies_()

virtual void enzo::prm::Parameter::submitExpressionDependencies_ ( const expr::ExpressionContext & context,
unsigned int index ) const
inlineprotectedvirtual

Hands the dependencies an expression captured to the network graph.

Note
Only a parameter with an owning node has a place to record them, so the base does nothing.

Reimplemented in enzo::prm::NodeParameter.


The documentation for this class was generated from the following files: