Bayeux
3.4.1
Core Foundation library for SuperNEMO
|
#include <bayeux/geomtools/id_mgr.h>
Classes | |
class | category_info |
Public Types | |
typedef std::map< std::string, category_info > | categories_by_name_col_type |
typedef std::map< int, const category_info * > | categories_by_type_col_type |
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 | |
bool | is_debug () const |
void | set_debug (bool) |
const categories_by_type_col_type & | categories_by_type () const |
const categories_by_name_col_type & | categories_by_name () const |
id_mgr () | |
Constructor. More... | |
virtual | ~id_mgr () |
Destructor. More... | |
void | set_force_world (bool) |
bool | is_force_world () const |
void | set_force_plain (bool) |
bool | is_force_plain () const |
void | set_world_category (const std::string &n_) |
Set the world category name. More... | |
const std::string & | get_world_category () const |
Return the world category name. More... | |
void | set_plain_category (const std::string &n_) |
Set the plain category name. More... | |
const std::string & | get_plain_category () const |
Return the plain category name. More... | |
void | init_from (const datatools::multi_properties &mp_) |
Initialize the manager from a properties multi container. More... | |
void | load (const std::string &filename_) |
Load manager configuration from a file. More... | |
virtual void | print_tree (std::ostream &out_=std::clog, const boost::property_tree::ptree &options_=datatools::i_tree_dumpable::empty_options()) const |
Smart print. More... | |
bool | has_category_info (int type_) const |
Check if some category's description exists for a given type. More... | |
bool | has_category_info (const std::string &) const |
Check if some category's description exists for a given category name. More... | |
const category_info & | get_category_info (int type_) const |
Get the category descriptor assocated to a category associated to a given type. More... | |
const category_info & | get_category_info (const std::string &) const |
Get the category descriptor assocated to a category associated to a given name. More... | |
bool | is_category (const geom_id &id_, const std::string &category_) const |
Check the category of an ID. More... | |
bool | inherits (const geom_id &id_, const std::string &category_) const |
Check if an ID inherits a category. More... | |
bool | has (const geom_id &, const std::string &what_) const |
Check is an ID has an subaddress labelled 'what': More... | |
const std::string & | get_category (const geom_id &) const |
Returns the category associated to an ID. More... | |
uint32_t | get_category_type (const std::string &a_category) const |
Return the type associated to a category. More... | |
int | get (const geom_id &, const std::string &what_) const |
Returns the value of the address labelled 'what' from an ID. More... | |
void | set (geom_id &, const std::string &what_, uint32_t value_) const |
Set the value of the address labelled 'what' from an ID. More... | |
bool | check_inheritance (const geom_id &mother_id_, const geom_id &id_) const |
Check if an ID inherits or extends a candidate mother ID. More... | |
void | extract (const geom_id &child_id_, geom_id &mother_id_) const |
bool | validate_id (const geom_id &id_) const |
Check if a given ID is valid and managed. More... | |
void | id_to_human_readable_format_string (const geom_id &id_, std::string &) const |
String formatting. More... | |
std::string | id_to_human_readable_format_string (const geom_id &id_) const |
String formatting. More... | |
void | make_id (geom_id &id_, uint32_t address_) const |
Factory method that ... (I don't know what for !!!) More... | |
void | make_id (const std::string &category_, geom_id &id_) const |
Factory method that initialize a GID of a given category by name. More... | |
int | print_list_of_categories (const std::string &command_, const std::vector< std::string > &argv_, std::ostream &out_=std::clog) const |
Print the list of categories. More... | |
int | compute_id_from_info (geom_id &id_, const geom_id &mother_id_, const std::string &id_info_, const std::vector< uint32_t > &items_index_) const |
int | compute_id_from_info (geom_id &id_, const geom_id &mother_id_, const std::string &id_info_, uint32_t nitem0_=geom_id::INVALID_ADDRESS, uint32_t nitem1_=geom_id::INVALID_ADDRESS, uint32_t nitem2_=geom_id::INVALID_ADDRESS) const |
datatools::logger::priority | get_logging_priority () const |
void | set_logging_priority (datatools::logger::priority) |
bool | is_initialized () const |
Check lock status. More... | |
void | initialize (const datatools::properties &config_) |
Initialize the manager from a properties container. More... | |
void | reset () |
Reset/invalidate the manager. More... | |
Public Member Functions inherited from datatools::i_tree_dumpable | |
i_tree_dumpable () | |
Constructor. More... | |
virtual | ~i_tree_dumpable () |
Destructor. More... | |
virtual void | tree_dump (std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const |
Main old 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 Member Functions | |
static const std::string & | category_key_label () |
static const std::string & | type_meta_label () |
static const std::string & | default_world_category () |
static const std::string & | default_plain_category () |
static const std::string & | plain_item_address () |
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 Attributes | |
static const uint32_t | WORD_TYPE = 0 |
static const uint32_t | PLAIN_TYPE = 1 |
Protected Member Functions | |
virtual void | _at_initialize () |
A manager class for geometry identifiers (GID, class : 'geom_id') and their relationship described through objects of 'category_info' class
typedef std::map<std::string, category_info> geomtools::id_mgr::categories_by_name_col_type |
typedef std::map<int, const category_info *> geomtools::id_mgr::categories_by_type_col_type |
geomtools::id_mgr::id_mgr | ( | ) |
Constructor.
|
virtual |
Destructor.
|
protectedvirtual |
const categories_by_name_col_type& geomtools::id_mgr::categories_by_name | ( | ) | const |
const categories_by_type_col_type& geomtools::id_mgr::categories_by_type | ( | ) | const |
|
static |
Check if an ID inherits or extends a candidate mother ID.
int geomtools::id_mgr::compute_id_from_info | ( | geom_id & | id_, |
const geom_id & | mother_id_, | ||
const std::string & | id_info_, | ||
const std::vector< uint32_t > & | items_index_ | ||
) | const |
Given a std::string representing the geometry ID "[module:module=0]" and the ID of the mother volume, one computes the full geometry ID of the daughter volume, eventually using the index of the item.
Example: Assume ‘[100:3]’ is the mother ID from the ‘module’ category (index=100) with module number = 3 (mother ID info is then "[module:module=3]"). Assume the child ID info is "[submodule:submodule=4]" from the ‘submodule’ category The resulting child ID is: ‘[110:3.4]’ where 110 is the type of the ‘submodule’ category.
int geomtools::id_mgr::compute_id_from_info | ( | geom_id & | id_, |
const geom_id & | mother_id_, | ||
const std::string & | id_info_, | ||
uint32_t | nitem0_ = geom_id::INVALID_ADDRESS , |
||
uint32_t | nitem1_ = geom_id::INVALID_ADDRESS , |
||
uint32_t | nitem2_ = geom_id::INVALID_ADDRESS |
||
) | const |
|
static |
|
static |
Extract the part of the address of some child ID that is inherited from a mother ID.
int geomtools::id_mgr::get | ( | const geom_id & | , |
const std::string & | what_ | ||
) | const |
Returns the value of the address labelled 'what' from an ID.
const std::string& geomtools::id_mgr::get_category | ( | const geom_id & | ) | const |
Returns the category associated to an ID.
const category_info& geomtools::id_mgr::get_category_info | ( | int | type_ | ) | const |
Get the category descriptor assocated to a category associated to a given type.
const category_info& geomtools::id_mgr::get_category_info | ( | const std::string & | ) | const |
Get the category descriptor assocated to a category associated to a given name.
uint32_t geomtools::id_mgr::get_category_type | ( | const std::string & | a_category | ) | const |
Return the type associated to a category.
datatools::logger::priority geomtools::id_mgr::get_logging_priority | ( | ) | const |
const std::string& geomtools::id_mgr::get_plain_category | ( | ) | const |
Return the plain category name.
const std::string& geomtools::id_mgr::get_world_category | ( | ) | const |
Return the world category name.
bool geomtools::id_mgr::has | ( | const geom_id & | , |
const std::string & | what_ | ||
) | const |
Check is an ID has an subaddress labelled 'what':
bool geomtools::id_mgr::has_category_info | ( | int | type_ | ) | const |
Check if some category's description exists for a given type.
bool geomtools::id_mgr::has_category_info | ( | const std::string & | ) | const |
Check if some category's description exists for a given category name.
void geomtools::id_mgr::id_to_human_readable_format_string | ( | const geom_id & | id_, |
std::string & | |||
) | const |
String formatting.
std::string geomtools::id_mgr::id_to_human_readable_format_string | ( | const geom_id & | id_ | ) | const |
String formatting.
bool geomtools::id_mgr::inherits | ( | const geom_id & | id_, |
const std::string & | category_ | ||
) | const |
Check if an ID inherits a category.
void geomtools::id_mgr::init_from | ( | const datatools::multi_properties & | mp_ | ) |
Initialize the manager from a properties multi container.
void geomtools::id_mgr::initialize | ( | const datatools::properties & | config_ | ) |
Initialize the manager from a properties container.
bool geomtools::id_mgr::is_category | ( | const geom_id & | id_, |
const std::string & | category_ | ||
) | const |
Check the category of an ID.
bool geomtools::id_mgr::is_debug | ( | ) | const |
bool geomtools::id_mgr::is_force_plain | ( | ) | const |
bool geomtools::id_mgr::is_force_world | ( | ) | const |
bool geomtools::id_mgr::is_initialized | ( | ) | const |
Check lock status.
void geomtools::id_mgr::load | ( | const std::string & | filename_ | ) |
Load manager configuration from a file.
void geomtools::id_mgr::make_id | ( | geom_id & | id_, |
uint32_t | address_ | ||
) | const |
Factory method that ... (I don't know what for !!!)
void geomtools::id_mgr::make_id | ( | const std::string & | category_, |
geom_id & | id_ | ||
) | const |
Factory method that initialize a GID of a given category by name.
|
static |
int geomtools::id_mgr::print_list_of_categories | ( | const std::string & | command_, |
const std::vector< std::string > & | argv_, | ||
std::ostream & | out_ = std::clog |
||
) | const |
Print the list of categories.
|
virtual |
Smart print.
Reimplemented from datatools::i_tree_dumpable.
void geomtools::id_mgr::reset | ( | ) |
Reset/invalidate the manager.
void geomtools::id_mgr::set | ( | geom_id & | , |
const std::string & | what_, | ||
uint32_t | value_ | ||
) | const |
Set the value of the address labelled 'what' from an ID.
void geomtools::id_mgr::set_debug | ( | bool | ) |
void geomtools::id_mgr::set_force_plain | ( | bool | ) |
void geomtools::id_mgr::set_force_world | ( | bool | ) |
void geomtools::id_mgr::set_logging_priority | ( | datatools::logger::priority | ) |
void geomtools::id_mgr::set_plain_category | ( | const std::string & | n_ | ) |
Set the plain category name.
void geomtools::id_mgr::set_world_category | ( | const std::string & | n_ | ) |
Set the world category name.
|
static |
bool geomtools::id_mgr::validate_id | ( | const geom_id & | id_ | ) | const |
Check if a given ID is valid and managed.
|
static |
|
static |