TkN 2.1
Toolkit for Nuclei
tkunit Class Reference

A measured value associated to its unit. More...

Detailed Description

A measured value associated to its unit.

see tkn::tkunit_manager for more information

Definition at line 142 of file tkunit.h.

#include <tkunit.h>

Public Member Functions

 tkunit ()
 
 tkunit (double _value, const tkstring &_unit)
 
 tkunit (double _value, const tkunit_manager::units_keys &_unit)
 
virtual ~tkunit ()
 
void clear ()
 reset the data_unit More...
 
tkunit_manager::units_keys get_unit_key () const
 returns the unit key More...
 
tkstring get_unit_name () const
 returns the unit name More...
 
double get_value () const
 get the value in the current unit More...
 
bool set_unit (const tkstring &_unit)
 set the unit from a string More...
 
bool set_unit (const tkunit_manager::units_keys &_unit)
 set the unit from unit key More...
 
void set_value (const double &_val, const tkstring &_unit="")
 set the value and unit from string, if _unit not defined, let in the current unit More...
 
void set_value (const double &_val, const tkunit_manager::units_keys &_unit)
 set the value and unit from unit key, if _unit not defined, let in the current unit More...
 

Constructor & Destructor Documentation

◆ tkunit() [1/3]

tkunit ( )
inline

Definition at line 150 of file tkunit.h.

◆ tkunit() [2/3]

tkunit ( double  _value,
const tkunit_manager::units_keys _unit 
)

Definition at line 114 of file tkunit.cpp.

◆ tkunit() [3/3]

tkunit ( double  _value,
const tkstring _unit 
)
inline

Definition at line 152 of file tkunit.h.

◆ ~tkunit()

virtual ~tkunit ( )
inlinevirtual

Definition at line 154 of file tkunit.h.

Member Function Documentation

◆ clear()

void clear ( )
inline

reset the data_unit

Definition at line 175 of file tkunit.h.

◆ get_unit_key()

tkunit_manager::units_keys get_unit_key ( ) const
inline

returns the unit key

Definition at line 172 of file tkunit.h.

◆ get_unit_name()

tkstring get_unit_name ( ) const
inline

returns the unit name

Definition at line 170 of file tkunit.h.

◆ get_value()

double get_value ( ) const
inline

get the value in the current unit

Definition at line 157 of file tkunit.h.

◆ set_unit() [1/2]

bool set_unit ( const tkstring _unit)

set the unit from a string

Definition at line 138 of file tkunit.cpp.

◆ set_unit() [2/2]

bool set_unit ( const tkunit_manager::units_keys _unit)

set the unit from unit key

Definition at line 142 of file tkunit.cpp.

◆ set_value() [1/2]

void set_value ( const double &  _val,
const tkstring _unit = "" 
)

set the value and unit from string, if _unit not defined, let in the current unit

Definition at line 122 of file tkunit.cpp.

◆ set_value() [2/2]

void set_value ( const double &  _val,
const tkunit_manager::units_keys _unit 
)

set the value and unit from unit key, if _unit not defined, let in the current unit

Definition at line 132 of file tkunit.cpp.


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