NDEVR
API Documentation
Formula.h
1#pragma once
2#include <NDEVR/Equation.h>
3#include <NDEVR/Unit.h>
4#include <NDEVR/Pointer.h>
5namespace NDEVR
6{
61
77}
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
Provides a constant, unmodifiable pointer that has shared ownership of a dynamically allocated object...
Definition Pointer.hpp:276
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:64
A solvable mathematical formula composed of variables, numbers, and operations.
Definition Equation.h:45
Logic for reading or writing to a file as well as navigating filesystems or other common file operati...
Definition File.h:53
The core String class for the NDEVR API.
Definition String.h:95
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
The primary namespace for the NDEVR SDK.
UnitCategory
A category of unit describing what it relates to.
Definition Unit.h:15
@ e_undefined_unit
No specific unit category assigned.
Definition Unit.h:16
double fltp08
Defines an alias representing an 8 byte floating-point number.
Logic that saves formulas into a tree-like dependency structure.
Definition Formula.h:67
void readFile(const File &formula_file)
Reads and parses a formula definition file, populating the tree structure.
Dictionary< String, Buffer< String > > top_level_formulas
Mapping of category names to their top-level formula identifiers.
Definition Formula.h:68
Dictionary< String, Dictionary< String, Buffer< Formula > > > formulas
Nested mapping of categories to variable names to their associated formulas.
Definition Formula.h:69
Logic for storing the definition of a formula, that can be displayed to the end-user.
Definition Formula.h:12
String formula
The raw formula expression string.
Definition Formula.h:17
String displayFormula(bool simplify) const
Produces a display-ready version of the formula string.
ConstPointer< Unit > result_unit
The specific unit of the formula result.
Definition Formula.h:19
static String DisplayString(const String &name)
Formats a variable name for user-facing display.
fltp08 solve() const
Evaluates the formula and returns the numeric result.
Buffer< String > dependentVariables() const
Retrieves the list of variable names this formula depends on.
Dictionary< String, String > dependent_variables
A mapping of variable names to their current value strings.
Definition Formula.h:20
UnitCategory result_unit_type
The unit category of the formula result.
Definition Formula.h:18
String description
A textual description of what the formula computes.
Definition Formula.h:15
String simplifiedFormula() const
Produces a simplified version of the formula string.
String symbol
The shorthand symbol representing the formula result.
Definition Formula.h:14
String category
The category grouping this formula belongs to.
Definition Formula.h:16
Equation< fltp08 > equation() const
Converts the formula into an evaluatable Equation object.
TranslatedString name
The user-facing display name of the formula.
Definition Formula.h:13