Bayeux  3.4.1
Core Foundation library for SuperNEMO
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
geomtools::id_mgr Class Reference

#include <bayeux/geomtools/id_mgr.h>

Inheritance diagram for geomtools::id_mgr:
datatools::i_tree_dumpable

Classes

class  category_info
 

Public Types

typedef std::map< std::string, category_infocategories_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_typecategories_by_type () const
 
const categories_by_name_col_typecategories_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_infoget_category_info (int type_) const
 Get the category descriptor assocated to a category associated to a given type. More...
 
const category_infoget_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 ()
 

Detailed Description

A manager class for geometry identifiers (GID, class : 'geom_id') and their relationship described through objects of 'category_info' class

Member Typedef Documentation

◆ categories_by_name_col_type

◆ categories_by_type_col_type

Constructor & Destructor Documentation

◆ id_mgr()

geomtools::id_mgr::id_mgr ( )

Constructor.

◆ ~id_mgr()

virtual geomtools::id_mgr::~id_mgr ( )
virtual

Destructor.

Member Function Documentation

◆ _at_initialize()

virtual void geomtools::id_mgr::_at_initialize ( )
protectedvirtual

◆ categories_by_name()

const categories_by_name_col_type& geomtools::id_mgr::categories_by_name ( ) const

◆ categories_by_type()

const categories_by_type_col_type& geomtools::id_mgr::categories_by_type ( ) const

◆ category_key_label()

static const std::string& geomtools::id_mgr::category_key_label ( )
static

◆ check_inheritance()

bool geomtools::id_mgr::check_inheritance ( const geom_id mother_id_,
const geom_id id_ 
) const

Check if an ID inherits or extends a candidate mother ID.

◆ compute_id_from_info() [1/2]

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.

◆ compute_id_from_info() [2/2]

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

◆ default_plain_category()

static const std::string& geomtools::id_mgr::default_plain_category ( )
static

◆ default_world_category()

static const std::string& geomtools::id_mgr::default_world_category ( )
static

◆ extract()

void geomtools::id_mgr::extract ( const geom_id child_id_,
geom_id mother_id_ 
) const

Extract the part of the address of some child ID that is inherited from a mother ID.

◆ get()

int geomtools::id_mgr::get ( const geom_id ,
const std::string &  what_ 
) const

Returns the value of the address labelled 'what' from an ID.

◆ get_category()

const std::string& geomtools::id_mgr::get_category ( const geom_id ) const

Returns the category associated to an ID.

◆ get_category_info() [1/2]

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.

◆ get_category_info() [2/2]

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.

◆ get_category_type()

uint32_t geomtools::id_mgr::get_category_type ( const std::string &  a_category) const

Return the type associated to a category.

◆ get_logging_priority()

datatools::logger::priority geomtools::id_mgr::get_logging_priority ( ) const

◆ get_plain_category()

const std::string& geomtools::id_mgr::get_plain_category ( ) const

Return the plain category name.

◆ get_world_category()

const std::string& geomtools::id_mgr::get_world_category ( ) const

Return the world category name.

◆ has()

bool geomtools::id_mgr::has ( const geom_id ,
const std::string &  what_ 
) const

Check is an ID has an subaddress labelled 'what':

◆ has_category_info() [1/2]

bool geomtools::id_mgr::has_category_info ( int  type_) const

Check if some category's description exists for a given type.

◆ has_category_info() [2/2]

bool geomtools::id_mgr::has_category_info ( const std::string &  ) const

Check if some category's description exists for a given category name.

◆ id_to_human_readable_format_string() [1/2]

void geomtools::id_mgr::id_to_human_readable_format_string ( const geom_id id_,
std::string &   
) const

String formatting.

◆ id_to_human_readable_format_string() [2/2]

std::string geomtools::id_mgr::id_to_human_readable_format_string ( const geom_id id_) const

String formatting.

◆ inherits()

bool geomtools::id_mgr::inherits ( const geom_id id_,
const std::string &  category_ 
) const

Check if an ID inherits a category.

◆ init_from()

void geomtools::id_mgr::init_from ( const datatools::multi_properties mp_)

Initialize the manager from a properties multi container.

◆ initialize()

void geomtools::id_mgr::initialize ( const datatools::properties config_)

Initialize the manager from a properties container.

◆ is_category()

bool geomtools::id_mgr::is_category ( const geom_id id_,
const std::string &  category_ 
) const

Check the category of an ID.

◆ is_debug()

bool geomtools::id_mgr::is_debug ( ) const

◆ is_force_plain()

bool geomtools::id_mgr::is_force_plain ( ) const

◆ is_force_world()

bool geomtools::id_mgr::is_force_world ( ) const

◆ is_initialized()

bool geomtools::id_mgr::is_initialized ( ) const

Check lock status.

◆ load()

void geomtools::id_mgr::load ( const std::string &  filename_)

Load manager configuration from a file.

◆ make_id() [1/2]

void geomtools::id_mgr::make_id ( geom_id id_,
uint32_t  address_ 
) const

Factory method that ... (I don't know what for !!!)

◆ make_id() [2/2]

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.

◆ plain_item_address()

static const std::string& geomtools::id_mgr::plain_item_address ( )
static

◆ print_list_of_categories()

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.

◆ print_tree()

virtual void geomtools::id_mgr::print_tree ( std::ostream &  out_ = std::clog,
const boost::property_tree::ptree &  options_ = datatools::i_tree_dumpable::empty_options() 
) const
virtual

Smart print.

Reimplemented from datatools::i_tree_dumpable.

◆ reset()

void geomtools::id_mgr::reset ( )

Reset/invalidate the manager.

◆ set()

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.

◆ set_debug()

void geomtools::id_mgr::set_debug ( bool  )

◆ set_force_plain()

void geomtools::id_mgr::set_force_plain ( bool  )

◆ set_force_world()

void geomtools::id_mgr::set_force_world ( bool  )

◆ set_logging_priority()

void geomtools::id_mgr::set_logging_priority ( datatools::logger::priority  )

◆ set_plain_category()

void geomtools::id_mgr::set_plain_category ( const std::string &  n_)

Set the plain category name.

◆ set_world_category()

void geomtools::id_mgr::set_world_category ( const std::string &  n_)

Set the world category name.

◆ type_meta_label()

static const std::string& geomtools::id_mgr::type_meta_label ( )
static

◆ validate_id()

bool geomtools::id_mgr::validate_id ( const geom_id id_) const

Check if a given ID is valid and managed.

Member Data Documentation

◆ PLAIN_TYPE

const uint32_t geomtools::id_mgr::PLAIN_TYPE = 1
static

◆ WORD_TYPE

const uint32_t geomtools::id_mgr::WORD_TYPE = 0
static

The documentation for this class was generated from the following file: