| 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 | |
| 20 | /*! \file pool.hpp |
| 21 | \brief pool of issuers |
| 22 | */ |
| 23 | |
| 24 | #ifndef quantlib_pool_hpp |
| 25 | #define quantlib_pool_hpp |
| 26 | |
| 27 | #include <ql/experimental/credit/issuer.hpp> |
| 28 | #include <map> |
| 29 | |
| 30 | namespace 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_; |
| 53 | /*! default events seniority and currency this name enters the basket |
| 54 | with. Determines to which event/probability this pool referes to. */ |
| 55 | std::map<std::string, DefaultProbKey> defaultKeys_; |
| 56 | }; |
| 57 | |
| 58 | } |
| 59 | |
| 60 | |
| 61 | #endif |
| 62 | |