Bayeux
3.4.1
Core Foundation library for SuperNEMO
|
The description of an unit. More...
#include <bayeux/datatools/units.h>
Public Member Functions | |
unit () | |
Default constructor. More... | |
unit (const std::string &name_, const std::string &dimension_desc_, double value_, bool SI_main_=false) | |
Constructor. More... | |
unit (const std::string &name_, const std::string &symbol_, const std::string &dimension_desc_, double value_, bool SI_main_=false) | |
Constructor. More... | |
unit (const std::string &name_, const std::string &main_symbol_, const std::string &alt_symbols_, const std::string &dimension_desc_, double value_, bool SI_main_=false) | |
Constructor. More... | |
virtual | ~unit () |
Destructor. More... | |
bool | is_valid () const |
Check validity. More... | |
void | reset () |
Reset. More... | |
bool | has_name () const |
Check the name. More... | |
const std::string & | get_name () const |
Return the name. More... | |
unit & | set_name (const std::string &) |
Set the name. More... | |
unit & | add_symbol (const std::string &symbol_, bool main_=false) |
Add a symbol. More... | |
bool | has_symbol (const std::string &symbol_) const |
Check if a given symbol is defined. More... | |
bool | match (const std::string &id_) const |
Check if a given id matches the name or one of the symbol. More... | |
const std::set< std::string > & | get_symbols () const |
Build the set of associated symbols. More... | |
bool | has_main_symbol () const |
Check main symbol. More... | |
const std::string & | get_main_symbol () const |
Return the symbol. More... | |
unit & | set_main_symbol (const std::string &) |
Set the symbol. More... | |
bool | has_dimension_label () const |
Check dimension label. More... | |
const std::string & | get_dimension_label () const |
Return the dimension label. More... | |
unit & | set_dimension_label (const std::string &) |
Set the dimension label. More... | |
bool | has_dimension_meta () const |
Check dimension meta. More... | |
const std::string & | get_dimension_meta () const |
Return the dimension meta. More... | |
unit & | set_dimension_meta (const std::string &) |
Set the dimension meta. More... | |
unit & | set_dimension_infos (const std::string &) |
Set the dimension infos. More... | |
bool | is_dimension (const std::string &) const |
Check if the dimension matches a given label. More... | |
bool | is_SI_main () const |
Check if the unit is the main SI unit for its unit dimension. More... | |
unit & | set_SI_main (bool) |
Set the main SI unit flag. More... | |
double | get_value () const |
Return the value. More... | |
unit & | set_value (double) |
Set the value. More... | |
operator double () const | |
Conversion to double. More... | |
const std::string & | str () const |
Shortcut for the symbol. 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 |
Protected Member Functions | |
void | _set_default () |
Set default attributes. More... | |
Additional Inherited Members | |
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... | |
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_) |
The description of an unit.
datatools::units::unit::unit | ( | ) |
Default constructor.
datatools::units::unit::unit | ( | const std::string & | name_, |
const std::string & | dimension_desc_, | ||
double | value_, | ||
bool | SI_main_ = false |
||
) |
Constructor.
datatools::units::unit::unit | ( | const std::string & | name_, |
const std::string & | symbol_, | ||
const std::string & | dimension_desc_, | ||
double | value_, | ||
bool | SI_main_ = false |
||
) |
Constructor.
datatools::units::unit::unit | ( | const std::string & | name_, |
const std::string & | main_symbol_, | ||
const std::string & | alt_symbols_, | ||
const std::string & | dimension_desc_, | ||
double | value_, | ||
bool | SI_main_ = false |
||
) |
Constructor.
|
virtual |
Destructor.
|
protected |
Set default attributes.
Add a symbol.
const std::string& datatools::units::unit::get_dimension_label | ( | ) | const |
Return the dimension label.
const std::string& datatools::units::unit::get_dimension_meta | ( | ) | const |
Return the dimension meta.
const std::string& datatools::units::unit::get_main_symbol | ( | ) | const |
Return the symbol.
const std::string& datatools::units::unit::get_name | ( | ) | const |
Return the name.
const std::set<std::string>& datatools::units::unit::get_symbols | ( | ) | const |
Build the set of associated symbols.
double datatools::units::unit::get_value | ( | ) | const |
Return the value.
bool datatools::units::unit::has_dimension_label | ( | ) | const |
Check dimension label.
bool datatools::units::unit::has_dimension_meta | ( | ) | const |
Check dimension meta.
bool datatools::units::unit::has_main_symbol | ( | ) | const |
Check main symbol.
bool datatools::units::unit::has_name | ( | ) | const |
Check the name.
bool datatools::units::unit::has_symbol | ( | const std::string & | symbol_ | ) | const |
Check if a given symbol is defined.
bool datatools::units::unit::is_dimension | ( | const std::string & | ) | const |
Check if the dimension matches a given label.
bool datatools::units::unit::is_SI_main | ( | ) | const |
Check if the unit is the main SI unit for its unit dimension.
bool datatools::units::unit::is_valid | ( | ) | const |
Check validity.
bool datatools::units::unit::match | ( | const std::string & | id_ | ) | const |
Check if a given id matches the name or one of the symbol.
datatools::units::unit::operator double | ( | ) | const |
Conversion to double.
void datatools::units::unit::reset | ( | ) |
Reset.
unit& datatools::units::unit::set_SI_main | ( | bool | ) |
Set the main SI unit flag.
unit& datatools::units::unit::set_value | ( | double | ) |
Set the value.
const std::string& datatools::units::unit::str | ( | ) | const |
Shortcut for the symbol.
|
virtual |
Smart print.
Reimplemented from datatools::i_tree_dumpable.