Bayeux  3.4.1
Core Foundation library for SuperNEMO
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
datatools::units::registry Class Reference

A registry for units. More...

#include <bayeux/datatools/units.h>

Inheritance diagram for datatools::units::registry:
datatools::i_tree_dumpable

Public Types

enum  init_flag_type { NO_STANDARD_UNITS = 0x1 }
 
typedef std::map< std::string, unitunit_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_dimensiondimension_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 unitget_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 unitget_unit_from_symbol (const std::string &unit_symbol_) const
 Return a registered unit per symbol. More...
 
const unitget_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_dimensionget_dimension (const std::string &dimension_label_) const
 Return a registered unit dimension. More...
 
void clear ()
 Clear the registry. More...
 
const unit_dict_typeget_units () const
 Return the non mutable dictionary of registered units. More...
 
const symbol_dict_typeget_symbols () const
 Return the non mutable dictionary of registered unit symbols. More...
 
const dimension_dict_typeget_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 registrysystem_registry ()
 Access to the mutable system singleton registry. More...
 
static const registryconst_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...
 

Detailed Description

A registry for units.

Member Typedef Documentation

◆ dimension_dict_type

Type of dictionary of dimension.

◆ symbol_dict_type

typedef std::map<std::string, const unit *> datatools::units::registry::symbol_dict_type

Type of dictionary of unit.

◆ unit_dict_type

typedef std::map<std::string, unit> datatools::units::registry::unit_dict_type

Type of dictionary of unit.

Member Enumeration Documentation

◆ init_flag_type

Enumerator
NO_STANDARD_UNITS 

Constructor & Destructor Documentation

◆ registry()

datatools::units::registry::registry ( uint32_t  flags_ = 0)

Default constructor.

◆ ~registry()

datatools::units::registry::~registry ( )

Destructor.

Member Function Documentation

◆ _grab_dimension()

unit_dimension& datatools::units::registry::_grab_dimension ( const std::string &  dimension_label_)
protected

Return a mutable registered unit dimension.

◆ _grab_unit()

unit& datatools::units::registry::_grab_unit ( const std::string &  unit_name_)
protected

Return a mutable registered unit.

◆ build_ordered_unit_symbols()

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" ...)

◆ clear()

void datatools::units::registry::clear ( )

Clear the registry.

◆ const_system_registry()

static const registry& datatools::units::registry::const_system_registry ( )
static

Access to the non mutable system singleton registry.

◆ get_dimension()

const unit_dimension& datatools::units::registry::get_dimension ( const std::string &  dimension_label_) const

Return a registered unit dimension.

◆ get_dimensions()

const dimension_dict_type& datatools::units::registry::get_dimensions ( ) const

Return the non mutable dictionary of registered unit dimensions.

◆ get_symbols()

const symbol_dict_type& datatools::units::registry::get_symbols ( ) const

Return the non mutable dictionary of registered unit symbols.

◆ get_unit()

const unit& datatools::units::registry::get_unit ( const std::string &  unit_name_) const

Return a registered unit.

◆ get_unit_from_any()

const unit& datatools::units::registry::get_unit_from_any ( const std::string &  unit_id_) const

Return a registered unit by name or symbol.

◆ get_unit_from_symbol()

const unit& datatools::units::registry::get_unit_from_symbol ( const std::string &  unit_symbol_) const

Return a registered unit per symbol.

◆ get_units()

const unit_dict_type& datatools::units::registry::get_units ( ) const

Return the non mutable dictionary of registered units.

◆ has_dimension()

bool datatools::units::registry::has_dimension ( const std::string &  dimension_label_) const

Check dimension.

◆ has_symbol()

bool datatools::units::registry::has_symbol ( const std::string &  unit_symbol_) const

Check unit symbol.

◆ has_unit()

bool datatools::units::registry::has_unit ( const std::string &  unit_name_) const

Check unit.

◆ has_unit_from_any()

bool datatools::units::registry::has_unit_from_any ( const std::string &  unit_label_) const

Check unit name or symbol.

◆ register_standard_units()

void datatools::units::registry::register_standard_units ( )

Register standard units.

◆ registration()

void datatools::units::registry::registration ( const unit unit_,
bool  default_in_dimension_ = false 
)

Registration of an unit.

◆ system_registry()

static registry& datatools::units::registry::system_registry ( )
static

Access to the mutable system singleton registry.

◆ tree_dump()

virtual void datatools::units::registry::tree_dump ( std::ostream &  out_ = std::clog,
const std::string &  title_ = "",
const std::string &  indent_ = "",
bool  inherit_ = false 
) const
virtual

Smart print.

Reimplemented from datatools::i_tree_dumpable.

◆ unregistration()

void datatools::units::registry::unregistration ( const std::string &  unit_name_)

Unregistration of an unit.


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