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 {
14 public:
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 
54 private:
55  double m_dConvFac;
56  double m_dBias;
57  std::string m_strName;
58  std::string m_strSymbol;
59  unsigned int m_uiQuantityTypeId;
60  PrefixModeType m_uiPrefixMode;
61  std::string m_strPrefixSet;
62  bool m_bDBFlag;
63 
64 };
bool IsPrefixAllowed(char prefix) const
Definition: UnitDescriptor.cpp:69
PrefixModeType
Definition: UnitDescriptor.h:16
Definition: UnitDescriptor.h:16
bool IsDecibel() const
Definition: UnitDescriptor.h:49
unsigned int m_uiQuantityTypeId
Definition: UnitDescriptor.h:59
Definition: UnitDescriptor.h:12
PrefixModeType m_uiPrefixMode
Definition: UnitDescriptor.h:60
Definition: UnitDescriptor.h:16
const double & GetBias() const
Definition: UnitDescriptor.h:29
std::string m_strPrefixSet
Definition: UnitDescriptor.h:61
const std::string & GetSymbol() const
Definition: UnitDescriptor.h:39
bool m_bDBFlag
Definition: UnitDescriptor.h:62
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
Definition: UnitDescriptor.h:16
unsigned int GetQuantityTypeID() const
Definition: UnitDescriptor.h:44
double m_dBias
Definition: UnitDescriptor.h:56
Definition: UnitDescriptor.h:16
std::string m_strName
Definition: UnitDescriptor.h:57
std::string m_strSymbol
Definition: UnitDescriptor.h:58
const double & GetConvFac() const
Definition: UnitDescriptor.h:24
const std::string & GetName() const
Definition: UnitDescriptor.h:34
double m_dConvFac
Definition: UnitDescriptor.h:55