/src/quantlib/ql/experimental/commodities/exchangecontract.hpp
Line | Count | Source (jump to first uncovered line) |
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 | | <http://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 exchangecontract.hpp |
21 | | \brief Exchange contract |
22 | | */ |
23 | | |
24 | | #ifndef quantlib_exchange_contract_hpp |
25 | | #define quantlib_exchange_contract_hpp |
26 | | |
27 | | #include <ql/time/date.hpp> |
28 | | #include <map> |
29 | | #include <utility> |
30 | | |
31 | | namespace QuantLib { |
32 | | |
33 | | class ExchangeContract { |
34 | | public: |
35 | | ExchangeContract() = default; |
36 | | ExchangeContract(std::string code, |
37 | | Date expirationDate, |
38 | | Date underlyingStartDate, |
39 | | Date underlyingEndDate); |
40 | | |
41 | | const std::string& code() const; |
42 | | const Date& expirationDate() const; |
43 | | const Date& underlyingStartDate() const; |
44 | | const Date& underlyingEndDate() const; |
45 | | protected: |
46 | | std::string code_; |
47 | | Date expirationDate_; |
48 | | Date underlyingStartDate_; |
49 | | Date underlyingEndDate_; |
50 | | }; |
51 | | |
52 | | inline ExchangeContract::ExchangeContract(std::string code, |
53 | | Date expirationDate, |
54 | | Date underlyingStartDate, |
55 | | Date underlyingEndDate) |
56 | | : code_(std::move(code)), expirationDate_(expirationDate), |
57 | | underlyingStartDate_(underlyingStartDate), underlyingEndDate_(underlyingEndDate) {} |
58 | | |
59 | 0 | inline const std::string& ExchangeContract::code() const { |
60 | 0 | return code_; |
61 | 0 | } |
62 | | |
63 | 0 | inline const Date& ExchangeContract::expirationDate() const { |
64 | 0 | return expirationDate_; |
65 | 0 | } |
66 | | |
67 | 0 | inline const Date& ExchangeContract::underlyingStartDate() const { |
68 | 0 | return underlyingStartDate_; |
69 | 0 | } |
70 | | |
71 | 0 | inline const Date& ExchangeContract::underlyingEndDate() const { |
72 | 0 | return underlyingEndDate_; |
73 | 0 | } |
74 | | |
75 | | typedef std::map<Date, ExchangeContract> ExchangeContracts; |
76 | | |
77 | | } |
78 | | |
79 | | #endif |