QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
unitofmeasureconversionmanager.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2008 J. Erik Radmall
5 Copyright (C) 2009 StatPro Italia srl
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
21/*! \file unitofmeasureconversionmanager.hpp
22 \brief Unit-of-measure conversion manager
23*/
24
25#ifndef quantlib_unit_of_measure_conversion_manager_hpp
26#define quantlib_unit_of_measure_conversion_manager_hpp
27
30#include <list>
31
32namespace QuantLib {
33
34 //! repository of conversion factors between units of measure
35 /*! \test lookup of direct unit of measure conversion is tested. */
37 : public Singleton<UnitOfMeasureConversionManager> {
39
40 public:
42 const CommodityType& commodityType,
43 const UnitOfMeasure&,
44 const UnitOfMeasure&,
47 void add(const UnitOfMeasureConversion&);
48 void clear();
49
50 private:
51 std::list<UnitOfMeasureConversion> data_;
55 const UnitOfMeasure& source,
56 const UnitOfMeasure& target) const;
58 const UnitOfMeasure& source,
59 const UnitOfMeasure& target,
60 std::list<std::string> forbidden =
61 std::list<std::string>()) const;
62 };
63
64}
65
66#endif
Basic support for the singleton pattern.
Definition: singleton.hpp:58
repository of conversion factors between units of measure
UnitOfMeasureConversion lookup(const CommodityType &commodityType, const UnitOfMeasure &, const UnitOfMeasure &, UnitOfMeasureConversion::Type type=UnitOfMeasureConversion::Derived) const
UnitOfMeasureConversion smartLookup(const CommodityType &commodityType, const UnitOfMeasure &source, const UnitOfMeasure &target, std::list< std::string > forbidden=std::list< std::string >()) const
UnitOfMeasureConversion directLookup(const CommodityType &commodityType, const UnitOfMeasure &source, const UnitOfMeasure &target) const
Unit of measure specification
Definition: any.hpp:35
basic support for the singleton pattern
Unit of measure conversion.