Bayeux
3.4.1
Core Foundation library for SuperNEMO
|
A generic serializable and noncopyable container for arbitrary serializable objects. More...
#include <bayeux/datatools/things.h>
Classes | |
struct | entry_type |
Internal entry for serializable object stored in the thing class. More... | |
Public Types | |
typedef std::map< std::string, entry_type > | dict_type |
Embedded dictionary of arbitrary serializable objects. 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 | |
things () | |
Default constructor. More... | |
things (const std::string &name_, const std::string &description_="") | |
Constructor with name and description. More... | |
virtual | ~things () |
const std::string & | get_name () const |
Return the name of the container. More... | |
things & | set_name (const std::string &) |
Set the name of the container. More... | |
const std::string & | get_name_impl () const |
Return the name of the container (low-level implementation) More... | |
void | set_name_impl (const std::string &) |
Set the name of the container (low-level implementation) More... | |
bool | has_name () const |
Check if the container has a name. More... | |
bool | has_name_impl () const |
Check if the container has a name (low-level implementation) More... | |
const std::string & | get_description () const |
Return the description of the container. More... | |
things & | set_description (const std::string &) |
Set the description of the container. More... | |
void | set_description_impl (const std::string &) |
Set the description of the container (low-level implementation) More... | |
const std::string & | get_description_impl () const |
Return the description of the container (low-level implementation) More... | |
bool | has_description_impl () const |
Check if the container has a description (low-level implementation) More... | |
void | reset () |
Reset the container. More... | |
virtual void | clear () |
Clear the container. More... | |
unsigned int | size () const |
Return the number of objects stored in the container. More... | |
bool | empty () const |
Check if the container is empty. More... | |
bool | has (const std::string &name_) const |
Check if the container stores an object with a given name. More... | |
bool | has_serial_tag (const std::string &name_, const std::string &serial_tag_) const |
Check if the container stores an object with a given name and a given serial tag. More... | |
bool | is_constant (const std::string &name_) const |
Check if the object stored is the container with a given name is constant. More... | |
bool | is_mutable (const std::string &name_) const |
Check if the object stored is the container with a given name is mutable. More... | |
void | set_constant (const std::string &name_, bool const_=true) |
not implemented : More... | |
const std::string & | get_description (const std::string &name_) const |
Return the description of the object stored with a given name. More... | |
const std::string & | get_entry_description (const std::string &name_) const |
Return the description of the object stored with a given name. More... | |
void | set_description (const std::string &name_, const std::string &desc_) |
Set the description of the object stored with a given name. More... | |
void | set_entry_description (const std::string &name_, const std::string &desc_) |
Set the description of the object stored with a given name. More... | |
void | get_names (std::vector< std::string > &names_) const |
Build the list of names of all objects stored in the container. More... | |
const std::string & | get_entry_name (int index_) const |
Return the name of the object stored at a given index. More... | |
void | remove (const std::string &name_) |
Remove the object stored in the container with a given name. More... | |
void | erase (const std::string &name_) |
Remove the object stored in the container with a given name. More... | |
template<class T > | |
T & | add (const std::string &name_, const std::string &desc_="", bool const_=false) |
Instantiate and add an object of given type and name. More... | |
template<class T > | |
T * | pop (const std::string &name_) |
template<class T > | |
T & | grab (const std::string &name_) |
Return a reference to a mutable object of given type and name. More... | |
template<class T > | |
bool | is_a (const std::string &name_) const |
Check if a stored object with given name is of given type. More... | |
template<class T > | |
const T & | get (const std::string &name_) const |
Return a reference to a non mutable object of given type and name. More... | |
const datatools::i_serializable & | get_entry (const std::string &name_) const |
Return a reference to a non mutable stored object of given name. More... | |
datatools::i_serializable & | grab_entry (const std::string &name_) |
Return a reference to a mutable stored object of given name. More... | |
datatools::i_serializable & | add_entry (const std::string &name_, const std::string &serial_tag_, const std::string &description_="", bool const_=false) |
Instantiate and add an object of given type id with given name, description and constness flag. More... | |
datatools::i_serializable & | add_entry_impl (const std::string &name_, const std::string &serial_tag_, const std::string &description_, bool const_) |
Instantiate and add an object of given type id with given name, description and constness flag (implementation) More... | |
bool | entry_is_a (const std::string &name_, const std::string &) const |
Check if a stored object with given name has a type with given type id. More... | |
bool | entry_is_introspectable (const std::string &name_) const |
Check if a stored object with given name is introspectable through CAMP interface. More... | |
std::string | get_entry_serial_tag (const std::string &name_) const |
Return the serial tag of a stored object with given name. More... | |
std::string | get_entry_introspection_id (const std::string &name_) const |
Return the introspection id of a stored object with given name. 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... | |
void | dump (std::ostream &out_=std::clog) const |
Basic print. More... | |
datatools::i_serializable & | grab (const std::string &name_, const std::string &serial_tag_="") |
Return a mutable reference to an object of given name and optional type id. More... | |
const datatools::i_serializable & | get (const std::string &name_, const std::string &serial_tag_="") const |
Return a non mutable reference to an object of given name and optional type id. More... | |
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_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 |
Public Member Functions inherited from datatools::i_clear | |
virtual | ~i_clear () |
Destructor. More... | |
Static Public Attributes | |
static const bool | constant |
static const bool | non_constant |
static const bool | copyable |
static const bool | noncopyable |
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_) |
A generic serializable and noncopyable container for arbitrary serializable objects.
typedef std::map<std::string, entry_type> datatools::things::dict_type |
Embedded dictionary of arbitrary serializable objects.
datatools::things::things | ( | ) |
Default constructor.
Constructor with name and description.
|
virtual |
T & datatools::things::add | ( | const std::string & | name_, |
const std::string & | desc_ = "" , |
||
bool | const_ = false |
||
) |
Instantiate and add an object of given type and name.
datatools::i_serializable& datatools::things::add_entry | ( | const std::string & | name_, |
const std::string & | serial_tag_, | ||
const std::string & | description_ = "" , |
||
bool | const_ = false |
||
) |
Instantiate and add an object of given type id with given name, description and constness flag.
datatools::i_serializable& datatools::things::add_entry_impl | ( | const std::string & | name_, |
const std::string & | serial_tag_, | ||
const std::string & | description_, | ||
bool | const_ | ||
) |
Instantiate and add an object of given type id with given name, description and constness flag (implementation)
|
virtual |
Clear the container.
Implements datatools::i_clear.
void datatools::things::dump | ( | std::ostream & | out_ = std::clog | ) | const |
Basic print.
bool datatools::things::empty | ( | ) | const |
Check if the container is empty.
Check if a stored object with given name has a type with given type id.
bool datatools::things::entry_is_introspectable | ( | const std::string & | name_ | ) | const |
Check if a stored object with given name is introspectable through CAMP interface.
void datatools::things::erase | ( | const std::string & | name_ | ) |
Remove the object stored in the container with a given name.
Return a reference to a non mutable object of given type and name.
const datatools::i_serializable& datatools::things::get | ( | const std::string & | name_, |
const std::string & | serial_tag_ = "" |
||
) | const |
Return a non mutable reference to an object of given name and optional type id.
const std::string& datatools::things::get_description | ( | ) | const |
Return the description of the container.
Return the description of the object stored with a given name.
const std::string& datatools::things::get_description_impl | ( | ) | const |
Return the description of the container (low-level implementation)
const datatools::i_serializable& datatools::things::get_entry | ( | const std::string & | name_ | ) | const |
Return a reference to a non mutable stored object of given name.
Return the description of the object stored with a given name.
std::string datatools::things::get_entry_introspection_id | ( | const std::string & | name_ | ) | const |
Return the introspection id of a stored object with given name.
const std::string& datatools::things::get_entry_name | ( | int | index_ | ) | const |
Return the name of the object stored at a given index.
std::string datatools::things::get_entry_serial_tag | ( | const std::string & | name_ | ) | const |
Return the serial tag of a stored object with given name.
const std::string& datatools::things::get_name | ( | ) | const |
Return the name of the container.
const std::string& datatools::things::get_name_impl | ( | ) | const |
Return the name of the container (low-level implementation)
void datatools::things::get_names | ( | std::vector< std::string > & | names_ | ) | const |
Build the list of names of all objects stored in the container.
T & datatools::things::grab | ( | const std::string & | name_ | ) |
Return a reference to a mutable object of given type and name.
datatools::i_serializable& datatools::things::grab | ( | const std::string & | name_, |
const std::string & | serial_tag_ = "" |
||
) |
Return a mutable reference to an object of given name and optional type id.
datatools::i_serializable& datatools::things::grab_entry | ( | const std::string & | name_ | ) |
Return a reference to a mutable stored object of given name.
bool datatools::things::has | ( | const std::string & | name_ | ) | const |
Check if the container stores an object with a given name.
bool datatools::things::has_description_impl | ( | ) | const |
Check if the container has a description (low-level implementation)
bool datatools::things::has_name | ( | ) | const |
Check if the container has a name.
bool datatools::things::has_name_impl | ( | ) | const |
Check if the container has a name (low-level implementation)
bool datatools::things::has_serial_tag | ( | const std::string & | name_, |
const std::string & | serial_tag_ | ||
) | const |
Check if the container stores an object with a given name and a given serial tag.
bool datatools::things::is_a | ( | const std::string & | name_ | ) | const |
Check if a stored object with given name is of given type.
bool datatools::things::is_constant | ( | const std::string & | name_ | ) | const |
Check if the object stored is the container with a given name is constant.
bool datatools::things::is_mutable | ( | const std::string & | name_ | ) | const |
Check if the object stored is the container with a given name is mutable.
T * datatools::things::pop | ( | const std::string & | name_ | ) |
Extract the object of given type and name and remove the corresponding entry from the container
void datatools::things::remove | ( | const std::string & | name_ | ) |
Remove the object stored in the container with a given name.
void datatools::things::reset | ( | ) |
Reset the container.
void datatools::things::set_constant | ( | const std::string & | name_, |
bool | const_ = true |
||
) |
not implemented :
Set the description of the container.
Set the description of the object stored with a given name.
void datatools::things::set_description_impl | ( | const std::string & | ) |
Set the description of the container (low-level implementation)
void datatools::things::set_entry_description | ( | const std::string & | name_, |
const std::string & | desc_ | ||
) |
Set the description of the object stored with a given name.
void datatools::things::set_name_impl | ( | const std::string & | ) |
Set the name of the container (low-level implementation)
unsigned int datatools::things::size | ( | ) | const |
Return the number of objects stored in the container.
|
virtual |
Smart print.
Reimplemented from datatools::i_tree_dumpable.
|
static |
|
static |
|
static |
|
static |