UI is an abstract class which collects all the auxiliary functions useful to prepare some concrete user-infos. More...
UI is an abstract class which collects all the auxiliary functions useful to prepare some concrete user-infos.
See static methods 'build', 'get' and 'save'. Writing user-infos with these methods is rather simple. The rest of this class is intended for internal purposes only. Its meaning is to allow pointers to its templated descendant ParticularUI<T>.
#include <user_info.h>
Classes | |
class | MappedUI |
Public Types | |
enum | SettingPresence { optional, compulsory } |
Enum type used to determine whether the data for concrete Settingis is compulsory or optional. | |
Static Public Member Functions | |
Initialization of classes | |
template<class T > | |
static shared_ptr< T > | build (const Setting &element, const string &name, SettingPresence settingPresence=optional) |
template<class T > | |
static shared_ptr< T > | build (const Setting &element, const int index, SettingPresence settingPresence=optional) |
Initialization of structures | |
template<class T > | |
static bool | get (T &instance, const Setting &element, const string &name, SettingPresence settingPresence=optional) |
template<class T > | |
static bool | get (T &instance, const Setting &element, const int index, SettingPresence settingPresence=optional) |
template<class T > | |
static bool | get (T &instance, const Setting &element) |
The existing instance of type T is initialized with values stored in the Setting element directly. | |
Initialization of arrays Array<T> | |
template<class T > | |
static bool | get (Array< T > &array_to_load, const Setting &element, const string &name, SettingPresence settingPresence=optional) |
template<class T > | |
static bool | get (Array< T > &array_to_load, const Setting &element, const int index, SettingPresence settingPresence=optional) |
template<class T > | |
static bool | get (Array< T > &array_to_load, const Setting &element) |
The existing array of type T is initialized with values stored in the Setting element. | |
Serialization of objects and structures into a new Setting | |
template<class T > | |
static void | save (const T *const instance, Setting &element, const string &name="") |
A root descendant instance is stored in the new child Setting appended to the passed element. | |
template<class T > | |
static void | save (const shared_ptr< T > &instance, Setting &element, const string &name="") |
template<class T > | |
static void | save (const Array< T > &array_to_save, Setting &element, const string &name="") |
An Array<T> instance is stored in the new child Setting appended to the passed element. | |
static void | save (const mat &matrix, Setting &element, const string &name="") |
A matrix(of type mat) is stored in the new child Setting appended to the passed element. | |
static void | save (const ivec &vec, Setting &element, const string &name="") |
An integer vector (of type ivec) is stored in the new child Setting appended to the passed element. | |
static void | save (const vec &vector, Setting &element, const string &name="") |
A double vector (of type vec) is stored in the new child Setting appended to the passed element. | |
static void | save (const string &str, Setting &element, const string &name="") |
A string is stored in the new child Setting appended to the passed element. | |
static void | save (const int &integer, Setting &element, const string &name="") |
An integer is stored in the new child Setting appended to the passed element. | |
static void | save (const double &real, Setting &element, const string &name="") |
A double is stored in the new child Setting appended to the passed element. | |
Protected Member Functions | |
UI (const string &class_name, const type_info *const class_type_info) | |
Constructor for internal use only, see. |
bdm::UI::UI | ( | const string & | class_name, | |
const type_info *const | class_type_info | |||
) | [inline, protected] |
Constructor for internal use only, see.
static shared_ptr<T> bdm::UI::build | ( | const Setting & | element, | |
const int | index, | |||
SettingPresence | settingPresence = optional | |||
) | [inline, static] |
The new instance of type T* is constructed and initialized with values stored in the Setting element[index]
If there is not any sub-element indexed by index, and settingPresence is optional, an empty shared_ptr<T> is returned. When settingPresence is compulsory, the returned shared_ptr<T> is never empty (an exception is thrown when the object isn't found).
static shared_ptr<T> bdm::UI::build | ( | const Setting & | element, | |
const string & | name, | |||
SettingPresence | settingPresence = optional | |||
) | [inline, static] |
The new instance of type T* is constructed and initialized with values stored in the Setting element[name]
If there is not any sub-element named name and settingPresence is optional, an empty shared_ptr<T> is returned. When settingPresence is compulsory, the returned shared_ptr<T> is never empty (an exception is thrown when the object isn't found).
static bool bdm::UI::get | ( | Array< T > & | array_to_load, | |
const Setting & | element, | |||
const int | index, | |||
SettingPresence | settingPresence = optional | |||
) | [inline, static] |
The existing array of type T is initialized with values stored in the Setting element[index] If there is not any sub-element indexed by index, this method returns false.
static bool bdm::UI::get | ( | Array< T > & | array_to_load, | |
const Setting & | element, | |||
const string & | name, | |||
SettingPresence | settingPresence = optional | |||
) | [inline, static] |
The existing array of type T is initialized with values stored in the Setting element[name] If there is not any sub-element named name, this method returns false.
static bool bdm::UI::get | ( | T & | instance, | |
const Setting & | element, | |||
const int | index, | |||
SettingPresence | settingPresence = optional | |||
) | [inline, static] |
The existing instance of type T is initialized with values stored in the Setting element[index] If there is not any sub-element indexed by index, this method returns false.
static bool bdm::UI::get | ( | T & | instance, | |
const Setting & | element, | |||
const string & | name, | |||
SettingPresence | settingPresence = optional | |||
) | [inline, static] |
The existing instance of type T is initialized with values stored in the Setting element[name] If there is not any sub-element named name, this method returns false.
Referenced by bdm::mexDS::from_setting(), bdm::merger_base::from_setting(), bdm::Kalman< fsqmat >::from_setting(), bdm::StateSpace< fsqmat >::from_setting(), bdm::MultiModel::from_setting(), bdm::EKFCh::from_setting(), bdm::enorm< sq_T >::from_setting(), bdm::mgamma::from_setting(), bdm::mgnorm< sq_T >::from_setting(), bdm::mlnorm< chmat >::from_setting(), bdm::euni::from_setting(), bdm::egamma::from_setting(), bdm::egiw::from_setting(), bdm::mlognorm::from_setting(), bdm::migamma_ref::from_setting(), bdm::mprod::from_setting(), bdm::discrete_support::from_setting(), bdm::rectangular_support::from_setting(), bdm::MpdfDS::from_setting(), bdm::MemDS::from_setting(), bdm::ArxDS::from_setting(), bdm::Controller::from_setting(), bdm::BM::from_setting(), bdm::RV::from_setting(), bdm::ARX::from_setting(), and bdm::LQG_ARX::from_settings().