QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
|
Amount of a commodity. More...
#include <quantity.hpp>
Public Member Functions | |
Constructors | |
Quantity ()=default | |
Quantity (CommodityType commodityType, UnitOfMeasure unitOfMeasure, Real amount) | |
Inspectors | |
const CommodityType & | commodityType () const |
const UnitOfMeasure & | unitOfMeasure () const |
Real | amount () const |
Quantity | rounded () const |
Quantity arithmetics | |
See below for non-member functions and for settings which determine the behavior of the operators. | |
Quantity | operator+ () const |
Quantity | operator- () const |
Quantity & | operator+= (const Quantity &) |
Quantity & | operator-= (const Quantity &) |
Quantity & | operator*= (Real) |
Quantity & | operator/= (Real) |
Related Functions | |
(Note that these are not member functions.) | |
Quantity | operator+ (const Quantity &, const Quantity &) |
Quantity | operator- (const Quantity &, const Quantity &) |
Quantity | operator* (const Quantity &, Real) |
Quantity | operator* (Real, const Quantity &) |
Quantity | operator/ (const Quantity &, Real) |
Real | operator/ (const Quantity &, const Quantity &) |
bool | operator== (const Quantity &, const Quantity &) |
bool | operator!= (const Quantity &, const Quantity &) |
bool | operator< (const Quantity &, const Quantity &) |
bool | operator<= (const Quantity &, const Quantity &) |
bool | operator> (const Quantity &, const Quantity &) |
bool | operator>= (const Quantity &, const Quantity &) |
bool | close (const Quantity &, const Quantity &, Size n=42) |
bool | close_enough (const Quantity &, const Quantity &, Size n=42) |
Conversion settings | |
These parameters are used for combining quantity amounts in different currencies | |
enum | ConversionType { NoConversion , BaseUnitOfMeasureConversion , AutomatedConversion } |
static ConversionType | conversionType = Quantity::NoConversion |
static UnitOfMeasure | baseUnitOfMeasure = UnitOfMeasure() |
CommodityType | commodityType_ |
UnitOfMeasure | unitOfMeasure_ |
Real | amount_ = 0.0 |
std::ostream & | operator<< (std::ostream &, const Quantity &) |
Amount of a commodity.
Definition at line 34 of file quantity.hpp.
enum ConversionType |
Definition at line 67 of file quantity.hpp.
|
default |
Quantity | ( | CommodityType | commodityType, |
UnitOfMeasure | unitOfMeasure, | ||
Real | amount | ||
) |
Definition at line 124 of file quantity.hpp.
const CommodityType & commodityType | ( | ) | const |
const UnitOfMeasure & unitOfMeasure | ( | ) | const |
Real amount | ( | ) | const |
Quantity rounded | ( | ) | const |
Quantity operator+ | ( | ) | const |
Definition at line 146 of file quantity.hpp.
Quantity operator- | ( | ) | const |
Definition at line 50 of file quantity.cpp.
Definition at line 68 of file quantity.cpp.
Definition at line 154 of file quantity.hpp.
Definition at line 159 of file quantity.hpp.
|
friend |
Definition at line 202 of file quantity.cpp.
Definition at line 165 of file quantity.hpp.
Definition at line 171 of file quantity.hpp.
Definition at line 177 of file quantity.hpp.
Definition at line 183 of file quantity.hpp.
Definition at line 187 of file quantity.hpp.
Definition at line 193 of file quantity.hpp.
Definition at line 197 of file quantity.hpp.
Definition at line 201 of file quantity.hpp.
|
static |
Definition at line 76 of file quantity.hpp.
|
static |
Definition at line 77 of file quantity.hpp.
|
private |
Definition at line 82 of file quantity.hpp.
|
private |
Definition at line 83 of file quantity.hpp.
|
private |
Definition at line 84 of file quantity.hpp.