OTX-Runtime for C++  
Quantity.h
1 #ifndef OpenTestSystem_Otx_Runtime_Api_DataTypes_Quantity_H
2 #define OpenTestSystem_Otx_Runtime_Api_DataTypes_Quantity_H
3 
4 #include "Object.h"
5 
6 #include <memory>
7 
8 namespace OpenTestSystem { namespace Otx { namespace Runtime { namespace Api { namespace DataTypes {
9  class Unit;
10 }}}}}
11 
12 namespace OpenTestSystem { namespace Otx { namespace Runtime { namespace Api {
16  namespace DataTypes {
20  class API_EXPORTS Quantity : public Object
21  {
22  public:
23  Quantity();
24  Quantity(double value);
25  Quantity(
26  double value,
27  std::shared_ptr<Unit> displayUnit,
28  bool hasDisplayPrecision,
29  int displayPrecision);
30 
31  virtual ~Quantity();
32 
33  double GetValue() const;
34  std::shared_ptr<Unit> GetDisplayUnit() const;
35  bool HasDisplayPrecision() const;
36  int GetDisplayPrecision() const;
37 
38  std::string ToLiteralString() const override;
39 
40  static bool LessThanOrEqual(std::shared_ptr<Quantity> q1, std::shared_ptr<Quantity> q2);
41  private:
42  double _value;
43  std::shared_ptr<Unit> _displayUnit;
44  bool _hasDisplayPrecision;
45  int _displayPrecision;
46  double GetBaseValue();
47  static std::shared_ptr<Unit> GetUnitForMathematicOperators(std::shared_ptr<Unit> unit1, std::shared_ptr<Unit> unit2);
48  };
49  }
50 }}}}
51 
52 #endif//OpenTestSystem_Otx_Runtime_Api_DataTypes_Quantity_H
Represents base of OTX DataTypes.
Definition: Object.h:17
Represents a Quantity.
Definition: Quantity.h:21
std::string ToLiteralString() const override
Gets literal string.
Namespace containing all objects related to testing inside automotive industry