Expression evaluation
PUEL calculators and unit-expression solvers.
-
class Calculator
- #include <calculator.h>
Evaluates PUEL expressions and returns PUQ results.
Public Static Attributes
-
static exs::Solver<CalculatorAtom> solver
-
static exs::Solver<CalculatorAtom> solver
-
class CalculatorAtom : public snt::exs::AtomBase<CalculatorAtom, Quantity>
- #include <calculator_atom.h>
EXS atom that evaluates a PUQ quantity expression.
Public Functions
-
CalculatorAtom(const CalculatorAtom &a) = default
-
virtual std::string to_string() override
Get a string representation of an atom
-
void math_add(CalculatorAtom *other) override
Add another quantity atom, including its units and uncertainty.
- Parameters:
other – Quantity atom to add; dimensions must be compatible.
-
void math_subtract(CalculatorAtom *other) override
-
virtual void math_negate() override
Negate value of this value
-
void math_multiply(CalculatorAtom *other) override
-
void math_divide(CalculatorAtom *other) override
-
CalculatorAtom(const CalculatorAtom &a) = default
-
class UnitAtom : public snt::exs::AtomBase<UnitAtom, Measurement>
- #include <unit_atom.h>
EXS atom that resolves a unit expression to a PUQ measurement.
Public Functions
-
inline UnitAtom(Measurement v)
-
virtual std::string to_string() override
Get a string representation of an atom
-
void math_power(ExponentVariant &e)
Public Static Functions
-
static Measurement from_string(const std::string &s, exs::BaseSettings *set = nullptr)
-
inline UnitAtom(Measurement v)
-
class UnitSolver
- #include <unit_solver.h>
Calcuates unit atoms from unit expressions
In order to speed up calculations of units this class is caching input unit expression strings and stores already calculated unit atoms in a cache map. This should avoid repeated calculations of the same inputs.
Public Functions
-
UnitSolver() = default
Default constructor
-
UnitSolver() = default