Logo Search packages:      
Sourcecode: quantlib version File versions  Download package

Private Attributes | Friends | Related Functions

QuantLib::Quantity Class Reference

Amount of a commodity. More...

#include <quantity.hpp>

Collaboration diagram for QuantLib::Quantity:
Collaboration graph

List of all members.

Public Member Functions

 Quantity ()
 Quantity (const CommodityType &commodityType, const UnitOfMeasure &unitOfMeasure, Real amount)
const CommodityTypecommodityType () const
const UnitOfMeasureunitOfMeasure () 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
Quantityoperator+= (const Quantity &)
Quantityoperator-= (const Quantity &)
Quantityoperator*= (Real)
Quantityoperator/= (Real)

Private Attributes

Real amount_
CommodityType commodityType_
UnitOfMeasure unitOfMeasure_


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

Related Functions

(Note that these are not member functions.)

bool close (const Quantity &, const Quantity &, Size n=42)
bool close_enough (const Quantity &, const Quantity &, Size n=42)
bool operator!= (const Quantity &, const Quantity &)
Quantity operator* (const Quantity &, Real)
Quantity operator* (Real, const Quantity &)
Quantity operator+ (const Quantity &, const Quantity &)
Quantity operator- (const Quantity &, 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 &)

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

Detailed Description

Amount of a commodity.

Definition at line 33 of file quantity.hpp.

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index