Bayeux
3.4.1
Core Foundation library for SuperNEMO
|
A registry for units. More...
#include <bayeux/datatools/units.h>
Public Types | |
enum | init_flag_type { NO_STANDARD_UNITS = 0x1 } |
typedef std::map< std::string, unit > | unit_dict_type |
Type of dictionary of unit. More... | |
typedef std::map< std::string, const unit * > | symbol_dict_type |
Type of dictionary of unit. More... | |
typedef std::map< std::string, unit_dimension > | dimension_dict_type |
Type of dictionary of dimension. 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 | |
registry (uint32_t flags_=0) | |
Default constructor. More... | |
~registry () | |
Destructor. More... | |
void | registration (const unit &unit_, bool default_in_dimension_=false) |
Registration of an unit. More... | |
void | unregistration (const std::string &unit_name_) |
Unregistration of an unit. More... | |
bool | has_unit (const std::string &unit_name_) const |
Check unit. More... | |
const unit & | get_unit (const std::string &unit_name_) const |
Return a registered unit. More... | |
bool | has_symbol (const std::string &unit_symbol_) const |
Check unit symbol. More... | |
bool | has_unit_from_any (const std::string &unit_label_) const |
Check unit name or symbol. More... | |
const unit & | get_unit_from_symbol (const std::string &unit_symbol_) const |
Return a registered unit per symbol. More... | |
const unit & | get_unit_from_any (const std::string &unit_id_) const |
Return a registered unit by name or symbol. More... | |
bool | has_dimension (const std::string &dimension_label_) const |
Check dimension. More... | |
const unit_dimension & | get_dimension (const std::string &dimension_label_) const |
Return a registered unit dimension. More... | |
void | clear () |
Clear the registry. More... | |
const unit_dict_type & | get_units () const |
Return the non mutable dictionary of registered units. More... | |
const symbol_dict_type & | get_symbols () const |
Return the non mutable dictionary of registered unit symbols. More... | |
const dimension_dict_type & | get_dimensions () const |
Return the non mutable dictionary of registered unit dimensions. More... | |
bool | build_ordered_unit_symbols (const std::string &dimension_label_, std::list< std::string > &symbols_) const |
Build the list of unit symbols associated to a given dimension with units ordered by values (i.e. for the "time" dimension: "fs", "ps", "ns", "us", "ms", "s", ..., "year", "century"... "eon" ...) More... | |
void | register_standard_units () |
Register standard units. 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::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 |
Static Public Member Functions | |
static registry & | system_registry () |
Access to the mutable system singleton registry. More... | |
static const registry & | const_system_registry () |
Access to the non mutable system singleton registry. More... | |
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_) |
Protected Member Functions | |
unit & | _grab_unit (const std::string &unit_name_) |
Return a mutable registered unit. More... | |
unit_dimension & | _grab_dimension (const std::string &dimension_label_) |
Return a mutable registered unit dimension. More... | |
A registry for units.
typedef std::map<std::string, unit_dimension> datatools::units::registry::dimension_dict_type |
Type of dictionary of dimension.
typedef std::map<std::string, const unit *> datatools::units::registry::symbol_dict_type |
Type of dictionary of unit.
typedef std::map<std::string, unit> datatools::units::registry::unit_dict_type |
Type of dictionary of unit.
datatools::units::registry::registry | ( | uint32_t | flags_ = 0 | ) |
Default constructor.
datatools::units::registry::~registry | ( | ) |
Destructor.
|
protected |
Return a mutable registered unit dimension.
Return a mutable registered unit.
bool datatools::units::registry::build_ordered_unit_symbols | ( | const std::string & | dimension_label_, |
std::list< std::string > & | symbols_ | ||
) | const |
Build the list of unit symbols associated to a given dimension with units ordered by values (i.e. for the "time" dimension: "fs", "ps", "ns", "us", "ms", "s", ..., "year", "century"... "eon" ...)
void datatools::units::registry::clear | ( | ) |
Clear the registry.
Access to the non mutable system singleton registry.
const unit_dimension& datatools::units::registry::get_dimension | ( | const std::string & | dimension_label_ | ) | const |
Return a registered unit dimension.
const dimension_dict_type& datatools::units::registry::get_dimensions | ( | ) | const |
Return the non mutable dictionary of registered unit dimensions.
const symbol_dict_type& datatools::units::registry::get_symbols | ( | ) | const |
Return the non mutable dictionary of registered unit symbols.
Return a registered unit.
Return a registered unit by name or symbol.
const unit& datatools::units::registry::get_unit_from_symbol | ( | const std::string & | unit_symbol_ | ) | const |
Return a registered unit per symbol.
const unit_dict_type& datatools::units::registry::get_units | ( | ) | const |
Return the non mutable dictionary of registered units.
bool datatools::units::registry::has_dimension | ( | const std::string & | dimension_label_ | ) | const |
Check dimension.
bool datatools::units::registry::has_symbol | ( | const std::string & | unit_symbol_ | ) | const |
Check unit symbol.
bool datatools::units::registry::has_unit | ( | const std::string & | unit_name_ | ) | const |
Check unit.
bool datatools::units::registry::has_unit_from_any | ( | const std::string & | unit_label_ | ) | const |
Check unit name or symbol.
void datatools::units::registry::register_standard_units | ( | ) |
Register standard units.
void datatools::units::registry::registration | ( | const unit & | unit_, |
bool | default_in_dimension_ = false |
||
) |
Registration of an unit.
|
static |
Access to the mutable system singleton registry.
|
virtual |
Smart print.
Reimplemented from datatools::i_tree_dumpable.
void datatools::units::registry::unregistration | ( | const std::string & | unit_name_ | ) |
Unregistration of an unit.