QuantLib: a free/open-source library for quantitative finance
Reference manual - version 1.40
Loading...
Searching...
No Matches
UnitOfMeasure Class Reference

Unit of measure specification More...

#include <ql/experimental/commodities/unitofmeasure.hpp>

Public Types

enum  Type { Mass , Volume , Energy , Quantity }

Public Member Functions

 UnitOfMeasure ()=default
 default constructor
 UnitOfMeasure (const std::string &name, const std::string &code, Type unitType)
Inspectors
const std::string & name () const
 name, e.g, "Barrels"
const std::string & code () const
 code, e.g, "BBL", "MT"
Type unitType () const
 unit type (mass, volume...)

(Note that these are not member symbols.)

bool operator== (const UnitOfMeasure &, const UnitOfMeasure &)
bool operator!= (const UnitOfMeasure &, const UnitOfMeasure &)
std::ostream & operator<< (std::ostream &, const UnitOfMeasure &)

Other information

ext::shared_ptr< Data > data_
bool empty () const
 is this a usable instance?
const Roundingrounding () const
const UnitOfMeasuretriangulationUnitOfMeasure () const
 unit used for triangulation when required

Detailed Description

Unit of measure specification

Constructor & Destructor Documentation

◆ UnitOfMeasure()

UnitOfMeasure ( )
default

default constructor

Instances built via this constructor have undefined behavior. Such instances can only act as placeholders and must be reassigned to a valid currency before being used.