![]() |
KIDS
ver-0.0.1
KIDS : Kernel Integrated Dynamics Simulator
|
this class provides an interface wrapper for the parameter data. More...
#include <Param.h>

Public Types | |
| enum | LoadOption { fromString , fromFile } |
| using | JSON = configor::json |
| using | JSON_Exception = configor::configor_exception |
Public Member Functions | |
| Param (const std::string &input, LoadOption option) | |
| bool | has_key (const std::string &key) |
| Param &operator[](const std::string &key) { if (!has_key(key)) { throw param_illegal_key_error(key); } Param ref = Param(); ref.pj = &((*pj)[key]); return ref; }. | |
| std::shared_ptr< JSON > | pjson () |
| std::string | repr () |
| bool | get_bool (const std::string &key, const std::string &loc, const bool &default_value) |
| bool | get_bool (const std::string &key, const std::string &loc="__loc__") |
| int | get_int (const std::string &key, const std::string &loc, const int &default_value) |
| int | get_int (const std::string &key, const std::string &loc="__loc__") |
| std::string | get_string (const std::string &key, const std::string &loc, const std::string &default_value) |
| std::string | get_string (const std::string &key, const std::string &loc="__loc__") |
| double | get_double (const std::string &key, const std::string &loc, const phys::dimension7 &qdim, const double &default_value=double()) |
| double | get_double (const std::string &key, const std::string &loc, const double &default_value) |
| double | get_double (const std::string &key, const std::string &loc="__loc__") |
Private Member Functions | |
| template<typename T , bool Require = false> | |
| T | get (const std::string &key, const std::string &loc, const phys::dimension7 &qdim, const T &default_value) |
| get parameter | |
Private Attributes | |
| std::shared_ptr< JSON > | pj |
this class provides an interface wrapper for the parameter data.
| using PROJECT_NS::Param::JSON = configor::json |
| using PROJECT_NS::Param::JSON_Exception = configor::configor_exception |
| PROJECT_NS::Param::Param | ( | const std::string & | input, |
| LoadOption | option ) |
| [in] | input | a Json-like string or a file path |
| [in] | option | enum for parse input fromFile parse Param from file fromString parse Param from string |
Definition at line 15 of file Param.cpp.
References fromFile, fromString, and pj.
|
private |
get parameter
| key | : key of the parameter |
| loc | : location tracer (always leaves it LOC()) |
| qdim | : physics dimension for conversion in double in AU unit |
| default_value | default value is avialable |
Definition at line 50 of file Param.cpp.
References utils::concat(), has_key(), phys::unitsys::parse(), and pj.

| bool PROJECT_NS::Param::get_bool | ( | const std::string & | key, |
| const std::string & | loc, | ||
| const bool & | default_value ) |
Definition at line 129 of file Param.cpp.
References phys::none_d.
| bool PROJECT_NS::Param::get_bool | ( | const std::string & | key, |
| const std::string & | loc = "__loc__" ) |
Definition at line 132 of file Param.cpp.
References phys::none_d.
| double PROJECT_NS::Param::get_double | ( | const std::string & | key, |
| const std::string & | loc, | ||
| const double & | default_value ) |
Definition at line 154 of file Param.cpp.
References phys::none_d.
| double PROJECT_NS::Param::get_double | ( | const std::string & | key, |
| const std::string & | loc, | ||
| const phys::dimension7 & | qdim, | ||
| const double & | default_value = double() ) |
Definition at line 150 of file Param.cpp.
Referenced by PROJECT_NS::Model_HO::setInputParam_impl().

| double PROJECT_NS::Param::get_double | ( | const std::string & | key, |
| const std::string & | loc = "__loc__" ) |
Definition at line 157 of file Param.cpp.
References phys::none_d.
| int PROJECT_NS::Param::get_int | ( | const std::string & | key, |
| const std::string & | loc, | ||
| const int & | default_value ) |
Definition at line 136 of file Param.cpp.
References phys::none_d.
Referenced by PROJECT_NS::Model_HO::setInputParam_impl(), and PROJECT_NS::MODEL_MD1D::setInputParam_impl().

| int PROJECT_NS::Param::get_int | ( | const std::string & | key, |
| const std::string & | loc = "__loc__" ) |
Definition at line 139 of file Param.cpp.
References phys::none_d.
| std::string PROJECT_NS::Param::get_string | ( | const std::string & | key, |
| const std::string & | loc, | ||
| const std::string & | default_value ) |
Definition at line 143 of file Param.cpp.
References phys::none_d.
| std::string PROJECT_NS::Param::get_string | ( | const std::string & | key, |
| const std::string & | loc = "__loc__" ) |
Definition at line 146 of file Param.cpp.
References phys::none_d.
| bool PROJECT_NS::Param::has_key | ( | const std::string & | key | ) |
Param &operator[](const std::string &key) { if (!has_key(key)) { throw param_illegal_key_error(key); } Param ref = Param(); ref.pj = &((*pj)[key]); return ref; }.
| [in] | key | The key |
Definition at line 42 of file Param.cpp.
References pj.
Referenced by get().

| std::shared_ptr< configor::json > PROJECT_NS::Param::pjson | ( | ) |
|
private |