Pothos
0.4.0-gd11861cd
The Pothos dataflow programming software suite
|
#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) |
The evaluation environment can evaluate and inspect expressions. Expressions are considered to be valid C++ expressions involving bools, integers, strings, floats, stl classes...
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.
Pothos::Object Pothos::Util::EvalEnvironment::eval | ( | const std::string & | expression | ) |
Try to evaluate an expression in this environment.
expression | a string expression |
Pothos::Exception | with the evaluation error message |
|
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.