Bayeux
3.4.1
Core Foundation library for SuperNEMO
|
A container of mapped properties objects. More...
#include <bayeux/datatools/multi_properties.h>
Classes | |
class | config |
Reader/writer class for multi_properties objects. More... | |
struct | defaults |
Default values. More... | |
class | entry |
Section entry handle internal data stored within the dictionary of the multi_properties class. More... | |
Public Types | |
typedef std::map< std::string, entry > | entries_col_type |
Dictionary of section. More... | |
typedef std::list< entry * > | entries_ordered_col_type |
List of handles on sections. 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 | |
multi_properties () | |
Default constructor. More... | |
multi_properties (const std::string &key_label_, const std::string &meta_label_) | |
Constructor specifying key label and meta label. More... | |
multi_properties (const std::string &key_label_, const std::string &meta_label_, const std::string &description_, bool debug_=false) | |
Constructor specifying key label, meta label, description and debug flag. More... | |
virtual | ~multi_properties () |
Destructor. More... | |
multi_properties (const multi_properties &) | |
Copy constructor. More... | |
multi_properties & | operator= (const multi_properties &) |
Assignment operator. More... | |
bool | is_debug () const |
Check the debug flag. More... | |
void | set_debug (bool=true) |
Set the debug flag. More... | |
void | set_description (const std::string &description_) |
Set the description. More... | |
bool | has_description () const |
Check if a description is available. More... | |
const std::string & | get_description () const |
Get the description. More... | |
bool | has_key_label () const |
Check if the key label is set. More... | |
void | set_key_label (const std::string &key_label_) |
Set the key label. More... | |
void | clear_key_label () |
Clear the key label. More... | |
const std::string & | get_key_label () const |
Return the key label. More... | |
bool | has_meta_label () const |
Check if the meta label is set. More... | |
void | set_meta_label (const std::string &meta_label_) |
Set the meta label. More... | |
void | clear_meta_label () |
Clear the meta label. More... | |
const std::string & | get_meta_label () const |
Return the meta label. More... | |
uint32_t | size () const |
Return the number of entries. More... | |
bool | empty () const |
Check if the collection of entries is empty. More... | |
void | reset () |
Reset. More... | |
virtual void | clear () |
Clear the dictionary of sections. More... | |
const entries_col_type & | entries () const |
Return the const reference to the collection of entries. More... | |
const entries_ordered_col_type & | ordered_entries () const |
Return the const reference to the ordered collection of entries. More... | |
const entry & | get (const std::string &key_) const |
Return a const reference to the stored entry. More... | |
entry & | grab (const std::string &key_) |
Return a mutable reference to the stored entry. More... | |
bool | has_key (const std::string &key_) const |
Check if a section with a given key exists. More... | |
bool | has_key_with_meta (const std::string &key_, const std::string &meta_) const |
Check if a section with given key and meta exists. More... | |
const std::string & | key (int) const |
Returns the ith key. More... | |
const std::string & | ordered_key (int) const |
Returns the ith ordered key. More... | |
std::vector< std::string > | keys () const |
Return an array of keys. More... | |
void | keys (std::vector< std::string > &keys_) const |
Build an array of keys. More... | |
std::vector< std::string > | ordered_keys () const |
Return an array of orderered keys. More... | |
void | ordered_keys (std::vector< std::string > &keys_) const |
Build an array of orderered keys. More... | |
bool | has_section (const std::string &key_) const |
Check if a section exists. More... | |
const properties & | get_section (const std::string &key_) const |
Return the const reference to the properties store in a section. More... | |
const properties & | get_section_const (const std::string &key_) const |
Return the const reference to the properties store in a section. More... | |
properties & | grab_section (const std::string &key_) |
Return the mutable reference to the properties store in a section. More... | |
void | add (const std::string &key_, const std::string &meta_, const properties &props_) |
Add a new section with primary key, meta information text and a collection of properties. More... | |
void | add (const std::string &key_, const properties &props_) |
Add a new section with primary key and a collection of properties. More... | |
void | add (const std::string &key_, const std::string &meta_="") |
Add an empty section with primary key and meta information text. More... | |
properties & | add_section (const std::string &key_, const std::string &meta_="") |
Add a new section with primary key and meta information text and return a mutable reference to the store collection of properties. More... | |
void | remove (const std::string &key_) |
Remove a section. More... | |
void | write (const std::string &filename_, uint32_t options_=config::HEADER_FOOTER|config::SKIP_PRIVATE_SECTIONS) const |
Write to a configuration file. More... | |
void | read (const std::string &filename_, uint32_t options_=0) |
Read from a configuration file. More... | |
void | dump (std::ostream &out_=std::clog) const |
Basic print. More... | |
void | print_tree (std::ostream &out_=std::clog, const boost::property_tree::ptree &options_=empty_options()) const override |
Smart print. More... | |
virtual void | tree_dump (std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const |
Public Member Functions inherited from datatools::i_serializable | |
i_serializable () | |
Default constructor. More... | |
virtual | ~i_serializable () |
Destructor. More... | |
virtual const std::string & | get_serial_tag () const =0 |
Return the serialization string identifier of the class. More... | |
Public Member Functions inherited from datatools::i_clear | |
virtual | ~i_clear () |
Destructor. More... | |
Public Member Functions inherited from datatools::i_tree_dumpable | |
i_tree_dumpable () | |
Constructor. More... | |
virtual | ~i_tree_dumpable () |
Destructor. 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 |
Public Member Functions inherited from datatools::i_cloneable | |
virtual i_cloneable * | clone (void) const =0 |
virtual | ~i_cloneable () |
template<class CandidateType > | |
bool | is_cloneable (const CandidateType &candidate_) |
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_) |
Static Public Member Functions inherited from datatools::i_cloneable | |
template<class Copyable > | |
static Copyable * | clone_it (const Copyable &a_copyable) |
A container of mapped properties objects.
typedef std::map<std::string, entry> datatools::multi_properties::entries_col_type |
Dictionary of section.
typedef std::list<entry*> datatools::multi_properties::entries_ordered_col_type |
List of handles on sections.
datatools::multi_properties::multi_properties | ( | ) |
Default constructor.
datatools::multi_properties::multi_properties | ( | const std::string & | key_label_, |
const std::string & | meta_label_ | ||
) |
Constructor specifying key label and meta label.
datatools::multi_properties::multi_properties | ( | const std::string & | key_label_, |
const std::string & | meta_label_, | ||
const std::string & | description_, | ||
bool | debug_ = false |
||
) |
Constructor specifying key label, meta label, description and debug flag.
|
virtual |
Destructor.
datatools::multi_properties::multi_properties | ( | const multi_properties & | ) |
Copy constructor.
void datatools::multi_properties::add | ( | const std::string & | key_, |
const std::string & | meta_, | ||
const properties & | props_ | ||
) |
Add a new section with primary key, meta information text and a collection of properties.
void datatools::multi_properties::add | ( | const std::string & | key_, |
const properties & | props_ | ||
) |
Add a new section with primary key and a collection of properties.
Add an empty section with primary key and meta information text.
properties& datatools::multi_properties::add_section | ( | const std::string & | key_, |
const std::string & | meta_ = "" |
||
) |
Add a new section with primary key and meta information text and return a mutable reference to the store collection of properties.
|
virtual |
Clear the dictionary of sections.
Implements datatools::i_clear.
void datatools::multi_properties::clear_key_label | ( | ) |
Clear the key label.
void datatools::multi_properties::clear_meta_label | ( | ) |
Clear the meta label.
void datatools::multi_properties::dump | ( | std::ostream & | out_ = std::clog | ) | const |
Basic print.
bool datatools::multi_properties::empty | ( | ) | const |
Check if the collection of entries is empty.
const entries_col_type& datatools::multi_properties::entries | ( | ) | const |
Return the const reference to the collection of entries.
Return a const reference to the stored entry.
const std::string& datatools::multi_properties::get_description | ( | ) | const |
Get the description.
const std::string& datatools::multi_properties::get_key_label | ( | ) | const |
Return the key label.
const std::string& datatools::multi_properties::get_meta_label | ( | ) | const |
Return the meta label.
const properties& datatools::multi_properties::get_section | ( | const std::string & | key_ | ) | const |
Return the const reference to the properties store in a section.
const properties& datatools::multi_properties::get_section_const | ( | const std::string & | key_ | ) | const |
Return the const reference to the properties store in a section.
Return a mutable reference to the stored entry.
properties& datatools::multi_properties::grab_section | ( | const std::string & | key_ | ) |
Return the mutable reference to the properties store in a section.
bool datatools::multi_properties::has_description | ( | ) | const |
Check if a description is available.
bool datatools::multi_properties::has_key | ( | const std::string & | key_ | ) | const |
Check if a section with a given key exists.
bool datatools::multi_properties::has_key_label | ( | ) | const |
Check if the key label is set.
bool datatools::multi_properties::has_key_with_meta | ( | const std::string & | key_, |
const std::string & | meta_ | ||
) | const |
Check if a section with given key and meta exists.
bool datatools::multi_properties::has_meta_label | ( | ) | const |
Check if the meta label is set.
bool datatools::multi_properties::has_section | ( | const std::string & | key_ | ) | const |
Check if a section exists.
bool datatools::multi_properties::is_debug | ( | ) | const |
Check the debug flag.
const std::string& datatools::multi_properties::key | ( | int | ) | const |
Returns the ith key.
std::vector<std::string> datatools::multi_properties::keys | ( | ) | const |
Return an array of keys.
void datatools::multi_properties::keys | ( | std::vector< std::string > & | keys_ | ) | const |
Build an array of keys.
multi_properties& datatools::multi_properties::operator= | ( | const multi_properties & | ) |
Assignment operator.
const entries_ordered_col_type& datatools::multi_properties::ordered_entries | ( | ) | const |
Return the const reference to the ordered collection of entries.
const std::string& datatools::multi_properties::ordered_key | ( | int | ) | const |
Returns the ith ordered key.
std::vector<std::string> datatools::multi_properties::ordered_keys | ( | ) | const |
Return an array of orderered keys.
void datatools::multi_properties::ordered_keys | ( | std::vector< std::string > & | keys_ | ) | const |
Build an array of orderered keys.
|
overridevirtual |
Smart print.
Reimplemented from datatools::i_tree_dumpable.
void datatools::multi_properties::read | ( | const std::string & | filename_, |
uint32_t | options_ = 0 |
||
) |
Read from a configuration file.
void datatools::multi_properties::remove | ( | const std::string & | key_ | ) |
Remove a section.
void datatools::multi_properties::reset | ( | ) |
Reset.
void datatools::multi_properties::set_debug | ( | bool | = true | ) |
Set the debug flag.
void datatools::multi_properties::set_description | ( | const std::string & | description_ | ) |
Set the description.
void datatools::multi_properties::set_key_label | ( | const std::string & | key_label_ | ) |
Set the key label.
void datatools::multi_properties::set_meta_label | ( | const std::string & | meta_label_ | ) |
Set the meta label.
uint32_t datatools::multi_properties::size | ( | ) | const |
Return the number of entries.
void datatools::multi_properties::write | ( | const std::string & | filename_, |
uint32_t | options_ = config::HEADER_FOOTER|config::SKIP_PRIVATE_SECTIONS |
||
) | const |
Write to a configuration file.