openDAQ
Open data acquisition platform
IEvalValue Struct Referenceabstract

Dynamic expression evaluator. More...

+ Inheritance diagram for IEvalValue:
+ Collaboration diagram for IEvalValue:

Detailed Description

Dynamic expression evaluator.

Provides dynamic evaluation of expressions. Expression is passed as an argument to a factory function. Expression is evaluated at runtime when result value is requested.

Public Member Functions

virtual ErrCode INTERFACE_FUNC getEval (IString **eval)=0
 Gets the expression. More...
 
virtual ErrCode INTERFACE_FUNC getResult (IBaseObject **obj)=0
 Gets the result of the expression. More...
 
virtual ErrCode INTERFACE_FUNC cloneWithOwner (IPropertyObject *owner, IEvalValue **clonedValue)=0
 Clones the object and attaches an owner. More...
 
virtual ErrCode INTERFACE_FUNC getParseErrorCode ()=0
 Returns the parse error code. More...
 
virtual ErrCode INTERFACE_FUNC getPropertyReferences (IList **propertyReferences)=0
 Returns the names of all properties referenced by the eval value. More...
 
- Public Member Functions inherited from IBaseObject
virtual ErrCode INTERFACE_FUNC borrowInterface (const IntfID &intfID, void **obj) const =0
 Returns another interface which is supported by the object without incrementing the reference count. More...
 
virtual ErrCode INTERFACE_FUNC dispose ()=0
 Disposes all references held by the object. More...
 
virtual ErrCode INTERFACE_FUNC getHashCode (SizeT *hashCode)=0
 Returns hash code of the object. More...
 
virtual ErrCode INTERFACE_FUNC equals (IBaseObject *other, Bool *equal) const =0
 Compares object to another object for equality. More...
 
virtual ErrCode INTERFACE_FUNC toString (CharPtr *str)=0
 Returns a string representation of the object. More...
 
- Public Member Functions inherited from IUnknown
virtual ErrCode INTERFACE_FUNC queryInterface (const IntfID &intfID, void **obj)=0
 Returns another interface which is supported by the object and increments the reference count. More...
 
virtual int INTERFACE_FUNC addRef ()=0
 Increments the reference count for an interface on an object. More...
 
virtual int INTERFACE_FUNC releaseRef ()=0
 Decrements the reference count for an interface on an object. More...
 

Member Function Documentation

◆ cloneWithOwner()

virtual ErrCode INTERFACE_FUNC cloneWithOwner ( IPropertyObject owner,
IEvalValue **  clonedValue 
)
pure virtual

Clones the object and attaches an owner.

Parameters
ownerThe owner to attach to the cloned eval value.
[out]clonedValueThe 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()

virtual ErrCode INTERFACE_FUNC getEval ( IString **  eval)
pure virtual

Gets the expression.

Parameters
[out]evalThe expression.

Expression is passed as a parameter to the factory function.

◆ getParseErrorCode()

virtual ErrCode INTERFACE_FUNC getParseErrorCode ( )
pure virtual

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()

virtual ErrCode INTERFACE_FUNC getPropertyReferences ( IList **  propertyReferences)
pure virtual

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

Parameters
[out]propertyReferencesThe names of referenced properties.

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

◆ getResult()

virtual ErrCode INTERFACE_FUNC getResult ( IBaseObject **  obj)
pure virtual

Gets the result of the expression.

Parameters
[out]objThe result of the expression.
Return values
OPENDAQ_ERR_CALCFAILEDwhen calculation failed.
OPENDAQ_ERR_RESOLVEFAILEDwhen reference resolution failed
OPENDAQ_ERR_PARSEFAILEDwhen expression parsing failed

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