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::unit_dimension Class Reference

The description of an unit dimension. More...

#include <bayeux/datatools/units.h>

Inheritance diagram for datatools::units::unit_dimension:
datatools::i_tree_dumpable

Public Types

enum  base_dimension_type {
  BD_INVALID = 0, BD_MASS = 1, BD_LENGTH = 2, BD_TIME = 3,
  BD_ELECTRIC_CURRENT = 4, BD_TEMPERATURE = 5, BD_ABSOLUTE_TEMPERATURE = 5, BD_AMOUNT = 6,
  BD_AMOUNT_OF_SUBSTANCE = 6, BD_LUMINOUS_INTENSITY = 7, BD_PROCEDURE_DEFINED = 8, BD_LAST = BD_PROCEDURE_DEFINED + 1
}
 Base dimension index. 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

 unit_dimension ()
 Default constructor. More...
 
 unit_dimension (const std::string &label_, const std::string &default_unit_symbol_)
 Default constructor. More...
 
virtual ~unit_dimension ()
 Destructor. More...
 
bool is_valid () const
 Check validity. More...
 
void reset ()
 Reset. More...
 
bool has_label () const
 Check the label. More...
 
unit_dimensionset_label (const std::string &)
 Set the label of the unit dimension. More...
 
const std::string & get_label () const
 Return the label of the unit dimension. More...
 
bool has_unit (const std::string &unit_name_) const
 Check if a unit is known by name. More...
 
unit_dimensionadd_unit (const std::string &unit_name_, bool default_unit_=false)
 Add an unit by name. More...
 
void remove_unit (const std::string &unit_name_)
 Remove an unit by name. More...
 
const std::set< std::string > & get_unit_names () const
 Return the set of unit names. More...
 
bool has_default_unit () const
 Check if a default unit is defined. More...
 
unit_dimensionset_default_unit_name (const std::string &unit_name_)
 Set the name of the default unit. More...
 
const std::string & get_default_unit_name () const
 Return the name of the default unit. More...
 
bool has_dimensional_powers () const
 Check if the dimensional analysis information is available. More...
 
void reset_dimensional_powers ()
 Reset the the dimensional analysis information. More...
 
bool decode_dimensional_powers (const std::string &word_)
 Decode and set the dimensional powers from a character string. More...
 
void encode_dimensional_powers (std::string &word_) const
 Encode the set of dimensional powers. More...
 
bool is_dimensionless () const
 Check if unit dimension is dimensionless. More...
 
bool match_dimensional_powers (const unit_dimension &ud_) const
 Check if the dimensional powers match another unit dimension. 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 std::string base_dimension_to_symbol (base_dimension_type)
 
static base_dimension_type symbol_to_base_dimension (const std::string &)
 
static std::string base_dimension_to_label (base_dimension_type)
 
static base_dimension_type label_to_base_dimension (const std::string &)
 
static bool validate_dimension_label (const std::string &name_)
 Validate a unit dimension label. 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

void _set_default ()
 Set default attributes. More...
 

Detailed Description

The description of an unit dimension.

Member Enumeration Documentation

◆ base_dimension_type

Base dimension index.

Enumerator
BD_INVALID 
BD_MASS 
BD_LENGTH 
BD_TIME 
BD_ELECTRIC_CURRENT 
BD_TEMPERATURE 
BD_ABSOLUTE_TEMPERATURE 
BD_AMOUNT 
BD_AMOUNT_OF_SUBSTANCE 
BD_LUMINOUS_INTENSITY 
BD_PROCEDURE_DEFINED 
BD_LAST 

Constructor & Destructor Documentation

◆ unit_dimension() [1/2]

datatools::units::unit_dimension::unit_dimension ( )

Default constructor.

◆ unit_dimension() [2/2]

datatools::units::unit_dimension::unit_dimension ( const std::string &  label_,
const std::string &  default_unit_symbol_ 
)

Default constructor.

◆ ~unit_dimension()

virtual datatools::units::unit_dimension::~unit_dimension ( )
virtual

Destructor.

Member Function Documentation

◆ _set_default()

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

Set default attributes.

◆ add_unit()

unit_dimension& datatools::units::unit_dimension::add_unit ( const std::string &  unit_name_,
bool  default_unit_ = false 
)

Add an unit by name.

◆ base_dimension_to_label()

static std::string datatools::units::unit_dimension::base_dimension_to_label ( base_dimension_type  )
static

◆ base_dimension_to_symbol()

static std::string datatools::units::unit_dimension::base_dimension_to_symbol ( base_dimension_type  )
static

◆ decode_dimensional_powers()

bool datatools::units::unit_dimension::decode_dimensional_powers ( const std::string &  word_)

Decode and set the dimensional powers from a character string.

◆ encode_dimensional_powers()

void datatools::units::unit_dimension::encode_dimensional_powers ( std::string &  word_) const

Encode the set of dimensional powers.

◆ get_default_unit_name()

const std::string& datatools::units::unit_dimension::get_default_unit_name ( ) const

Return the name of the default unit.

◆ get_label()

const std::string& datatools::units::unit_dimension::get_label ( ) const

Return the label of the unit dimension.

◆ get_unit_names()

const std::set<std::string>& datatools::units::unit_dimension::get_unit_names ( ) const

Return the set of unit names.

◆ has_default_unit()

bool datatools::units::unit_dimension::has_default_unit ( ) const

Check if a default unit is defined.

◆ has_dimensional_powers()

bool datatools::units::unit_dimension::has_dimensional_powers ( ) const

Check if the dimensional analysis information is available.

◆ has_label()

bool datatools::units::unit_dimension::has_label ( ) const

Check the label.

◆ has_unit()

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

Check if a unit is known by name.

◆ is_dimensionless()

bool datatools::units::unit_dimension::is_dimensionless ( ) const

Check if unit dimension is dimensionless.

◆ is_valid()

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

Check validity.

◆ label_to_base_dimension()

static base_dimension_type datatools::units::unit_dimension::label_to_base_dimension ( const std::string &  )
static

◆ match_dimensional_powers()

bool datatools::units::unit_dimension::match_dimensional_powers ( const unit_dimension ud_) const

Check if the dimensional powers match another unit dimension.

◆ remove_unit()

void datatools::units::unit_dimension::remove_unit ( const std::string &  unit_name_)

Remove an unit by name.

◆ reset()

void datatools::units::unit_dimension::reset ( )

Reset.

◆ reset_dimensional_powers()

void datatools::units::unit_dimension::reset_dimensional_powers ( )

Reset the the dimensional analysis information.

◆ set_default_unit_name()

unit_dimension& datatools::units::unit_dimension::set_default_unit_name ( const std::string &  unit_name_)

Set the name of the default unit.

◆ set_label()

unit_dimension& datatools::units::unit_dimension::set_label ( const std::string &  )

Set the label of the unit dimension.

◆ symbol_to_base_dimension()

static base_dimension_type datatools::units::unit_dimension::symbol_to_base_dimension ( const std::string &  )
static

◆ tree_dump()

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

◆ validate_dimension_label()

static bool datatools::units::unit_dimension::validate_dimension_label ( const std::string &  name_)
static

Validate a unit dimension label.


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