53 os <<
"<" << c.name <<
": ";
54 os << c.value <<
"±" << c.uncertainty <<
" ";
55 os << c.unit <<
" (" << c.reference <<
")>\n";
91 std::string
trim(
const std::string& str);
130 bool has(
const std::string& key)
const;
136 std::set<std::string>
keys()
const;
Constant operator[](const std::string &key) const
Overloaded subscript operator to access constants by key.
std::map< std::string, Constant > constants_
Map to store constants by name.
bool has(const std::string &key) const
Check if a constant exists by key.
std::set< std::string > keys() const
Get a list of all constant keys.
bool loaded_
Flag to indicate if constants are loaded.
bool initialize()
Initialize constants.
static Constants & getInstance()
get instance of constants singleton
bool load()
Load constants from the embedded header file.
bool isLoaded() const
Check if constants are loaded.
Constants()
Default constructor. Private to avoid direct instantiation.
Constant get(const std::string &key) const
Get a constant by key.
std::string trim(const std::string &str)
Trim leading and trailing whitespace from a string.
Structure to hold a constant's details.
Constant(const std::string &name, const double value, const double uncertainty, const std::string &unit, const std::string &reference)
Parameterized constructor.
const std::string unit
Unit of the constant.
friend std::ostream & operator<<(std::ostream &os, const Constant &c)
overload the << operator for pretty printing
const double uncertainty
Uncertainty in the constant's value.
const std::string name
Name of the constant.
const std::string reference
Reference for the constant's value.
const double value
Value of the constant.