Quantity Class Reference

Amount of a commodity. More...

`#include <ql/experimental/commodities/quantity.hpp>`

## Public Member Functions

Constructors
| Quantity ()
| Quantity (const CommodityType &commodityType, const 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
static UnitOfMeasure | baseUnitOfMeasure
std::ostream & | operator<< (std::ostream &, const Quantity &)

## Detailed Description

Amount of a commodity.

## Member Enumeration Documentation

## ConversionType

enum ConversionType

Enumerator
NoConversion | do not perform conversions
BaseUnitOfMeasureConversion | convert both operands to the base unitOfMeasure before converting
AutomatedConversion | return the result in the unitOfMeasure of the first operand