Pothos  0.4.0-gd11861cd
The Pothos dataflow programming software suite
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
Pothos::Util::EvalEnvironment Class Reference

#include <EvalEnvironment.hpp>

Public Member Functions

 EvalEnvironment (void)
 
Pothos::Object eval (const std::string &expression)
 
void registerConstantExpr (const std::string &key, const std::string &expr)
 
void registerConstantObj (const std::string &key, const Pothos::Object &obj)
 
void unregisterConstant (const std::string &key)
 

Static Public Member Functions

static std::shared_ptr
< EvalEnvironment
make (void)
 

Detailed Description

The evaluation environment can evaluate and inspect expressions. Expressions are considered to be valid C++ expressions involving bools, integers, strings, floats, stl classes...

Constructor & Destructor Documentation

Pothos::Util::EvalEnvironment::EvalEnvironment ( void  )

Create an empty eval environment. The environment can evaluate expressions with eval() and can be extended with new constants using the registerConstant calls.

Member Function Documentation

Pothos::Object Pothos::Util::EvalEnvironment::eval ( const std::string &  expression)

Try to evaluate an expression in this environment.

Parameters
expressiona string expression
Exceptions
Pothos::Exceptionwith the evaluation error message
Returns
a proxy object representing the evaluated expression
static std::shared_ptr<EvalEnvironment> Pothos::Util::EvalEnvironment::make ( void  )
static

Create a new empty eval environment in a shared ptr. This is a convenience factory for EvalEnvironment.

void Pothos::Util::EvalEnvironment::registerConstantExpr ( const std::string &  key,
const std::string &  expr 
)

Register a constant that will be used in other expressions. For an expression like 2*x, then "x" would be a constant.

void Pothos::Util::EvalEnvironment::registerConstantObj ( const std::string &  key,
const Pothos::Object obj 
)

Register a constant that will be used in other expressions.

void Pothos::Util::EvalEnvironment::unregisterConstant ( const std::string &  key)

Unregister a previously registered constant.


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