UnitDescriptor.h
1/* Distributed under the Apache License, Version 2.0.
2 See accompanying NOTICE file for details.*/
3
4//----------------------------------------------------------------------------
9//----------------------------------------------------------------------------
10#pragma once
11
13{
14public:
15 // Defines what kind of constraint we impose on prefixes for this unit.
16 typedef enum {NONE, SOME, ALLBUT, ALL} PrefixModeType;
17
18 // ctor
19 CUnitDescriptor(const std::string &name, const std::string &symbol, unsigned int quantityTypeId, const std::string &targetUnit,
20 const double &convFac, const double &bias, PrefixModeType mode, const std::string &prefixSet);
21
22 bool IsPrefixAllowed(char prefix) const;
23
24 const double & GetConvFac() const
25 {
26 return m_dConvFac;
27 }
28
29 const double & GetBias() const
30 {
31 return m_dBias;
32 }
33
34 const std::string &GetName() const
35 {
36 return m_strName;
37 }
38
39 const std::string &GetSymbol() const
40 {
41 return m_strSymbol;
42 }
43
44 unsigned int GetQuantityTypeID() const
45 {
46 return m_uiQuantityTypeId;
47 }
48
49 bool IsDecibel() const
50 {
51 return m_bDBFlag;
52 }
53
54private:
55 double m_dConvFac;
56 double m_dBias;
57 std::string m_strName;
58 std::string m_strSymbol;
59 unsigned int m_uiQuantityTypeId;
61 std::string m_strPrefixSet;
63
64};
Definition: UnitDescriptor.h:13
bool IsPrefixAllowed(char prefix) const
Definition: UnitDescriptor.cpp:69
CUnitDescriptor(const std::string &name, const std::string &symbol, unsigned int quantityTypeId, const std::string &targetUnit, const double &convFac, const double &bias, PrefixModeType mode, const std::string &prefixSet)
Definition: UnitDescriptor.cpp:12
double m_dBias
Definition: UnitDescriptor.h:56
const std::string & GetName() const
Definition: UnitDescriptor.h:34
const double & GetConvFac() const
Definition: UnitDescriptor.h:24
double m_dConvFac
Definition: UnitDescriptor.h:55
unsigned int GetQuantityTypeID() const
Definition: UnitDescriptor.h:44
const std::string & GetSymbol() const
Definition: UnitDescriptor.h:39
PrefixModeType m_uiPrefixMode
Definition: UnitDescriptor.h:60
const double & GetBias() const
Definition: UnitDescriptor.h:29
std::string m_strSymbol
Definition: UnitDescriptor.h:58
std::string m_strPrefixSet
Definition: UnitDescriptor.h:61
bool IsDecibel() const
Definition: UnitDescriptor.h:49
unsigned int m_uiQuantityTypeId
Definition: UnitDescriptor.h:59
std::string m_strName
Definition: UnitDescriptor.h:57
PrefixModeType
Definition: UnitDescriptor.h:16
@ ALL
Definition: UnitDescriptor.h:16
@ SOME
Definition: UnitDescriptor.h:16
@ NONE
Definition: UnitDescriptor.h:16
@ ALLBUT
Definition: UnitDescriptor.h:16
bool m_bDBFlag
Definition: UnitDescriptor.h:62

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.