#include <UnitConversionEngine.h>

Public Types

typedef std::vector< CQuantityTypeDescriptor * > QuantityTypeList
 
typedef std::vector< CUnitDescriptor * > UnitList
 
typedef std::vector< CPrefixDescriptor * > PrefixList
 
typedef std::vector< CQuantityConversionDescriptor * > QuantityConversionList
 
typedef std::unordered_map< char, unsigned int > PrefixMap
 
typedef std::unordered_map< std::string, unsigned int > UnitSymbolMap
 
typedef std::unordered_map< std::string, unsigned int > QuantityNameMap
 
typedef std::unordered_map< CQuantityConversionKey, unsigned int > QuantityConversionMap
 
typedef std::unordered_map< CUnitDimension, unsigned int > DimensionToQuantityMap
 

Public Member Functions

double ConvertValue (const double &value, const CCompoundUnit &fromUnit, const CCompoundUnit &toUnit) const
 
double ConvertValue (const double &value, const std::string &fromUnit, const std::string &toUnit) const
 
double QuickConvertValue (const double &value, const CCompoundUnit &fromUnit, const CCompoundUnit &toUnit) const
 
double QuickConvertValue (const double &value, const std::string &fromUnit, const std::string &toUnit) const
 
double ConvertValueInterval (const double &value, const CCompoundUnit &fromUnit, const CCompoundUnit &toUnit) const
 
double ConvertValueInterval (const double &value, const std::string &fromUnit, const std::string &toUnit) const
 
double ConvertQuantityType (const double &value, const CCompoundUnit &fromUnit, const CCompoundUnit &toUnit) const
 
int GetUnitID (const std::string &unitSym) const
 
int GetQuantityTypeID (const std::string &qtName) const
 
int GetQuantityTypeID (const CUnitDimension &ud) const
 
int GetQuantityConversionID (const CUnitDimension *fromDim, const CUnitDimension *toDim) const
 
bool GetQuantityConversionParams (const CUnitDimension *fromDim, const CUnitDimension *toDim, double &fromExp, CCompoundUnit &mappingUnit) const
 
CCompoundUnitGetCompoundUnit (const std::string &unitString) const
 
bool LookupFullUnit (const std::string &fullUnitSym, int &unitID, double &prefixScaleFac) const
 
bool LookupFullUnit (const std::string &fullUnitSym, int &unitID, int &prefixID) const
 
const CUnitDescriptorGetUnitDescriptor (int unitID) const
 
const CQuantityTypeDescriptorGetQuantityTypeDescriptor (int qtID) const
 
const CPrefixDescriptorGetPrefixDescriptor (int pfxID) const
 
const CQuantityConversionDescriptorGetQuantityConversionDescriptor (int qcID) const
 
int GetNumQuantities ()
 
int GetNumFundamentalQuantities ()
 
void LoadDefinitions ()
 
CUnitDescriptorNewUnit (const std::string &name, const std::string &symbol, unsigned int quantityTypeId, const std::string &targetUnit, const double &convFac, const double &bias, CUnitDescriptor::PrefixModeType mode, const std::string &prefixSet)
 
CQuantityTypeDescriptorNewQuantityType (const std::string &name, const std::string &expansion="", bool twentyLog=false)
 
CPrefixDescriptorNewPrefix (const std::string &name, const std::string &sym, const double &scaleFac)
 
CQuantityConversionDescriptorNewQuantityConversion (const std::string &fromTypeName, double fromExp, const std::string &toTypeName, const std::string &mappingUnit)
 

Static Public Member Functions

static CUnitConversionEngineGetEngine (void)
 
static void DestroyEngine ()
 

Private Member Functions

 CUnitConversionEngine ()
 
 CUnitConversionEngine (const CUnitConversionEngine &)
 
 ~CUnitConversionEngine ()
 
void GetUCEdefs ()
 

Private Attributes

QuantityTypeListm_QTList
 
UnitListm_UList
 
PrefixListm_PList
 
QuantityConversionListm_QCList
 
