Bayeux  3.4.1
Core Foundation library for SuperNEMO
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
mygsl::parameter_store Class Reference

Store of parameters. More...

#include <bayeux/mygsl/parameter_store.h>

Inheritance diagram for mygsl::parameter_store:
datatools::i_tree_dumpable

Classes

struct  i_subscriber
 Subscriber. More...
 
struct  parameter_record
 Parameter record. More...
 

Public Types

typedef boost::variant< bool, int, double, std::string > param_type
 Type alias for parameter value. More...
 
typedef std::map< std::string, parameter_recordparameter_dict_type
 Type alias for a dictionary of parameter records. More...
 
typedef std::vector< parameter_record * > indexed_parameter_col_type
 Type alias for an array of parameter record handles. More...
 
- Public Types inherited from datatools::i_tree_dumpable
enum  ostream_type { OSTREAM_COUT = 1, OSTREAM_CERR = 2, OSTREAM_CLOG = 3 }
 Enumeration for standard output streams. More...
 

Public Member Functions

 parameter_store ()
 Default constructor. More...
 
virtual ~parameter_store ()
 Destructor. More...
 
void reset ()
 Reset the store. More...
 
int add (const std::string &name_, datatools::basic_type type_, const std::string &description_)
 Add a parameter. More...
 
void remove (const std::string &name_)
 Remove parameter. More...
 
bool has (const std::string &name_) const
 Check if a parameter exists. More...
 
const parameter_recordget (const std::string &name_) const
 Return a non mutable parameter record by name. More...
 
parameter_recordgrab (const std::string &name_)
 Return a mutable parameter record by name. More...
 
bool index_is_valid (int index_) const
 Check if a parameter idnex is valid. More...
 
const parameter_recordget (int index_, bool do_check_=true) const
 Return a non mutable parameter record by index. More...
 
parameter_recordgrab (int index_, bool do_check_=true)
 Return a mutable parameter record by index. More...
 
int get_parameter_index (const std::string &parameter_name_) const
 Return the index associated to a parameter given its name. More...
 
void update ()
 Update. More...
 
virtual void tree_dump (std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
 Main interface method for smart dump. More...
 
bool is_registered_subscriber (const i_subscriber &s_) const
 Check is a subscriber object is currently a subscriber of the store. More...
 
void register_subscriber (i_subscriber &)
 Register a subscriber. More...
 
void unregister_subscriber (i_subscriber &)
 Unregister a subscriber. More...
 
- Public Member Functions inherited from datatools::i_tree_dumpable
 i_tree_dumpable ()
 Constructor. More...
 
virtual ~i_tree_dumpable ()
 Destructor. More...
 
virtual void print_tree (std::ostream &out_=std::clog, const boost::property_tree::ptree &options_=empty_options()) const
 Main new interface method for printing. More...
 
void print_tree_json (std::ostream &out_=std::clog, const std::string &json_options_="") const
 Printing with jsonized options. More...
 
void print_tree_json (std::ostream &out_=std::clog, const char *json_options_=nullptr) const
 Printing with jsonized options. More...
 
void tree_dump_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="", const std::string &indent_="", const bool inherit_=false) const
 
void tree_print_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="") const
 
void smart_print_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="", const std::string &indent_="") const
 

Static Public Attributes

static const int INVALID_INDEX = -1
 

Protected Member Functions

void _update_parameters ()
 Update parameters action. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from datatools::i_tree_dumpable
static const boost::property_tree::ptree & empty_options ()
 
static boost::property_tree::ptree make_base_print_options (const std::string &title_, const std::string &indent_="", const bool inherit_=false)
 
static std::ostream & last_skip_tag (std::ostream &out_)
 
static std::ostream & skip_tag (std::ostream &out_)
 
static std::ostream & last_tag (std::ostream &out_)
 
static std::ostream & tag (std::ostream &out_)
 

Detailed Description

Store of parameters.

Member Typedef Documentation

◆ indexed_parameter_col_type

Type alias for an array of parameter record handles.

◆ param_type

typedef boost::variant<bool, int, double, std::string> mygsl::parameter_store::param_type

Type alias for parameter value.

◆ parameter_dict_type

Type alias for a dictionary of parameter records.

Constructor & Destructor Documentation

◆ parameter_store()

mygsl::parameter_store::parameter_store ( )

Default constructor.

◆ ~parameter_store()

virtual mygsl::parameter_store::~parameter_store ( )
virtual

Destructor.

Member Function Documentation

◆ _update_parameters()

void mygsl::parameter_store::_update_parameters ( )
protected

Update parameters action.

◆ add()

int mygsl::parameter_store::add ( const std::string &  name_,
datatools::basic_type  type_,
const std::string &  description_ 
)

Add a parameter.

◆ get() [1/2]

const parameter_record& mygsl::parameter_store::get ( const std::string &  name_) const

Return a non mutable parameter record by name.

◆ get() [2/2]

const parameter_record& mygsl::parameter_store::get ( int  index_,
bool  do_check_ = true 
) const

Return a non mutable parameter record by index.

◆ get_parameter_index()

int mygsl::parameter_store::get_parameter_index ( const std::string &  parameter_name_) const

Return the index associated to a parameter given its name.

◆ grab() [1/2]

parameter_record& mygsl::parameter_store::grab ( const std::string &  name_)

Return a mutable parameter record by name.

◆ grab() [2/2]

parameter_record& mygsl::parameter_store::grab ( int  index_,
bool  do_check_ = true 
)

Return a mutable parameter record by index.

◆ has()

bool mygsl::parameter_store::has ( const std::string &  name_) const

Check if a parameter exists.

◆ index_is_valid()

bool mygsl::parameter_store::index_is_valid ( int  index_) const

Check if a parameter idnex is valid.

◆ is_registered_subscriber()

bool mygsl::parameter_store::is_registered_subscriber ( const i_subscriber s_) const

Check is a subscriber object is currently a subscriber of the store.

◆ register_subscriber()

void mygsl::parameter_store::register_subscriber ( i_subscriber )

Register a subscriber.

◆ remove()

void mygsl::parameter_store::remove ( const std::string &  name_)

Remove parameter.

◆ reset()

void mygsl::parameter_store::reset ( )

Reset the store.

◆ tree_dump()

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

Main interface method for smart dump.

Reimplemented from datatools::i_tree_dumpable.

◆ unregister_subscriber()

void mygsl::parameter_store::unregister_subscriber ( i_subscriber )

Unregister a subscriber.

◆ update()

void mygsl::parameter_store::update ( )

Update.

Member Data Documentation

◆ INVALID_INDEX

const int mygsl::parameter_store::INVALID_INDEX = -1
static

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