1 /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 
3 /*
4  Copyright (C) 2008 Roland Lichters
5  Copyright (C) 2008 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 #include <ql/termstructures/credit/flathazardrate.hpp>
22 #include <ql/quotes/simplequote.hpp>
23 
24 namespace QuantLib {
25 
FlatHazardRate(const Date & referenceDate,const Handle<Quote> & hazardRate,const DayCounter & dayCounter)26     FlatHazardRate::FlatHazardRate(const Date& referenceDate,
27                                    const Handle<Quote>& hazardRate,
28                                    const DayCounter& dayCounter)
29     : HazardRateStructure(referenceDate, Calendar(), dayCounter),
30       hazardRate_(hazardRate) {
31         registerWith(hazardRate_);
32     }
33 
FlatHazardRate(const Date & referenceDate,Rate hazardRate,const DayCounter & dayCounter)34     FlatHazardRate::FlatHazardRate(const Date& referenceDate,
35                                    Rate hazardRate,
36                                    const DayCounter& dayCounter)
37     : HazardRateStructure(referenceDate, Calendar(), dayCounter),
38       hazardRate_(ext::shared_ptr<Quote>(new SimpleQuote(hazardRate))) {}
39 
FlatHazardRate(Natural settlementDays,const Calendar & calendar,const Handle<Quote> & hazardRate,const DayCounter & dayCounter)40     FlatHazardRate::FlatHazardRate(Natural settlementDays,
41                                    const Calendar& calendar,
42                                    const Handle<Quote>& hazardRate,
43                                    const DayCounter& dayCounter)
44     : HazardRateStructure(settlementDays, calendar, dayCounter),
45       hazardRate_(hazardRate) {
46         registerWith(hazardRate_);
47     }
48 
FlatHazardRate(Natural settlementDays,const Calendar & calendar,Rate hazardRate,const DayCounter & dayCounter)49     FlatHazardRate::FlatHazardRate(Natural settlementDays,
50                                    const Calendar& calendar,
51                                    Rate hazardRate,
52                                    const DayCounter& dayCounter)
53     : HazardRateStructure(settlementDays, calendar, dayCounter),
54       hazardRate_(ext::shared_ptr<Quote>(new SimpleQuote(hazardRate))) {}
55 
56 }
57