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

The description of an unit. More...

#include <bayeux/datatools/units.h>

Inheritance diagram for datatools::units::unit:
datatools::i_tree_dumpable

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...
 
unitset_name (const std::string &)
 Set the name. More...
 
unitadd_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...
 
unitset_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...
 
unitset_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...
 
unitset_dimension_meta (const std::string &)
 Set the dimension meta. More...
 
unitset_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...
 
unitset_SI_main (bool)
 Set the main SI unit flag. More...
 
double get_value () const
 Return the value. More...
 
unitset_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_)
 

Detailed Description

The description of an unit.

Constructor & Destructor Documentation

◆ unit() [1/4]

datatools::units::unit::unit ( )

Default constructor.

◆ unit() [2/4]

datatools::units::unit::unit ( const std::string &  name_,
const std::string &  dimension_desc_,
double  value_,
bool  SI_main_ = false 
)

Constructor.

◆ unit() [3/4]

datatools::units::unit::unit ( const std::string &  name_,
const std::string &  symbol_,
const std::string &  dimension_desc_,
double  value_,
bool  SI_main_ = false 
)

Constructor.

◆ unit() [4/4]

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.

◆ ~unit()

virtual datatools::units::unit::~unit ( )
virtual

Destructor.

Member Function Documentation

◆ _set_default()

void datatools::units::unit::_set_default ( )
protected

Set default attributes.

◆ add_symbol()

unit& datatools::units::unit::add_symbol ( const std::string &  symbol_,
bool  main_ = false 
)

Add a symbol.

◆ get_dimension_label()

const std::string& datatools::units::unit::get_dimension_label ( ) const

Return the dimension label.

◆ get_dimension_meta()

const std::string& datatools::units::unit::get_dimension_meta ( ) const

Return the dimension meta.

◆ get_main_symbol()

const std::string& datatools::units::unit::get_main_symbol ( ) const

Return the symbol.

◆ get_name()

const std::string& datatools::units::unit::get_name ( ) const

Return the name.

◆ get_symbols()

const std::set<std::string>& datatools::units::unit::get_symbols ( ) const

Build the set of associated symbols.

◆ get_value()

double datatools::units::unit::get_value ( ) const

Return the value.

◆ has_dimension_label()

bool datatools::units::unit::has_dimension_label ( ) const

Check dimension label.

◆ has_dimension_meta()

bool datatools::units::unit::has_dimension_meta ( ) const

Check dimension meta.

◆ has_main_symbol()

bool datatools::units::unit::has_main_symbol ( ) const

Check main symbol.

◆ has_name()

bool datatools::units::unit::has_name ( ) const

Check the name.

◆ has_symbol()

bool datatools::units::unit::has_symbol ( const std::string &  symbol_) const

Check if a given symbol is defined.

◆ is_dimension()

bool datatools::units::unit::is_dimension ( const std::string &  ) const

Check if the dimension matches a given label.

◆ is_SI_main()

bool datatools::units::unit::is_SI_main ( ) const

Check if the unit is the main SI unit for its unit dimension.

◆ is_valid()

bool datatools::units::unit::is_valid ( ) const

Check validity.

◆ match()

bool datatools::units::unit::match ( const std::string &  id_) const

Check if a given id matches the name or one of the symbol.

◆ operator double()

datatools::units::unit::operator double ( ) const

Conversion to double.

◆ reset()

void datatools::units::unit::reset ( )

Reset.

◆ set_dimension_infos()

unit& datatools::units::unit::set_dimension_infos ( const std::string &  )

Set the dimension infos.

◆ set_dimension_label()

unit& datatools::units::unit::set_dimension_label ( const std::string &  )

Set the dimension label.

◆ set_dimension_meta()

unit& datatools::units::unit::set_dimension_meta ( const std::string &  )

Set the dimension meta.

◆ set_main_symbol()

unit& datatools::units::unit::set_main_symbol ( const std::string &  )

Set the symbol.

◆ set_name()

unit& datatools::units::unit::set_name ( const std::string &  )

Set the name.

◆ set_SI_main()

unit& datatools::units::unit::set_SI_main ( bool  )

Set the main SI unit flag.

◆ set_value()

unit& datatools::units::unit::set_value ( double  )

Set the value.

◆ str()

const std::string& datatools::units::unit::str ( ) const

Shortcut for the symbol.

◆ tree_dump()

virtual void datatools::units::unit::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.


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