TkN 2.1
Toolkit for Nuclei
tkunit_manager Class Reference

Manages the different units. More...

Detailed Description

Manages the different units.

As seen in the tkn::tkmeasure class, tkn offers the possibility to convert some measure into different units
Currently, tkn handles three unit types: Energy, Time en Lenght. Few other units are included in tkn but that cannot be converted

The available energy units are the following: eV, keV, MeV, GeV, TeV
The available time units are the following: as, fs, ps, ns, us, ms, s, min, h, d, y
The available lenght units are the following: am, fm, pm, nm, um, mm, cm, m

In general, units can be converted only in the scale of a same type. One exception is given for the energy to time conversion. For very low lifetimes, it is common to express the width of a level in energy. This conversion is taken into account in tkn.

Definition at line 54 of file tkunit.h.

#include <tkunit.h>

Public Types

enum  units_keys {
  Undef_unit , eV , keV , MeV ,
  GeV , TeV , as , fs ,
  ps , ns , us , ms ,
  s , min , h , d ,
  y , am , fm , pm ,
  nm , um , mm , cm ,
  m
}
 units identifiers More...
 
enum  units_type {
  kUndef_type , kEnergy , kTime , kLenght ,
  kNoConvUnits
}
 flags that qualify the unit type More...
 

Public Member Functions

 tkunit_manager ()
 
virtual ~tkunit_manager ()=default
 
units_keys get_key (const tkstring &_name)
 retuns unit key More...
 
tkstring get_name (const units_keys &_key)
 retuns unit name More...
 
units_type get_type (const units_keys &_key)
 retuns unit type More...
 

Static Public Member Functions

static tkunit_managerthe_unit_manager ()
 db_manager is a singleton More...
 

Static Public Attributes

static std::vector< std::tuple< tkstring, units_type, double > > funits_properties
 

Friends

class tkunit
 

Member Enumeration Documentation

◆ units_keys

enum units_keys

units identifiers

Enumerator
Undef_unit 
eV 
keV 
MeV 
GeV 
TeV 
as 
fs 
ps 
ns 
us 
ms 
min 
am 
fm 
pm 
nm 
um 
mm 
cm 

Definition at line 69 of file tkunit.h.

◆ units_type

enum units_type

flags that qualify the unit type

Enumerator
kUndef_type 
kEnergy 
kTime 
kLenght 
kNoConvUnits 

Definition at line 61 of file tkunit.h.

Constructor & Destructor Documentation

◆ tkunit_manager()

Definition at line 94 of file tkunit.cpp.

◆ ~tkunit_manager()

virtual ~tkunit_manager ( )
virtualdefault

Member Function Documentation

◆ get_key()

units_keys get_key ( const tkstring _name)
inline

retuns unit key

Definition at line 102 of file tkunit.h.

◆ get_name()

tkstring get_name ( const units_keys _key)
inline

retuns unit name

Definition at line 96 of file tkunit.h.

◆ get_type()

units_type get_type ( const units_keys _key)
inline

retuns unit type

Definition at line 118 of file tkunit.h.

◆ the_unit_manager()

tkunit_manager * the_unit_manager ( )
static

db_manager is a singleton

Definition at line 105 of file tkunit.cpp.

Friends And Related Function Documentation

◆ tkunit

friend class tkunit
friend

Definition at line 56 of file tkunit.h.

Member Data Documentation

◆ funits_properties

std::vector< std::tuple< tkstring, tkunit_manager::units_type, double > > funits_properties
static

Definition at line 75 of file tkunit.h.


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