QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
paymentterm.cpp
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#include <ql/experimental/commodities/paymentterm.hpp>
21
22namespace QuantLib {
23
24 std::map<std::string, ext::shared_ptr<PaymentTerm::Data> >
26
27 PaymentTerm::PaymentTerm(const std::string& name,
28 PaymentTerm::EventType eventType,
29 Integer offsetDays,
30 const Calendar& calendar) {
31 std::map<std::string, ext::shared_ptr<PaymentTerm::Data> >::const_iterator i = paymentTerms_.find(name);
32 if (i != paymentTerms_.end())
33 data_ = i->second;
34 else {
35 data_ = ext::make_shared<PaymentTerm::Data>(
39 }
40 }
41
42 std::ostream& operator<<(std::ostream& out, const PaymentTerm& c) {
43 if (!c.empty())
44 return out << c.name();
45 else
46 return out << "null payment term type";
47 }
48
49}
50
calendar class
Definition: calendar.hpp:61
const std::string & name() const
name, e.g, "Pricing end + 5 days"
Definition: paymentterm.hpp:89
Integer offsetDays() const
Definition: paymentterm.hpp:97
const Calendar & calendar() const
static std::map< std::string, ext::shared_ptr< Data > > paymentTerms_
Definition: paymentterm.hpp:66
EventType eventType() const
Definition: paymentterm.hpp:93
ext::shared_ptr< Data > data_
Definition: paymentterm.hpp:55
QL_INTEGER Integer
integer number
Definition: types.hpp:35
Definition: any.hpp:35
std::ostream & operator<<(std::ostream &out, GFunctionFactory::YieldCurveModel type)