Expression solvers

Numerical, logical, and template expressions within DIPL.

enum snt::dip::CustomOperatorType

Operators used to test whether a DIP symbol is defined.

Values:

enumerator DEFINED_OPERATOR
enumerator NOT_DEFINED_OPERATOR
class LogicalAtom : public snt::exs::AtomBase<LogicalAtom, ValueNodeData>
#include <logical_atom.h>

Public Functions

inline LogicalAtom(ValueNodeData b)
inline LogicalAtom(const LogicalAtom &a)
LogicalAtom &operator=(const LogicalAtom &a)

Copy the logical atom value into this object.

Parameters:

a – Source atom whose value is copied.

LogicalAtom(LogicalAtom &&a) noexcept = default
LogicalAtom &operator=(LogicalAtom &&a) noexcept = default
virtual std::string to_string() override

Get a string representation of an atom

void comparison_equal(LogicalAtom *other) override
void comparison_not_equal(LogicalAtom *other) override
void comparison_less_equal(LogicalAtom *other) override
void comparison_greater_equal(LogicalAtom *other) override
void comparison_less(LogicalAtom *other) override
void comparison_greater(LogicalAtom *other) override
virtual void logical_not() override

Get logical negation of this value

void logical_and(LogicalAtom *other) override

Apply a logical AND operation.

Parameters:

other – Other value used in the operation.

void logical_or(LogicalAtom *other) override

Apply a logical OR operation.

Parameters:

other – Other value used in the operation.

void custom_defined()
void custom_not_defined()

Public Static Functions

static ValueNodeData from_string(const std::string &s, exs::BaseSettings *settings)
struct LogicalSettings : public snt::exs::BaseSettings
#include <logical_atom.h>

Public Members

Environment *env

Environment for the references.

Path current

Current path for in the hierarchy.

class LogicalSolver
#include <logical_solver.h>

Solves logical expressions of DIP nodes

Public Functions

LogicalSolver(Environment &env, Path current = Path(""))

Logical solver constructor

Parameters:
  • env – Environment class object

  • current – Current path in the node hierarchy

ValueNodeData eval(const std::string &expression)

Solve logical DIP expression

Parameters:

expression – Logical expression string

Returns:

Data of a value node

Public Static Attributes

static exs::Solver<LogicalAtom, LogicalSettings> solver

Instance of an EXS expression solver.

class NumericalAtom : public snt::exs::AtomBase<NumericalAtom, ValueNodeData>
#include <numerical_atom.h>

Public Functions

inline NumericalAtom(ValueNodeData b)
NumericalAtom(const NumericalAtom &a)
NumericalAtom &operator=(const NumericalAtom &a)

Copy the numerical atom value into this object.

Parameters:

a – Source atom whose value is copied.

NumericalAtom(NumericalAtom &&a) noexcept = default
NumericalAtom &operator=(NumericalAtom &&a) noexcept = default
virtual std::string to_string() override

Get a string representation of an atom

virtual void math_sinus() override

Get sinus of this value

virtual void math_cosinus() override

Get cosinus of this value

virtual void math_tangens() override

Get tangens value of this value

virtual void math_cubic_root() override

Get cubic root of this value

virtual void math_square_root() override

Get square root value of this value

virtual void math_logarithm_10() override

Get a decadic logarithm of this value

virtual void math_logarithm() override

Get a natural logarithm of this value

virtual void math_exponent() override

Get an exponential value of this value

void math_power(NumericalAtom *other) override
void math_multiply(NumericalAtom *other) override
void math_divide(NumericalAtom *other) override
void math_add(NumericalAtom *other) override

Add another value.

Parameters:

other – Other value used in the operation.

void math_subtract(NumericalAtom *other) override
virtual void math_negate() override

Negate value of this value

Public Static Functions

static ValueNodeData from_string(const std::string &s, exs::BaseSettings *settings)
struct NumericalSettings : public snt::exs::BaseSettings
#include <numerical_atom.h>

Public Members

Environment *env

Environment for the references.

Path current

Current path for in the hierarchy.

class NumericalSolver
#include <numerical_solver.h>

Solves numerical expressions of DIP nodes

Public Functions

NumericalSolver(Environment &env, Path current = Path(""))

Numerical solver constructor

Parameters:
  • env – Environment class object

  • current – Current path in the node hierarchy

ValueNodeData eval(const std::string &expression, const std::string &units = "")

Solve numerical DIP expression

Parameters:
  • expression – Numerical expression string

  • units – Target units of a solved value node

Returns:

Data of a value node

Public Static Attributes

static exs::Solver<NumericalAtom, NumericalSettings> solver

Instance of an EXS expression solver.

class OperatorDefined : public snt::exs::OperatorGroup<1>
#include <logical_operators.h>

DIP operator that tests for a defined symbol.

Public Functions

OperatorDefined()

Construct the defined-symbol operator.

virtual void operate_group(exs::TokenListBase *tokens) override

Apply the grouped operator to the token list.

Parameters:

tokens – Token list being processed.

class OperatorNotDefined : public snt::exs::OperatorGroup<1>
#include <logical_operators.h>

DIP operator that tests for an undefined symbol.

Public Functions

OperatorNotDefined()

Construct the undefined-symbol operator.

virtual void operate_group(exs::TokenListBase *tokens) override

Apply the grouped operator to the token list.

Parameters:

tokens – Token list being processed.

class TemplateSolver
#include <template_solver.h>

Public Functions

TemplateSolver(Environment &env, Path current = Path(""))

Template solver constructor

Parameters:
  • env – Environment class object

  • current – Current path in the node hierarchy

ValueNodeData eval(std::string expression)

Solve DIP string template

Parameters:

expression – Template string

Returns:

Data of a value node