VLink  2.0.0
A high-performance communication middleware
vlink::ExprtkExpression类 参考final

Opaque wrapper around exprtk::expression<double> plus its compiler. 更多...

#include <exprtk_api.h>

vlink::ExprtkExpression 的协作图:

Public 成员函数

 ExprtkExpression ()
 Construct an empty, uncompiled expression. 更多...
 
 ~ExprtkExpression ()
 Destroy the expression and release the underlying ExprTk state. 更多...
 
 ExprtkExpression (ExprtkExpression &&) noexcept
 Move constructor; transfers ownership of the underlying ExprTk state. 更多...
 
ExprtkExpressionoperator= (ExprtkExpression &&) noexcept
 Move assignment; transfers ownership of the underlying ExprTk state. 更多...
 
void register_symbol_table (ExprtkSymbolTable &symbol_table)
 Bind a symbol table to this expression. 更多...
 
bool compile (const std::string &expression)
 Compile an expression string against the registered symbol table. 更多...
 
double value () const
 Evaluate the compiled expression using the current variable values. 更多...
 

详细描述

Opaque wrapper around exprtk::expression<double> plus its compiler.

Bundles a compiled expression and the one-shot parser used to build it. Register a ExprtkSymbolTable, call compile once, then call value repeatedly; the referenced symbol table must outlive the expression.

The class is move-only; the underlying ExprTk expression lives on the heap behind a std::unique_ptr, so moving the wrapper never relocates it.

构造及析构函数说明

◆ ExprtkExpression() [1/2]

vlink::ExprtkExpression::ExprtkExpression ( )

Construct an empty, uncompiled expression.

◆ ~ExprtkExpression()

vlink::ExprtkExpression::~ExprtkExpression ( )

Destroy the expression and release the underlying ExprTk state.

◆ ExprtkExpression() [2/2]

vlink::ExprtkExpression::ExprtkExpression ( ExprtkExpression &&  )
noexcept

Move constructor; transfers ownership of the underlying ExprTk state.

成员函数说明

◆ compile()

bool vlink::ExprtkExpression::compile ( const std::string &  expression)

Compile an expression string against the registered symbol table.

参数
expressionThe ExprTk expression source to compile.
返回
true on success; false if the string failed to parse, in which case value must not be called.
注解
Intended to be called once per object. A registered symbol table is required.

◆ operator=()

ExprtkExpression& vlink::ExprtkExpression::operator= ( ExprtkExpression &&  )
noexcept

Move assignment; transfers ownership of the underlying ExprTk state.

◆ register_symbol_table()

void vlink::ExprtkExpression::register_symbol_table ( ExprtkSymbolTable symbol_table)

Bind a symbol table to this expression.

参数
symbol_tableThe table whose constants and variables the expression resolves against. It must outlive this expression; only its address is referenced. Call before compile.

◆ value()

double vlink::ExprtkExpression::value ( ) const

Evaluate the compiled expression using the current variable values.

返回
The evaluated result. Undefined if compile has not returned true.

该类的文档由以下文件生成: