# baseUnitOfMeasure (3) - Linux Manuals

## NAME

QuantLib::Quantity - Amount of a commodity.

## SYNOPSIS

#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)

### Friends

std::ostream & operator<< (std::ostream &, const Quantity &)

### 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

## Detailed Description

Amount of a commodity.

## Member Enumeration Documentation

### 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

## Author

Generated automatically by Doxygen for QuantLib from the source code.