QuantityTypeDescriptor.h
1/* Distributed under the Apache License, Version 2.0.
2 See accompanying NOTICE file for details.*/
3
4//----------------------------------------------------------------------------
10//----------------------------------------------------------------------------
11#pragma once
12
13class CCompoundUnit;
14class CUnitDimension;
15
17{
18public:
19 // Ctor for a fundamental quantity
20 CQuantityTypeDescriptor(const std::string &name, int fundIdx, bool twentyLog);
21
22 // Ctor for a derived quantity
23 CQuantityTypeDescriptor(const std::string &name, CCompoundUnit *expansion, bool twentyLog);
24
25 // Need dtor to free the expansion
27
28 // Return the name of this quantity type
29 const std::string & GetName() const
30 {
31 return m_sName;
32 }
33
34 // Return the "fundamental index". This value is a unique monotonically-increasing
35 // numeric identifier given to each quantity type that designates a fundamental
36 // (such as time or mass), rather than derived (such as force or energy), quantity.
37 // For derived quantities, the value is -1.
38 int GetFundIdx() const
39 {
40 return m_iFundIdx;
41 }
42
43 // Return the expansion of a derived quantity type as a compound unit. The expansion
44 // defines the "base unit" (whether or not it has an explicit name) of this quantity
45 // in terms of a composition of units of other quantities.
47 {
48 return m_CUExpansion;
49 };
50
52 {
53 return m_CUD;
54 }
55
56 double GetBigness() const
57 {
58 return m_dBigness;
59 };
60
62 {
63 return m_bTwentyLogRule;
64 }
65
66
67
68 // disable the copy constructor so that I don't accidentally copy a descriptor
69 // when I really intended to initialize a reference to one. I made this mistake
70 // leaving off the '&' on a ref that was initialized with the result of
71 // UnitConversionEngine::GetQuantityTypeDescriptor(), thereby invoking the
72 // copy constructor with bitwise copies on our internal pointer objects, and later
73 // called out dtor when my would-be ref went out of scope, which freed objects that
74 // were still in use. Ugh.
75private:
77
78private:
79 double m_dBigness;
80 std::string m_sName;
85};
Definition: CompoundUnit.h:40
Definition: QuantityTypeDescriptor.h:17
const CUnitDimension * GetDimension() const
Definition: QuantityTypeDescriptor.h:51
CCompoundUnit * m_CUExpansion
Definition: QuantityTypeDescriptor.h:82
std::string m_sName
Definition: QuantityTypeDescriptor.h:80
~CQuantityTypeDescriptor()
Definition: QuantityTypeDescriptor.cpp:36
const std::string & GetName() const
Definition: QuantityTypeDescriptor.h:29
double m_dBigness
Definition: QuantityTypeDescriptor.h:79
double GetBigness() const
Definition: QuantityTypeDescriptor.h:56
CQuantityTypeDescriptor(const std::string &name, int fundIdx, bool twentyLog)
Definition: QuantityTypeDescriptor.cpp:12
bool m_bTwentyLogRule
Definition: QuantityTypeDescriptor.h:84
CUnitDimension * m_CUD
Definition: QuantityTypeDescriptor.h:83
int GetFundIdx() const
Definition: QuantityTypeDescriptor.h:38
int m_iFundIdx
Definition: QuantityTypeDescriptor.h:81
bool Is20LogRuleQuantity() const
Definition: QuantityTypeDescriptor.h:61
CQuantityTypeDescriptor(const CQuantityTypeDescriptor &)
const CCompoundUnit * GetExpansion() const
Definition: QuantityTypeDescriptor.h:46
Definition: UnitDimension.h:22

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.