QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
pool.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2008 Roland Lichters
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
24#ifndef quantlib_pool_hpp
25#define quantlib_pool_hpp
26
27#include <ql/experimental/credit/issuer.hpp>
28#include <map>
29
30namespace QuantLib {
31
32 class Pool {
33 public:
34 Pool();
35 Size size() const;
36 void clear();
37 bool has (const std::string& name) const;
38 void add (const std::string& name, const Issuer& issuer,
39 const DefaultProbKey& contractTrigger = NorthAmericaCorpDefaultKey(
40 Currency(), SeniorSec, Period(), 1.));
41 const Issuer& get (const std::string& name) const;
42 const DefaultProbKey& defaultKey(const std::string& name) const;
43 void setTime(const std::string& name, Real time);
44 Real getTime (const std::string& name) const;
45 const std::vector<std::string>& names() const;
46 std::vector<DefaultProbKey> defaultKeys() const;
47 private:
48 // \todo: needs to cehck all defaul TS have the same ref date? here or
49 // where used? e.g. simulations.
50 std::map<std::string,Issuer> data_;
51 std::map<std::string,Real> time_;
52 std::vector<std::string> names_;
55 std::map<std::string, DefaultProbKey> defaultKeys_;
56 };
57
58}
59
60
61#endif
Currency specification
Definition: currency.hpp:36
ISDA standard default contractual key for corporate US debt.
const Issuer & get(const std::string &name) const
Definition: pool.cpp:54
std::map< std::string, Real > time_
Definition: pool.hpp:51
void add(const std::string &name, const Issuer &issuer, const DefaultProbKey &contractTrigger=NorthAmericaCorpDefaultKey(Currency(), SeniorSec, Period(), 1.))
Definition: pool.cpp:44
std::vector< DefaultProbKey > defaultKeys() const
Definition: pool.cpp:77
const DefaultProbKey & defaultKey(const std::string &name) const
Definition: pool.cpp:59
std::map< std::string, Issuer > data_
Definition: pool.hpp:50
Real getTime(const std::string &name) const
Definition: pool.cpp:64
void setTime(const std::string &name, Real time)
Definition: pool.cpp:69
const std::vector< std::string > & names() const
Definition: pool.cpp:73
bool has(const std::string &name) const
Definition: pool.cpp:40
std::vector< std::string > names_
Definition: pool.hpp:52
void clear()
Definition: pool.cpp:34
Size size() const
Definition: pool.cpp:30
std::map< std::string, DefaultProbKey > defaultKeys_
Definition: pool.hpp:55
QL_REAL Real
real number
Definition: types.hpp:50
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35