21 #ifndef MYGSL_PARAMETER_STORE_H 22 #define MYGSL_PARAMETER_STORE_H 32 #include <boost/variant.hpp> 47 typedef boost::variant<bool, int, double, std::string>
param_type;
69 void set_name(
const std::string & name_);
72 const std::string &
get_name()
const;
127 std::string _description_;
158 int add(
const std::string & name_,
160 const std::string & description_);
163 void remove(
const std::string & name_);
166 bool has(
const std::string & name_)
const;
190 virtual void tree_dump(std::ostream & out_ = std::clog,
191 const std::string & title_ =
"",
192 const std::string & indent_ =
"",
193 bool inherit_ =
false)
const;
213 std::list<i_subscriber*> _subscribers_;
219 #endif // MYGSL_PARAMETER_STORE_H void set_real_value(double, bool update_=true)
parameter_store()
Default constructor.
const std::string & get_description() const
Return the parameter description.
bool has(const std::string &name_) const
Check if a parameter exists.
void unset_value(bool update_=true)
void register_subscriber(i_subscriber &)
Register a subscriber.
bool is_boolean() const
Check if the parameter is boolean.
parameter_record()
Default constructor.
int add(const std::string &name_, datatools::basic_type type_, const std::string &description_)
Add a parameter.
const std::string & to_string() const
parameter_record & grab(const std::string &name_)
Return a mutable parameter record by name.
void unregister_subscriber(i_subscriber &)
Unregister a subscriber.
const parameter_record & get(const std::string &name_) const
Return a non mutable parameter record by name.
void reset()
Reset the store.
Subscriber.
Definition: parameter_store.h:137
virtual void update_parameters()=0
Action performed when parameters have changed.
void set_type(datatools::basic_type)
Set the parameter type.
void set_integer_value(int, bool update_=true)
Parameter record.
Definition: parameter_store.h:50
void set_name(const std::string &name_)
Set the parameter name.
std::map< std::string, parameter_record > parameter_dict_type
Type alias for a dictionary of parameter records.
Definition: parameter_store.h:143
static const int INVALID_INDEX
Definition: parameter_store.h:44
void set_string_value(const std::string &, bool update_=true)
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.
int get_parameter_index(const std::string ¶meter_name_) const
Return the index associated to a parameter given its name.
bool is_registered_subscriber(const i_subscriber &s_) const
Check is a subscriber object is currently a subscriber of the store.
std::vector< parameter_record * > indexed_parameter_col_type
Type alias for an array of parameter record handles.
Definition: parameter_store.h:146
bool is_real() const
Check if the parameter is real.
const std::string & get_name() const
Return the parameter name.
int get_index() const
Return the parameter index.
void set_description(const std::string &description_)
Set the parameter description.
bool is_string() const
Check if the parameter is string.
boost::variant< bool, int, double, std::string > param_type
Type alias for parameter value.
Definition: parameter_store.h:47
Top-level namespace of the Bayeux/mygsl module library.
Definition: base_decay_driver.h:47
void set_boolean_value(bool, bool update_=true)
void set_parent(parameter_store &)
Set parent store.
bool index_is_valid(int index_) const
Check if a parameter idnex is valid.
virtual ~parameter_store()
Destructor.
void remove(const std::string &name_)
Remove parameter.
bool is_integer() const
Check if the parameter is integer.
bool is_value_set() const
Value is set.
void set_index(int index_)
Set the parameter index.
datatools::basic_type get_type() const
Return the parameter type.
Store of parameters.
Definition: parameter_store.h:40
void _update_parameters()
Update parameters action.