Bayeux
3.4.1
Core Foundation library for SuperNEMO
|
Configuration item with an embedded parameter or variant model handle through a smart pointer. More...
#include <bayeux/datatools/configuration/utils.h>
Public Types | |
enum | model_type { MODEL_UNDEFINED = 0, MODEL_PARAMETER = 1, MODEL_VARIANT = 2 } |
Type of item (parameter or variant) More... | |
Public Member Functions | |
model_item () | |
Default constructor. More... | |
virtual | ~model_item () |
Destructor. More... | |
void | reset () |
Reset the item. More... | |
const std::string & | get_name () const |
Return the name. More... | |
void | set_name (const std::string &name_) |
Set the name. More... | |
bool | is_parameter () const |
Check if item is a parameter. More... | |
bool | is_variant () const |
Check if item is a variant. More... | |
bool | has_model () const |
Check if model is defined. More... | |
void | set_model (model_type) |
Set the type of the item. More... | |
model_type | get_model () const |
Return the type of the item. More... | |
const properties & | get_config () const |
Return a non mutable reference to the list of configuration parameters. More... | |
properties & | grab_config () |
Return a mutable reference to the list of configuration parameters. More... | |
const parameter_model & | get_parameter_model () const |
Return a non mutable reference to the embedded parameter item. More... | |
parameter_model & | grab_parameter_model () |
Return a mutable reference to the embedded parameter item. More... | |
const variant_model & | get_variant_model () const |
Return a non mutable reference to the embedded variant item. More... | |
variant_model & | grab_variant_model () |
Return a mutable reference to the embedded variant item. More... | |
void | set_parameter_handle (const pm_handle_type &) |
Set the parameter item by handle. More... | |
void | set_variant_handle (const vm_handle_type &) |
Set the variant item by handle. More... | |
bool | is_instantiated () const |
Check if the item is instantiated. More... | |
void | instantiate (model_item_dict_type &) |
Instantiate the embedded item. More... | |
void | destroy () |
Destroy the embedded item. More... | |
const pm_handle_type & | get_parameter_handle () const |
Return a non mutable handle to the embedded parameter. More... | |
pm_handle_type & | grab_parameter_handle () |
Return a mutable handle to the embedded parameter. More... | |
const vm_handle_type & | get_variant_handle () const |
Return a non mutable handle to the embedded variant. More... | |
vm_handle_type & | grab_variant_handle () |
Return a mutable handle to the embedded variant. More... | |
parameter_model & | make_parameter (const std::string &name_="") |
Create a new embedded parameter item. More... | |
variant_model & | make_variant (const std::string &name_="") |
Create a new embedded variant item. More... | |
virtual void | tree_dump (std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const |
Smart print. More... | |
Static Public Member Functions | |
static std::string | label_from_model_type (model_type) |
Return the label associated to a item type. More... | |
static model_type | model_type_from_label (const std::string &) |
Return the item type associated to label. More... | |
static const std::string & | variant_suffix () |
Return the conventional variant suffix. More... | |
static const std::string & | parameter_suffix () |
Return the conventional parameter suffix. More... | |
static parameter_model & | add_parameter_item (model_item_dict_type &dict_, const std::string &name_) |
Add a parameter item in a dictionary. More... | |
static variant_model & | add_variant_item (model_item_dict_type &dict_, const std::string &name_) |
Add a variant item in a dictionary. More... | |
static bool | has_item (const model_item_dict_type &dict_, const std::string &name_, model_item::model_type t_=MODEL_UNDEFINED) |
Check if item with given name exists in a dictionary. More... | |
static const parameter_model & | get_parameter_model (const model_item_dict_type &dict_, const std::string &name_) |
Return a parameter model from a dictionary. More... | |
static const variant_model & | get_variant_model (const model_item_dict_type &dict_, const std::string &name_) |
Return a variant model from a dictionary. More... | |
static void | remove_item (model_item_dict_type &dict_, const std::string &name_) |
Remove an item from a dictionary. More... | |
static void | print_items (const model_item_dict_type &dict_, std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) |
Smart print of a dictionary. More... | |
Configuration item with an embedded parameter or variant model handle through a smart pointer.
datatools::configuration::model_item::model_item | ( | ) |
Default constructor.
|
virtual |
Destructor.
|
static |
Add a parameter item in a dictionary.
|
static |
Add a variant item in a dictionary.
void datatools::configuration::model_item::destroy | ( | ) |
Destroy the embedded item.
const properties& datatools::configuration::model_item::get_config | ( | ) | const |
Return a non mutable reference to the list of configuration parameters.
model_type datatools::configuration::model_item::get_model | ( | ) | const |
Return the type of the item.
const std::string& datatools::configuration::model_item::get_name | ( | ) | const |
Return the name.
const pm_handle_type& datatools::configuration::model_item::get_parameter_handle | ( | ) | const |
Return a non mutable handle to the embedded parameter.
const parameter_model& datatools::configuration::model_item::get_parameter_model | ( | ) | const |
Return a non mutable reference to the embedded parameter item.
|
static |
Return a parameter model from a dictionary.
const vm_handle_type& datatools::configuration::model_item::get_variant_handle | ( | ) | const |
Return a non mutable handle to the embedded variant.
const variant_model& datatools::configuration::model_item::get_variant_model | ( | ) | const |
Return a non mutable reference to the embedded variant item.
|
static |
Return a variant model from a dictionary.
properties& datatools::configuration::model_item::grab_config | ( | ) |
Return a mutable reference to the list of configuration parameters.
pm_handle_type& datatools::configuration::model_item::grab_parameter_handle | ( | ) |
Return a mutable handle to the embedded parameter.
parameter_model& datatools::configuration::model_item::grab_parameter_model | ( | ) |
Return a mutable reference to the embedded parameter item.
vm_handle_type& datatools::configuration::model_item::grab_variant_handle | ( | ) |
Return a mutable handle to the embedded variant.
variant_model& datatools::configuration::model_item::grab_variant_model | ( | ) |
Return a mutable reference to the embedded variant item.
|
static |
Check if item with given name exists in a dictionary.
bool datatools::configuration::model_item::has_model | ( | ) | const |
Check if model is defined.
void datatools::configuration::model_item::instantiate | ( | model_item_dict_type & | ) |
Instantiate the embedded item.
bool datatools::configuration::model_item::is_instantiated | ( | ) | const |
Check if the item is instantiated.
bool datatools::configuration::model_item::is_parameter | ( | ) | const |
Check if item is a parameter.
bool datatools::configuration::model_item::is_variant | ( | ) | const |
Check if item is a variant.
|
static |
Return the label associated to a item type.
parameter_model& datatools::configuration::model_item::make_parameter | ( | const std::string & | name_ = "" | ) |
Create a new embedded parameter item.
variant_model& datatools::configuration::model_item::make_variant | ( | const std::string & | name_ = "" | ) |
Create a new embedded variant item.
|
static |
Return the item type associated to label.
|
static |
Return the conventional parameter suffix.
|
static |
Smart print of a dictionary.
|
static |
Remove an item from a dictionary.
void datatools::configuration::model_item::reset | ( | ) |
Reset the item.
void datatools::configuration::model_item::set_model | ( | model_type | ) |
Set the type of the item.
void datatools::configuration::model_item::set_name | ( | const std::string & | name_ | ) |
Set the name.
void datatools::configuration::model_item::set_parameter_handle | ( | const pm_handle_type & | ) |
Set the parameter item by handle.
void datatools::configuration::model_item::set_variant_handle | ( | const vm_handle_type & | ) |
Set the variant item by handle.
|
virtual |
Smart print.
|
static |
Return the conventional variant suffix.