Coverage Report

Created: 2026-03-11 06:44

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/quantlib/ql/experimental/commodities/petroleumunitsofmeasure.hpp
Line
Count
Source
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
/*
4
 Copyright (C) 2008 J. Erik Radmall
5
6
 This file is part of QuantLib, a free-software/open-source library
7
 for financial quantitative analysts and developers - http://quantlib.org/
8
9
 QuantLib is free software: you can redistribute it and/or modify it
10
 under the terms of the QuantLib license.  You should have received a
11
 copy of the license along with this program; if not, please email
12
 <quantlib-dev@lists.sf.net>. The license is also available online at
13
 <https://www.quantlib.org/license.shtml>.
14
15
 This program is distributed in the hope that it will be useful, but WITHOUT
16
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17
 FOR A PARTICULAR PURPOSE.  See the license for more details.
18
*/
19
20
/*! \file petroleumunitsofmeasure.hpp
21
    \brief Petroleum units of measure
22
*/
23
24
#ifndef quantlib_petroleum_units_of_measure_hpp
25
#define quantlib_petroleum_units_of_measure_hpp
26
27
#include <ql/experimental/commodities/unitofmeasure.hpp>
28
29
namespace QuantLib {
30
31
    class BarrelUnitOfMeasure : public UnitOfMeasure {
32
      public:
33
0
        BarrelUnitOfMeasure() {
34
0
            static ext::shared_ptr<Data> data(
35
0
                           new Data("Barrels", "BBL", UnitOfMeasure::Volume));
36
0
            data_ = data;
37
0
        }
38
    };
39
40
    class MTUnitOfMeasure : public UnitOfMeasure {
41
      public:
42
0
        MTUnitOfMeasure() {
43
0
            static ext::shared_ptr<Data> data(
44
0
                        new Data("Metric Tonnes", "MT", UnitOfMeasure::Mass));
45
0
            data_ = data;
46
0
        }
47
    };
48
49
    class MBUnitOfMeasure : public UnitOfMeasure {
50
      public:
51
0
        MBUnitOfMeasure() {
52
0
            static ext::shared_ptr<Data> data(
53
0
                         new Data("1000 Barrels", "MB", UnitOfMeasure::Volume,
54
0
                                  BarrelUnitOfMeasure()));
55
0
            data_ = data;
56
0
        }
57
    };
58
59
    class GallonUnitOfMeasure : public UnitOfMeasure {
60
      public:
61
0
        GallonUnitOfMeasure() {
62
0
            static ext::shared_ptr<Data> data(
63
0
                          new Data("US Gallons", "GAL", UnitOfMeasure::Volume,
64
0
                                   BarrelUnitOfMeasure()));
65
0
            data_ = data;
66
0
        }
67
    };
68
69
    class LitreUnitOfMeasure : public UnitOfMeasure {
70
      public:
71
0
        LitreUnitOfMeasure() {
72
0
            static ext::shared_ptr<Data> data(
73
0
                                new Data("Litres", "l", UnitOfMeasure::Volume,
74
0
                                         BarrelUnitOfMeasure()));
75
0
            data_ = data;
76
0
        }
77
    };
78
79
    class KilolitreUnitOfMeasure : public UnitOfMeasure {
80
      public:
81
0
        KilolitreUnitOfMeasure() {
82
0
            static ext::shared_ptr<Data> data(
83
0
                           new Data("Kilolitres", "kl", UnitOfMeasure::Volume,
84
0
                                    BarrelUnitOfMeasure()));
85
0
            data_ = data;
86
0
        }
87
    };
88
89
    class TokyoKilolitreUnitOfMeasure : public UnitOfMeasure {
90
      public:
91
0
        TokyoKilolitreUnitOfMeasure() {
92
0
            static ext::shared_ptr<Data> data(
93
0
                new Data("Tokyo Kilolitres", "KL_tk", UnitOfMeasure::Volume,
94
0
                         BarrelUnitOfMeasure()));
95
0
            data_ = data;
96
0
        }
97
    };
98
99
}
100
101
102
#endif