PrefixMapm_PMap
 
UnitSymbolMapm_USMap
 
QuantityNameMapm_QNMap
 
QuantityConversionMapm_QCMap
 
DimensionToQuantityMapm_D2QMap
 
int m_iNumFundamentalQuantities
 
int m_iNumQuantities
 
std::stringstream m_UCEdefs
 

Static Private Attributes

static CUnitConversionEngineuce =nullptr
 

Member Typedef Documentation

◆ DimensionToQuantityMap

typedef std::unordered_map<CUnitDimension, unsigned int> CUnitConversionEngine::DimensionToQuantityMap

◆ PrefixList

◆ PrefixMap

typedef std::unordered_map<char,unsigned int> CUnitConversionEngine::PrefixMap

◆ QuantityConversionList

◆ QuantityConversionMap

typedef std::unordered_map<CQuantityConversionKey, unsigned int> CUnitConversionEngine::QuantityConversionMap

◆ QuantityNameMap

typedef std::unordered_map<std::string,unsigned int> CUnitConversionEngine::QuantityNameMap

◆ QuantityTypeList

◆ UnitList

◆ UnitSymbolMap

typedef std::unordered_map<std::string,unsigned int> CUnitConversionEngine::UnitSymbolMap

Constructor & Destructor Documentation

◆ CUnitConversionEngine() [1/2]

CUnitConversionEngine::CUnitConversionEngine ( )
private

◆ CUnitConversionEngine() [2/2]

CUnitConversionEngine::CUnitConversionEngine ( const CUnitConversionEngine )
inlineprivate

◆ ~CUnitConversionEngine()

CUnitConversionEngine::~CUnitConversionEngine ( )
private

Member Function Documentation

◆ ConvertQuantityType()

double CUnitConversionEngine::ConvertQuantityType ( const double &  value,
const CCompoundUnit fromUnit,
const CCompoundUnit toUnit 
) const

◆ ConvertValue() [1/2]

double CUnitConversionEngine::ConvertValue ( const double &  value,
const CCompoundUnit fromUnit,
const CCompoundUnit toUnit 
) const

◆ ConvertValue() [2/2]

double CUnitConversionEngine::ConvertValue ( const double &  value,
const std::string &  fromUnit,
const std::string &  toUnit 
) const

◆ ConvertValueInterval() [1/2]

double CUnitConversionEngine::ConvertValueInterval ( const double &  value,
const CCompoundUnit fromUnit,
const CCompoundUnit toUnit 
) const

◆ ConvertValueInterval() [2/2]

double CUnitConversionEngine::ConvertValueInterval ( const double &  value,
const std::string &  fromUnit,
const std::string &  toUnit 
) const

◆ DestroyEngine()

static void CUnitConversionEngine::DestroyEngine ( )
inlinestatic

◆ GetCompoundUnit()

CCompoundUnit * CUnitConversionEngine::GetCompoundUnit ( const std::string &  unitString) const

◆ GetEngine()

static CUnitConversionEngine& CUnitConversionEngine::GetEngine ( void  )
inlinestatic

◆ GetNumFundamentalQuantities()

int CUnitConversionEngine::GetNumFundamentalQuantities ( )
inline

◆ GetNumQuantities()

int CUnitConversionEngine::GetNumQuantities ( )
inline

◆ GetPrefixDescriptor()

const CPrefixDescriptor& CUnitConversionEngine::GetPrefixDescriptor ( int  pfxID) const
inline

◆ GetQuantityConversionDescriptor()

const CQuantityConversionDescriptor& CUnitConversionEngine::GetQuantityConversionDescriptor ( int  qcID) const
inline

◆ GetQuantityConversionID()

int CUnitConversionEngine::GetQuantityConversionID ( const CUnitDimension fromDim,
const CUnitDimension toDim 
) const

◆ GetQuantityConversionParams()

bool CUnitConversionEngine::GetQuantityConversionParams ( const CUnitDimension fromDim,
const CUnitDimension toDim,
double &  fromExp,
CCompoundUnit mappingUnit 
) const

