Bayeux  3.4.1
Core Foundation library for SuperNEMO
Public Types | Public Member Functions | Static Public Member Functions | List of all members
datatools::configuration::model_item Class Reference

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 propertiesget_config () const
 Return a non mutable reference to the list of configuration parameters. More...
 
propertiesgrab_config ()
 Return a mutable reference to the list of configuration parameters. More...
 
const parameter_modelget_parameter_model () const
 Return a non mutable reference to the embedded parameter item. More...
 
parameter_modelgrab_parameter_model ()
 Return a mutable reference to the embedded parameter item. More...
 
const variant_modelget_variant_model () const
 Return a non mutable reference to the embedded variant item. More...
 
variant_modelgrab_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_typeget_parameter_handle () const
 Return a non mutable handle to the embedded parameter. More...
 
pm_handle_typegrab_parameter_handle ()
 Return a mutable handle to the embedded parameter. More...
 
const vm_handle_typeget_variant_handle () const
 Return a non mutable handle to the embedded variant. More...
 
vm_handle_typegrab_variant_handle ()
 Return a mutable handle to the embedded variant. More...
 
parameter_modelmake_parameter (const std::string &name_="")
 Create a new embedded parameter item. More...
 
variant_modelmake_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_modeladd_parameter_item (model_item_dict_type &dict_, const std::string &name_)
 Add a parameter item in a dictionary. More...
 
static variant_modeladd_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_modelget_parameter_model (const model_item_dict_type &dict_, const std::string &name_)
 Return a parameter model from a dictionary. More...
 
static const variant_modelget_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...
 

Detailed Description

Configuration item with an embedded parameter or variant model handle through a smart pointer.

Member Enumeration Documentation

◆ model_type

Type of item (parameter or variant)

Enumerator
MODEL_UNDEFINED 

Undefined model type.

MODEL_PARAMETER 

Parameter model.

MODEL_VARIANT 

Variant model.

Constructor & Destructor Documentation

◆ model_item()

datatools::configuration::model_item::model_item ( )

Default constructor.

◆ ~model_item()

virtual datatools::configuration::model_item::~model_item ( )
virtual

Destructor.

Member Function Documentation

◆ add_parameter_item()

static parameter_model& datatools::configuration::model_item::add_parameter_item ( model_item_dict_type dict_,
const std::string &  name_ 
)
static

Add a parameter item in a dictionary.

◆ add_variant_item()

static variant_model& datatools::configuration::model_item::add_variant_item ( model_item_dict_type dict_,
const std::string &  name_ 
)
static

Add a variant item in a dictionary.

◆ destroy()

void datatools::configuration::model_item::destroy ( )

Destroy the embedded item.

◆ get_config()

const properties& datatools::configuration::model_item::get_config ( ) const

Return a non mutable reference to the list of configuration parameters.

◆ get_model()

model_type datatools::configuration::model_item::get_model ( ) const

Return the type of the item.

◆ get_name()

const std::string& datatools::configuration::model_item::get_name ( ) const

Return the name.

◆ get_parameter_handle()

const pm_handle_type& datatools::configuration::model_item::get_parameter_handle ( ) const

Return a non mutable handle to the embedded parameter.

◆ get_parameter_model() [1/2]

const parameter_model& datatools::configuration::model_item::get_parameter_model ( ) const

Return a non mutable reference to the embedded parameter item.

◆ get_parameter_model() [2/2]

static const parameter_model& datatools::configuration::model_item::get_parameter_model ( const model_item_dict_type dict_,
const std::string &  name_ 
)
static

Return a parameter model from a dictionary.

◆ get_variant_handle()

const vm_handle_type& datatools::configuration::model_item::get_variant_handle ( ) const

Return a non mutable handle to the embedded variant.

◆ get_variant_model() [1/2]

const variant_model& datatools::configuration::model_item::get_variant_model ( ) const

Return a non mutable reference to the embedded variant item.

◆ get_variant_model() [2/2]

