Bayeux
3.4.1
Core Foundation library for SuperNEMO
|
Utilities for units based on the CLHEP library's implementation. More...
Classes | |
class | registry |
A registry for units. More... | |
class | unit |
The description of an unit. More... | |
class | unit_dimension |
The description of an unit dimension. More... | |
Enumerations | |
enum | power_of_ten { YOCTO = -24, ZEPTO = -21, ATTO = -18, FEMTO = -15, PICO = -12, NANO = -9, MICRO = -6, MILLI = -3, CENTI = -2, DECI = -1, UNIT_POWER_OF_TEN = 0, DECA = 1, HECTO = 2, KILO = 3, MEGA = 6, GIGA = 9, TERA = 12, PETA = 15, EXA = 18, ZETTA = 21, YOTTA = 24 } |
SI powers of ten. More... | |
enum | power_of_two { UNIT_POWER_OF_TWO = 0, KIBI = 10, MEBI = 20, GIBI = 30, TEBI = 40, PEBI = 50, EXBI = 60, ZEBI = 70, YOBI = 80 } |
IEC powers of two (binary prefixes) More... | |
Functions | |
double | yocto () |
double | zepto () |
double | atto () |
double | femto () |
double | pico () |
double | nano () |
double | micro () |
double | milli () |
double | centi () |
double | deci () |
double | deca () |
double | hecto () |
double | kilo () |
double | mega () |
double | giga () |
double | tera () |
double | peta () |
double | exa () |
double | zetta () |
double | yotta () |
double | power_of_ten_to_factor (power_of_ten) |
Return the SI prefix factor associated to a given SI power of ten. More... | |
std::string | power_of_ten_to_name (power_of_ten) |
Return the SI name associated to a given SI power of ten. More... | |
std::string | power_of_ten_to_symbol (power_of_ten) |
Return the SI symbol associated to a given SI power of ten. More... | |
double | byte_to_bit_factor () |
Return the IEC 80000-13 byte (octet 8 bits) to bit factor. More... | |
double | power_of_two_to_factor (power_of_two) |
Return the IEC binary prefix approximated factor associated to a given IEC power of two. More... | |
std::string | power_of_two_to_name (power_of_two) |
Return the IEC binary prefix name associated to a given IEC power of two. More... | |
std::string | power_of_two_to_symbol (power_of_two) |
Return the IEC binary prefix symbol associated to a given IEC power of two. More... | |
size_t | registered_unit_dimension_labels (std::vector< std::string > &dimension_labels_) |
size_t | registered_unit_names (std::vector< std::string > &unit_names_) |
size_t | registered_unit_symbols (std::vector< std::string > &unit_symbols_) |
bool | is_unit_in_dimension_from (const std::string &unit_id_, const std::string &unit_dimension_label_) |
double | get_unit_in_dimension_from (const std::string &unit_id_, const std::string &unit_dimension_label_) |
double | get_length_unit_from (const std::string &unit_id_) |
double | get_surface_unit_from (const std::string &) |
Get the surface unit value from a string. More... | |
double | get_volume_unit_from (const std::string &) |
Get the volume unit value from a string. More... | |
double | get_time_unit_from (const std::string &) |
Get the time unit value from a string. More... | |
double | get_angle_unit_from (const std::string &) |
Get the angle unit value from a string. More... | |
double | get_solid_angle_unit_from (const std::string &) |
Get the solid angle unit value from a string. More... | |
double | get_energy_unit_from (const std::string &) |
Get the energy unit from a string. More... | |
double | get_mass_unit_from (const std::string &) |
Get the mass unitvalue from a string. More... | |
double | get_pressure_unit_from (const std::string &) |
Get the pressure unit value from a string. More... | |
double | get_magnetic_flux_density_unit_from (const std::string &) |
Get the magnetic field unit value from a string. More... | |
double | get_magnetic_field_unit_from (const std::string &) |
double | get_electric_field_unit_from (const std::string &) |
Get the electric field unit value from a string. More... | |
double | get_electric_potential_unit_from (const std::string &) |
Get the electric potential unit value from a string. More... | |
double | get_electric_tension_unit_from (const std::string &) |
double | get_temperature_unit_from (const std::string &) |
Get the temperature unit value from a string. More... | |
double | get_density_unit_from (const std::string &) |
Get the density unit value from a string. More... | |
double | get_activity_unit_from (const std::string &) |
Get the activity unit value from a string. More... | |
double | get_surface_activity_unit_from (const std::string &) |
Get the surface activity unit value from a string. More... | |
double | get_volume_activity_unit_from (const std::string &) |
Get the volume activity unit value from a string. More... | |
double | get_mass_activity_unit_from (const std::string &) |
Get the mass activity unit value from a string. More... | |
double | get_frequency_unit_from (const std::string &) |
Get the frequency unit value from a string. More... | |
double | get_electric_charge_unit_from (const std::string &) |
Get the electric charge unit value from a string. More... | |
double | get_electric_current_unit_from (const std::string &) |
Get the electric current unit value from a string. More... | |
double | get_velocity_unit_from (const std::string &) |
Get the velocity unit value from a string. More... | |
double | get_speed_unit_from (const std::string &) |
double | get_unit_from (const std::string &unit_type_, const std::string &unit_str_) |
Get the CLHEP unit value from a string specifiying the unit type. More... | |
double | get_unit (const std::string &unit_str_, bool throw_=false) |
Get the CLHEP unspecified unit value from a string. More... | |
bool | is_unit_label_valid (const std::string &unit_label_) |
Return an array containing the labels associated to all type of units supported by the datatools::units class. More... | |
std::string | get_default_unit_symbol_from_label (const std::string &unit_label_) |
Return the symbol of the default unit associated to a unit label supported by the datatools::units class. More... | |
bool | find_unit (const std::string &unit_str_, double &unit_value_, std::string &unit_label_) |
Find the specified unit and the associated unit label from a string. More... | |
double | get_value_with_unit (const std::string &word_) |
Get a value from a string taking into account the unit symbol. More... | |
bool | find_value_with_unit (const std::string &word_, double &value_, std::string &unit_label_, double default_unit_=std::numeric_limits< double >::quiet_NaN()) |
Get a value from a string taking into account the unit symbol. More... | |
bool | parse_value_with_unit (const std::string &word, double &value, std::string &unit_symbol, std::string &unit_label, uint32_t flags=0) |
Parse a value from a string taking into account the unit symbol, set the value, the unit symbol and unit label. More... | |
Utilities for units based on the CLHEP library's implementation.
The units namespace provides some methods to manipulate units values through strings. It is based on the system of units in the CLHEP package. A system registry of units (class datatools::units::unit) is provided to register arbitrary SI based units. Extension tools are provided beyond the CLHEP material.
double datatools::units::atto | ( | ) |
double datatools::units::byte_to_bit_factor | ( | ) |
Return the IEC 80000-13 byte (octet 8 bits) to bit factor.
double datatools::units::centi | ( | ) |
double datatools::units::deca | ( | ) |
double datatools::units::deci | ( | ) |
double datatools::units::exa | ( | ) |
double datatools::units::femto | ( | ) |
bool datatools::units::find_unit | ( | const std::string & | unit_str_, |
double & | unit_value_, | ||
std::string & | unit_label_ | ||
) |
Find the specified unit and the associated unit label from a string.
Example:
bool datatools::units::find_value_with_unit | ( | const std::string & | word_, |
double & | value_, | ||
std::string & | unit_label_, | ||
double | default_unit_ = std::numeric_limits< double >::quiet_NaN() |
||
) |
Get a value from a string taking into account the unit symbol.
Example:
double datatools::units::get_activity_unit_from | ( | const std::string & | ) |
Get the activity unit value from a string.
double datatools::units::get_angle_unit_from | ( | const std::string & | ) |
Get the angle unit value from a string.
std::string datatools::units::get_default_unit_symbol_from_label | ( | const std::string & | unit_label_ | ) |
Return the symbol of the default unit associated to a unit label supported by the datatools::units class.
double datatools::units::get_density_unit_from | ( | const std::string & | ) |
Get the density unit value from a string.
double datatools::units::get_electric_charge_unit_from | ( | const std::string & | ) |
Get the electric charge unit value from a string.
double datatools::units::get_electric_current_unit_from | ( | const std::string & | ) |
Get the electric current unit value from a string.
double datatools::units::get_electric_field_unit_from | ( | const std::string & | ) |
Get the electric field unit value from a string.
double datatools::units::get_electric_potential_unit_from | ( | const std::string & | ) |
Get the electric potential unit value from a string.
double datatools::units::get_electric_tension_unit_from | ( | const std::string & | ) |
double datatools::units::get_energy_unit_from | ( | const std::string & | ) |
Get the energy unit from a string.
double datatools::units::get_frequency_unit_from | ( | const std::string & | ) |
Get the frequency unit value from a string.
double datatools::units::get_length_unit_from | ( | const std::string & | unit_id_ | ) |
Get the length unit value from a string.
unit_id_ | the name or the symbol of the unit |
double datatools::units::get_magnetic_field_unit_from | ( | const std::string & | ) |
double datatools::units::get_magnetic_flux_density_unit_from | ( | const std::string & | ) |
Get the magnetic field unit value from a string.
double datatools::units::get_mass_activity_unit_from | ( | const std::string & | ) |
Get the mass activity unit value from a string.
double datatools::units::get_mass_unit_from | ( | const std::string & | ) |
Get the mass unitvalue from a string.
double datatools::units::get_pressure_unit_from | ( | const std::string & | ) |
Get the pressure unit value from a string.
double datatools::units::get_solid_angle_unit_from | ( | const std::string & | ) |
Get the solid angle unit value from a string.
double datatools::units::get_speed_unit_from | ( | const std::string & | ) |
double datatools::units::get_surface_activity_unit_from | ( | const std::string & | ) |
Get the surface activity unit value from a string.
double datatools::units::get_surface_unit_from | ( | const std::string & | ) |
Get the surface unit value from a string.
double datatools::units::get_temperature_unit_from | ( | const std::string & | ) |
Get the temperature unit value from a string.
double datatools::units::get_time_unit_from | ( | const std::string & | ) |
Get the time unit value from a string.
double datatools::units::get_unit | ( | const std::string & | unit_str_, |
bool | throw_ = false |
||
) |
Get the CLHEP unspecified unit value from a string.
Example:
double datatools::units::get_unit_from | ( | const std::string & | unit_type_, |
const std::string & | unit_str_ | ||
) |
Get the CLHEP unit value from a string specifiying the unit type.
Example:
double datatools::units::get_unit_in_dimension_from | ( | const std::string & | unit_id_, |
const std::string & | unit_dimension_label_ | ||
) |
Return the unit value associated to an unit given its id (name or symbol) and dimension
unit_id_ | the name or the symbol of the unit |
unit_dimension_label_ | the label of the unit dimension |
double datatools::units::get_value_with_unit | ( | const std::string & | word_ | ) |
Get a value from a string taking into account the unit symbol.
Example:
double datatools::units::get_velocity_unit_from | ( | const std::string & | ) |
Get the velocity unit value from a string.
double datatools::units::get_volume_activity_unit_from | ( | const std::string & | ) |
Get the volume activity unit value from a string.
double datatools::units::get_volume_unit_from | ( | const std::string & | ) |
Get the volume unit value from a string.
double datatools::units::giga | ( | ) |
double datatools::units::hecto | ( | ) |
bool datatools::units::is_unit_in_dimension_from | ( | const std::string & | unit_id_, |
const std::string & | unit_dimension_label_ | ||
) |
Check if a unit value given by id (name or symbol) is in a dimension
unit_id_ | the name or the symbol of the unit |
unit_dimension_label_ | the label of the unit dimension |
bool datatools::units::is_unit_label_valid | ( | const std::string & | unit_label_ | ) |
Return an array containing the labels associated to all type of units supported by the datatools::units class.
Check if a unit type with a given label is supported by the datatools::units class. Example:
double datatools::units::kilo | ( | ) |
double datatools::units::mega | ( | ) |
double datatools::units::micro | ( | ) |
double datatools::units::milli | ( | ) |
double datatools::units::nano | ( | ) |
bool datatools::units::parse_value_with_unit | ( | const std::string & | word, |
double & | value, | ||
std::string & | unit_symbol, | ||
std::string & | unit_label, | ||
uint32_t | flags = 0 |
||
) |
Parse a value from a string taking into account the unit symbol, set the value, the unit symbol and unit label.
Example:
This will output: value = 25.4 // because native unit for length is "mm" unit_symbol = "cm" unit_label = "length"
double datatools::units::peta | ( | ) |
double datatools::units::pico | ( | ) |
double datatools::units::power_of_ten_to_factor | ( | power_of_ten | ) |
Return the SI prefix factor associated to a given SI power of ten.
std::string datatools::units::power_of_ten_to_name | ( | power_of_ten | ) |
Return the SI name associated to a given SI power of ten.
std::string datatools::units::power_of_ten_to_symbol | ( | power_of_ten | ) |
Return the SI symbol associated to a given SI power of ten.
double datatools::units::power_of_two_to_factor | ( | power_of_two | ) |
Return the IEC binary prefix approximated factor associated to a given IEC power of two.
std::string datatools::units::power_of_two_to_name | ( | power_of_two | ) |
Return the IEC binary prefix name associated to a given IEC power of two.
std::string datatools::units::power_of_two_to_symbol | ( | power_of_two | ) |
Return the IEC binary prefix symbol associated to a given IEC power of two.
size_t datatools::units::registered_unit_dimension_labels | ( | std::vector< std::string > & | dimension_labels_ | ) |
Build the list of system registered dimension labels
dimension_labels_ | a vector of string to be filled by unit dimension labels |
size_t datatools::units::registered_unit_names | ( | std::vector< std::string > & | unit_names_ | ) |
Build the list of system registered unit names
unit_names_ | a vector of string to be filled by unit names |
size_t datatools::units::registered_unit_symbols | ( | std::vector< std::string > & | unit_symbols_ | ) |
Build the list of system registered unit symbols
unit_symbols_ | a vector of string to be filled by unit symbols |
double datatools::units::tera | ( | ) |
double datatools::units::yocto | ( | ) |
double datatools::units::yotta | ( | ) |
double datatools::units::zepto | ( | ) |
double datatools::units::zetta | ( | ) |