formula_result
Defined in header: <ixion/formula_result.hpp>
-
class formula_result
Store formula result which may be either numeric, textural, or error. In case the result is textural, it owns the instance of the string.
Public Types
Public Functions
-
formula_result()
-
formula_result(const formula_result &r)
-
formula_result(formula_result &&r)
-
formula_result(bool b)
-
formula_result(double v)
-
formula_result(std::string str)
-
formula_result(formula_error_t e)
-
~formula_result()
-
void reset()
-
void set_boolean(bool b)
-
void set_value(double v)
-
void set_string_value(std::string str)
-
void set_error(formula_error_t e)
-
bool get_boolean() const
Get a boolean result value. The caller must make sure the result is of boolean type, else the behavior is undefined.
- Returns:
boolean result value.
-
double get_value() const
Get a numeric result value. The caller must make sure the result is of numeric type, else the behavior is undefined.
- Returns:
numeric result value.
-
const std::string &get_string() const
Get a string value for textural result. The caller must make sure the result is of textural type, else the behavior is undefined.
- Returns:
string value.
-
formula_error_t get_error() const
Get an error value of the result. The caller must make sure that the result is of error type, else the behavior is undefined.
See also
ixion::get_formula_error_name
- Returns:
enum value representing the error.
-
const matrix &get_matrix() const
Get a matrix value of the result. The caller must make sure that the result is of matrix type, else the behavior is undefined.
- Returns:
matrix result value.
-
matrix &get_matrix()
Get a matrix value of the result. The caller must make sure that the result is of matrix type, else the behavior is undefined.
- Returns:
matrix result value.
-
result_type get_type() const
Get the type of result.
- Returns:
enum value representing the result type.
-
std::string str(const model_context &cxt) const
Get a string representation of the result value no matter what the result type is.
- Parameters:
cxt – model context object.
- Returns:
string representation of the result value.
-
void parse(std::string_view s)
Parse a textural representation of a formula result, and set result value of appropriate type.
- Parameters:
s – formula result as a string.
-
formula_result &operator=(formula_result r)
-
bool operator==(const formula_result &r) const
-
formula_result()