static const variant_model& datatools::configuration::model_item::get_variant_model ( const model_item_dict_type dict_,
const std::string &  name_ 
)
static

Return a variant model from a dictionary.

◆ grab_config()

properties& datatools::configuration::model_item::grab_config ( )

Return a mutable reference to the list of configuration parameters.

◆ grab_parameter_handle()

pm_handle_type& datatools::configuration::model_item::grab_parameter_handle ( )

Return a mutable handle to the embedded parameter.

◆ grab_parameter_model()

parameter_model& datatools::configuration::model_item::grab_parameter_model ( )

Return a mutable reference to the embedded parameter item.

◆ grab_variant_handle()

vm_handle_type& datatools::configuration::model_item::grab_variant_handle ( )

Return a mutable handle to the embedded variant.

◆ grab_variant_model()

variant_model& datatools::configuration::model_item::grab_variant_model ( )

Return a mutable reference to the embedded variant item.

◆ has_item()

static bool datatools::configuration::model_item::has_item ( const model_item_dict_type dict_,
const std::string &  name_,
model_item::model_type  t_ = MODEL_UNDEFINED 
)
static

Check if item with given name exists in a dictionary.

◆ has_model()

bool datatools::configuration::model_item::has_model ( ) const

Check if model is defined.

◆ instantiate()

void datatools::configuration::model_item::instantiate ( model_item_dict_type )

Instantiate the embedded item.

◆ is_instantiated()

bool datatools::configuration::model_item::is_instantiated ( ) const

Check if the item is instantiated.

◆ is_parameter()

bool datatools::configuration::model_item::is_parameter ( ) const

Check if item is a parameter.

◆ is_variant()

bool datatools::configuration::model_item::is_variant ( ) const

Check if item is a variant.

◆ label_from_model_type()

static std::string datatools::configuration::model_item::label_from_model_type ( model_type  )
static

Return the label associated to a item type.

◆ make_parameter()

parameter_model& datatools::configuration::model_item::make_parameter ( const std::string &  name_ = "")

Create a new embedded parameter item.

◆ make_variant()

variant_model& datatools::configuration::model_item::make_variant ( const std::string &  name_ = "")

Create a new embedded variant item.

◆ model_type_from_label()

static model_type datatools::configuration::model_item::model_type_from_label ( const std::string &  )
static

Return the item type associated to label.

◆ parameter_suffix()

static const std::string& datatools::configuration::model_item::parameter_suffix ( )
static

Return the conventional parameter suffix.

◆ print_items()

static void datatools::configuration::model_item::print_items ( const model_item_dict_type dict_,
std::ostream &  out_ = std::clog,
const std::string &  title_ = "",
const std::string &  indent_ = "",
bool  inherit_ = false 
)
static

Smart print of a dictionary.

◆ remove_item()

static void datatools::configuration::model_item::remove_item ( model_item_dict_type dict_,
const std::string &  name_ 
)
static

Remove an item from a dictionary.

◆ reset()

void datatools::configuration::model_item::reset ( )

Reset the item.

◆ set_model()

void datatools::configuration::model_item::set_model ( model_type  )

Set the type of the item.

◆ set_name()

void datatools::configuration::model_item::set_name ( const std::string &  name_)

Set the name.

◆ set_parameter_handle()

void datatools::configuration::model_item::set_parameter_handle ( const pm_handle_type )

Set the parameter item by handle.

◆ set_variant_handle()

void datatools::configuration::model_item::set_variant_handle ( const vm_handle_type )

Set the variant item by handle.

◆ tree_dump()

virtual void datatools::configuration::model_item::tree_dump ( std::ostream &  out_ = std::clog,
const std::string &  title_ = "",
const std::string &  indent_ = "",
bool  inherit_ = false 
) const
virtual

Smart print.

◆ variant_suffix()

static const std::string& datatools::configuration::model_item::variant_suffix ( )
static

Return the conventional variant suffix.


The documentation for this class was generated from the following file: