1#include <pybind11/pybind11.h>
2#include <pybind11/stl.h>
3#include <pybind11/stl_bind.h>
9namespace py = pybind11;
13 py::class_<serif::constant::Constant>(const_submodule,
"Constant")
20 return "<Constant(name='" + c.name +
"', value=" + std::to_string(c.value) +
21 ", uncertainty=" + std::to_string(c.uncertainty) +
22 ", unit='" + c.unit +
"')>";
25 py::class_<serif::constant::Constants>(const_submodule,
"Constants")
28 [](
const std::string &name) {
33 "Get a constant by name. Returns None if not found."
36 [](
const std::string &name) {
39 "Check if a constant exists by name.")
46 "Get a list of all constant names.")
47 .def_static(
"__class_getitem__",
48 [](
const std::string &name) {
bool has(const std::string &key) const
Check if a constant exists by key.
static Constants & getInstance()
get instance of constants singleton
bool isLoaded() const
Check if constants are loaded.
void register_const_bindings(pybind11::module &const_submodule)
Structure to hold a constant's details.
const std::string unit
Unit of the constant.
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.