◆ GetQuantityTypeDescriptor()

const CQuantityTypeDescriptor& CUnitConversionEngine::GetQuantityTypeDescriptor ( int  qtID) const
inline

◆ GetQuantityTypeID() [1/2]

int CUnitConversionEngine::GetQuantityTypeID ( const std::string &  qtName) const

◆ GetQuantityTypeID() [2/2]

int CUnitConversionEngine::GetQuantityTypeID ( const CUnitDimension ud) const

◆ GetUCEdefs()

void CUnitConversionEngine::GetUCEdefs ( )
private

◆ GetUnitDescriptor()

const CUnitDescriptor& CUnitConversionEngine::GetUnitDescriptor ( int  unitID) const
inline

◆ GetUnitID()

int CUnitConversionEngine::GetUnitID ( const std::string &  unitSym) const

◆ LoadDefinitions()

void CUnitConversionEngine::LoadDefinitions ( )

◆ LookupFullUnit() [1/2]

bool CUnitConversionEngine::LookupFullUnit ( const std::string &  fullUnitSym,
int &  unitID,
double &  prefixScaleFac 
) const
inline

◆ LookupFullUnit() [2/2]

bool CUnitConversionEngine::LookupFullUnit ( const std::string &  fullUnitSym,
int &  unitID,
int &  prefixID 
) const

◆ NewPrefix()

CPrefixDescriptor * CUnitConversionEngine::NewPrefix ( const std::string &  name,
const std::string &  sym,
const double &  scaleFac 
)

◆ NewQuantityConversion()

CQuantityConversionDescriptor * CUnitConversionEngine::NewQuantityConversion ( const std::string &  fromTypeName,
double  fromExp,
const std::string &  toTypeName,
const std::string &  mappingUnit 
)

◆ NewQuantityType()

CQuantityTypeDescriptor * CUnitConversionEngine::NewQuantityType ( const std::string &  name,
const std::string &  expansion = "",
bool  twentyLog = false 
)

◆ NewUnit()

CUnitDescriptor * CUnitConversionEngine::NewUnit ( const std::string &  name,
const std::string &  symbol,
unsigned int  quantityTypeId,
const std::string &  targetUnit,
const double &  convFac,
const double &  bias,
CUnitDescriptor::PrefixModeType  mode,
const std::string &  prefixSet 
)

◆ QuickConvertValue() [1/2]

double CUnitConversionEngine::QuickConvertValue ( const double &  value,
const CCompoundUnit fromUnit,
const CCompoundUnit toUnit 
) const

◆ QuickConvertValue() [2/2]

double CUnitConversionEngine::QuickConvertValue ( const double &  value,
const std::string &  fromUnit,
const std::string &  toUnit 
) const

Member Data Documentation

◆ m_D2QMap

DimensionToQuantityMap* CUnitConversionEngine::m_D2QMap
private

◆ m_iNumFundamentalQuantities

int CUnitConversionEngine::m_iNumFundamentalQuantities
private

◆ m_iNumQuantities

int CUnitConversionEngine::m_iNumQuantities
private

◆ m_PList

PrefixList* CUnitConversionEngine::m_PList
private

◆ m_PMap

PrefixMap* CUnitConversionEngine::m_PMap
private

◆ m_QCList

QuantityConversionList* CUnitConversionEngine::m_QCList
private

◆ m_QCMap

QuantityConversionMap* CUnitConversionEngine::m_QCMap
private

◆ m_QNMap

QuantityNameMap* CUnitConversionEngine::m_QNMap
private

◆ m_QTList

QuantityTypeList* CUnitConversionEngine::m_QTList
private

◆ m_UCEdefs

std::stringstream CUnitConversionEngine::m_UCEdefs
private

◆ m_UList

UnitList* CUnitConversionEngine::m_UList
private

◆ m_USMap

UnitSymbolMap* CUnitConversionEngine::m_USMap
private

◆ uce

CUnitConversionEngine * CUnitConversionEngine::uce =nullptr
staticprivate