VLink  2.0.0
A high-performance communication middleware
vlink::ExprtkSymbolTable Class Referencefinal

Opaque wrapper around exprtk::symbol_table<double>. More...

#include <exprtk_api.h>

Collaboration diagram for vlink::ExprtkSymbolTable:

Public Member Functions

 ExprtkSymbolTable ()
 Construct an empty symbol table. More...
 
 ~ExprtkSymbolTable ()
 Destroy the symbol table and release the underlying ExprTk state. More...
 
 ExprtkSymbolTable (ExprtkSymbolTable &&) noexcept
 Move constructor; transfers ownership of the underlying ExprTk state. More...
 
ExprtkSymbolTableoperator= (ExprtkSymbolTable &&) noexcept
 Move assignment; transfers ownership of the underlying ExprTk state. More...
 
void add_constants ()
 Register the standard ExprTk constants (pi, epsilon, inf, ...). More...
 
bool add_variable (const std::string &name, double &value)
 Register a named variable bound by reference. More...
 

Friends

class ExprtkExpression
 

Detailed Description

Opaque wrapper around exprtk::symbol_table<double>.

Holds the named constants and variables an expression may reference. Variables are registered by reference: the symbol table stores the address of the supplied double, so the referenced storage must stay alive and at a fixed address for the whole lifetime of the symbol table and any expression compiled against it.

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

Constructor & Destructor Documentation

◆ ExprtkSymbolTable() [1/2]

vlink::ExprtkSymbolTable::ExprtkSymbolTable ( )

Construct an empty symbol table.

◆ ~ExprtkSymbolTable()

vlink::ExprtkSymbolTable::~ExprtkSymbolTable ( )

Destroy the symbol table and release the underlying ExprTk state.

◆ ExprtkSymbolTable() [2/2]

vlink::ExprtkSymbolTable::ExprtkSymbolTable ( ExprtkSymbolTable &&  )
noexcept

Move constructor; transfers ownership of the underlying ExprTk state.

Member Function Documentation

◆ add_constants()

void vlink::ExprtkSymbolTable::add_constants ( )

Register the standard ExprTk constants (pi, epsilon, inf, ...).

Mirrors exprtk::symbol_table<double>::add_constants().

◆ add_variable()

bool vlink::ExprtkSymbolTable::add_variable ( const std::string &  name,
double &  value 
)

Register a named variable bound by reference.

Parameters
nameIdentifier used inside expression strings.
valueReference to caller-owned storage; its address is captured, so it must outlive this table and must not be relocated after registration.
Returns
true if the variable was added, false on a duplicate or invalid name.

◆ operator=()

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

Move assignment; transfers ownership of the underlying ExprTk state.

Friends And Related Function Documentation

◆ ExprtkExpression

friend class ExprtkExpression
friend

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