BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
Public Member Functions
BeeeOn::ModuleType::Unit Class Reference

Representation of physical units. More...

#include <ModuleType.h>

Inheritance diagram for BeeeOn::ModuleType::Unit:
BeeeOn::Enum< UnitEnum >

Public Member Functions

 Unit (const UnitEnum::Raw &raw)
 
bool isValid (double value) const
 
std::string symbol (bool plain=false) const
 
std::string format (double value, bool plain=false) const
 
- Public Member Functions inherited from BeeeOn::Enum< UnitEnum >
 Enum (const Raw &raw)
 
Raw raw () const
 
const std::string & toString () const
 
 operator Raw () const
 
bool operator== (const Enum &other) const
 
bool operator== (const Enum::Raw &other) const
 
bool operator!= (const Enum &other) const
 
bool operator!= (const Enum::Raw &other) const
 
bool operator< (const Enum &other) const
 
bool operator< (const Enum::Raw &other) const
 
bool operator> (const Enum &other) const
 
bool operator> (const Enum::Raw &other) const
 
bool operator<= (const Enum &other) const
 
bool operator<= (const Enum::Raw &other) const
 
bool operator>= (const Enum &other) const
 
bool operator>= (const Enum::Raw &other) const
 

Additional Inherited Members

- Public Types inherited from BeeeOn::Enum< UnitEnum >
typedef typename UnitEnum::Raw Raw
 
typedef Enum< UnitEnum,
typename UnitEnum::Raw,
EnumNamesInitializer< typename
UnitEnum::Raw > > 
ThisEnum
 
typedef EnumHelper< Raw >::ValueMap ValueMap
 
typedef EnumHelper< Raw >::Value Value
 
- Static Public Member Functions inherited from BeeeOn::Enum< UnitEnum >
static const Iterable & all ()
 
static ThisEnum parse (const std::string &input)
 
static ThisEnum fromRaw (const Raw &raw)
 
static ThisEnum fromRaw (const unsigned int raw)
 
static ThisEnum random ()
 
- Static Protected Member Functions inherited from BeeeOn::Enum< UnitEnum >
static EnumHelper< Raw >::RawMap & rawMap ()
 
static const EnumHelper< Raw >
::NamesMap & 
namesMap ()
 

Detailed Description

Representation of physical units.

Member Function Documentation

string ModuleType::Unit::format ( double  value,
bool  plain = false 
) const
Returns
formatted string consisting of value and the unit's symbol separated by a space. If the unit has no symbol, only value is used. Note that the space separator might be omitted in the non-plain mode (e.g. for degree of Celsius).
See Also
ModuleType::Unit::symbol()
bool ModuleType::Unit::isValid ( double  value) const
Returns
true if the value is valid for the particular unit.
string ModuleType::Unit::symbol ( bool  plain = false) const

Get symbol for the given unit. If plain is false, the returned value can be a Unicode code point. When plain is true, the return value is a plain ASCII.


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