Bayeux
3.4.1
Core Foundation library for SuperNEMO
|
Template factory registration class. More...
#include <bayeux/datatools/factory.h>
Classes | |
struct | factory_record_type |
Public Types | |
typedef BaseType | base_type |
typedef boost::function< base_type *() > | factory_type |
typedef std::map< std::string, factory_record_type > | factory_map_type |
Dictionary of object factories. More... | |
Public Types inherited from datatools::base_factory_register | |
enum | flag_type { verbose = 0x1 } |
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 | |
factory_register () | |
Constructor. More... | |
factory_register (const std::string &label_, unsigned int flags_=0x0) | |
Constructor. More... | |
virtual | ~factory_register () |
Destructor. More... | |
datatools::logger::priority | get_logging_priority () const |
Returns logging priority. More... | |
void | set_logging_priority (datatools::logger::priority logging_) |
Set logging priority. More... | |
const std::string & | get_label () const |
Get the label associated to the factory. More... | |
void | set_label (const std::string &label_) |
Set the label associated to the factory. More... | |
void | list_of_factories (std::vector< std::string > &ids_) const |
Copy factory IDs into supplied vector. More... | |
bool | has (const std::string &id_) const |
Return true if factory with given ID is registered. More... | |
bool | is_group (const std::string &id_) const |
Return true if factory with given ID is registered with given group. More... | |
void | clear () |
Clear all registered factories. More... | |
void | reset () |
Reset. More... | |
factory_type & | grab (const std::string &id_) |
Return a mutable reference to a factory given by registration ID. More... | |
const factory_type & | get (const std::string &id_) const |
Return a const reference to a factory given by registration ID. More... | |
const factory_record_type & | get_record (const std::string &id_) const |
Return a const reference to a factory record given by registration ID. More... | |
void | registration (const std::string &id_, const factory_type &factory_, const std::type_info &tinfo_, const std::string &description_="", const std::string &category_="") |
Register the supplied factory under the given ID. More... | |
template<class DerivedType > | |
void | registration (const std::string &id_, const std::string &description_="", const std::string &category_="") |
Register the supplied factory under the given ID. More... | |
template<class DerivedType > | |
bool | fetch_type_id (std::string &id_) const |
Fetch the registration type ID associated to a given class. More... | |
bool | fetch_type_id (const std::type_info &tinfo_, std::string &id_) const |
Fetch the registration type ID associated to a given type_info. More... | |
void | unregistration (const std::string &id_) |
void | import (const factory_register &factory_register_) |
Import all registered factories from another factory register. More... | |
void | import_some (const factory_register &factory_register_, const std::vector< std::string > &imported_factories_) |
void | print (std::ostream &out_, const std::string &indent_="") const |
Simple print. 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... | |
Public Member Functions inherited from datatools::base_factory_register | |
base_factory_register () | |
Default constructor. More... | |
virtual | ~base_factory_register () |
Destructor. 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 |
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_) |
Template factory registration class.
typedef BaseType datatools::factory_register< BaseType >::base_type |
typedef std::map<std::string, factory_record_type> datatools::factory_register< BaseType >::factory_map_type |
Dictionary of object factories.
typedef boost::function<base_type*() > datatools::factory_register< BaseType >::factory_type |
datatools::factory_register< BaseType >::factory_register | ( | ) |
Constructor.
datatools::factory_register< BaseType >::factory_register | ( | const std::string & | label_, |
unsigned int | flags_ = 0x0 |
||
) |
Constructor.
|
virtual |
Destructor.
void datatools::factory_register< BaseType >::clear | ( | ) |
Clear all registered factories.
bool datatools::factory_register< BaseType >::fetch_type_id | ( | std::string & | id_ | ) | const |
Fetch the registration type ID associated to a given class.
bool datatools::factory_register< BaseType >::fetch_type_id | ( | const std::type_info & | tinfo_, |
std::string & | id_ | ||
) | const |
Fetch the registration type ID associated to a given type_info.
const factory_register< BaseType >::factory_type & datatools::factory_register< BaseType >::get | ( | const std::string & | id_ | ) | const |
Return a const reference to a factory given by registration ID.
const std::string & datatools::factory_register< BaseType >::get_label | ( | ) | const |
Get the label associated to the factory.
datatools::logger::priority datatools::factory_register< BaseType >::get_logging_priority | ( | ) | const |
Returns logging priority.
const factory_register< BaseType >::factory_record_type & datatools::factory_register< BaseType >::get_record | ( | const std::string & | id_ | ) | const |
Return a const reference to a factory record given by registration ID.
factory_register< BaseType >::factory_type & datatools::factory_register< BaseType >::grab | ( | const std::string & | id_ | ) |
Return a mutable reference to a factory given by registration ID.
bool datatools::factory_register< BaseType >::has | ( | const std::string & | id_ | ) | const |
Return true if factory with given ID is registered.
void datatools::factory_register< BaseType >::import | ( | const factory_register< BaseType > & | factory_register_ | ) |
Import all registered factories from another factory register.
void datatools::factory_register< BaseType >::import_some | ( | const factory_register< BaseType > & | factory_register_, |
const std::vector< std::string > & | imported_factories_ | ||
) |
Import only registered factories addressed by their registration names from another factory register
bool datatools::factory_register< BaseType >::is_group | ( | const std::string & | id_ | ) | const |
Return true if factory with given ID is registered with given group.
void datatools::factory_register< BaseType >::list_of_factories | ( | std::vector< std::string > & | ids_ | ) | const |
Copy factory IDs into supplied vector.
void datatools::factory_register< BaseType >::print | ( | std::ostream & | out_, |
const std::string & | indent_ = "" |
||
) | const |
Simple print.
void datatools::factory_register< BaseType >::registration | ( | const std::string & | id_, |
const factory_type & | factory_, | ||
const std::type_info & | tinfo_, | ||
const std::string & | description_ = "" , |
||
const std::string & | category_ = "" |
||
) |
Register the supplied factory under the given ID.
void datatools::factory_register< BaseType >::registration | ( | const std::string & | id_, |
const std::string & | description_ = "" , |
||
const std::string & | category_ = "" |
||
) |
Register the supplied factory under the given ID.
void datatools::factory_register< BaseType >::reset | ( | ) |
Reset.
void datatools::factory_register< BaseType >::set_label | ( | const std::string & | label_ | ) |
Set the label associated to the factory.
void datatools::factory_register< BaseType >::set_logging_priority | ( | datatools::logger::priority | logging_ | ) |
Set logging priority.
|
virtual |
Smart print.
Reimplemented from datatools::i_tree_dumpable.
void datatools::factory_register< BaseType >::unregistration | ( | const std::string & | id_ | ) |
Remove registration of the factory stored under supplied ID TODO : better naming "unregister" for example COMMENT: "register"/"unregister" would be fine names but "register" is a reserved word