openDAQ
Open data acquisition platform
+ Collaboration diagram for EvalValue:

Detailed Description

Classes

struct  IEvalValue
 Dynamic expression evaluator. More...
 
class  EvalValuePtr
 Dynamic expression evaluator. More...
 

Functions

daq::StringPtr getEval () const
 Gets the expression. More...
 
daq::BaseObjectPtr getResult () const
 Gets the result of the expression. More...
 
daq::EvalValuePtr cloneWithOwner (const daq::PropertyObjectPtr &owner) const
 Clones the object and attaches an owner. More...
 
void getParseErrorCode () const
 Returns the parse error code. More...
 
daq::ListPtr< daq::IString > getPropertyReferences () const
 Returns the names of all properties referenced by the eval value. More...
 

Function Documentation

◆ cloneWithOwner()

daq::EvalValuePtr cloneWithOwner ( const daq::PropertyObjectPtr &  owner) const
inline

Clones the object and attaches an owner.

Parameters
ownerThe owner to attach to the cloned eval value.
Returns
The cloned object.

When the expression contains reference to some property object, then the expression cannot be evaluated unless an owner is attached to eval value. However, the object can be cloned with the specified owner attached. The client can then evaluate the cloned object.

◆ getEval()

daq::StringPtr getEval ( ) const
inline

Gets the expression.

Returns
The expression.

Expression is passed as a parameter to the factory function.

◆ getParseErrorCode()

void getParseErrorCode ( ) const
inline

Returns the parse error code.

When an eval value object is created, the expression is passed as an argument to the factory function. Parsing of the expression can fail, but the factory function will always succeed. Use this function to check if the parsing of the expression succeeded without evaluating the expression.

◆ getPropertyReferences()

daq::ListPtr<daq::IString> getPropertyReferences ( ) const
inline

Returns the names of all properties referenced by the eval value.

Returns
The names of referenced properties.

Referenced properties are all occurrences matching the '"%" propref' pattern in the evaluation string.

◆ getResult()

daq::BaseObjectPtr getResult ( ) const
inline

Gets the result of the expression.

Returns
The result of the expression.
Exceptions
CalcFailedExceptionwhen calculation failed.
OpendaqErrExceptionwhen reference resolution failed
ParseFailedExceptionwhen expression parsing failed

When this method is called for the first time, the object will trigger execution and return result.