This file is indexed.

/usr/include/ql/currencies/exchangeratemanager.hpp is in libquantlib0-dev 1.7.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */

/*
 Copyright (C) 2004, 2005 StatPro Italia srl
 Copyright (C) 2004 Decillion Pty(Ltd)

 This file is part of QuantLib, a free-software/open-source library
 for financial quantitative analysts and developers - http://quantlib.org/

 QuantLib is free software: you can redistribute it and/or modify it
 under the terms of the QuantLib license.  You should have received a
 copy of the license along with this program; if not, please email
 <quantlib-dev@lists.sf.net>. The license is also available online at
 <http://quantlib.org/license.shtml>.

 This program is distributed in the hope that it will be useful, but WITHOUT
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 FOR A PARTICULAR PURPOSE.  See the license for more details.
*/

/*! \file exchangeratemanager.hpp
    \brief exchange-rate repository
*/

#ifndef quantlib_exchange_rate_manager_hpp
#define quantlib_exchange_rate_manager_hpp

#include <ql/exchangerate.hpp>
#include <ql/time/date.hpp>
#include <ql/patterns/singleton.hpp>
#include <list>
#include <map>

namespace QuantLib {

    //! exchange-rate repository
    /*! \test lookup of direct, triangulated, and derived exchange
              rates is tested.
    */
    class ExchangeRateManager : public Singleton<ExchangeRateManager> {
        friend class Singleton<ExchangeRateManager>;
      private:
        ExchangeRateManager();
      public:
        //! Add an exchange rate.
        /*! The given rate is valid between the given dates.

            \note If two rates are given between the same currencies
                  and with overlapping date ranges, the latest one
                  added takes precedence during lookup.
        */
        void add(const ExchangeRate&,
                 const Date& startDate = Date::minDate(),
                 const Date& endDate = Date::maxDate());
        /*! Lookup the exchange rate between two currencies at a given
            date.  If the given type is Direct, only direct exchange
            rates will be returned if available; if Derived, direct
            rates are still preferred but derived rates are allowed.

            \warning if two or more exchange-rate chains are possible
                     which allow to specify a requested rate, it is
                     unspecified which one is returned.
        */
        ExchangeRate lookup(const Currency& source,
                            const Currency& target,
                            Date date = Date(),
                            ExchangeRate::Type type =
                                                 ExchangeRate::Derived) const;
        //! remove the added exchange rates
        void clear();

        struct Entry {
            Entry() {}
            Entry(const ExchangeRate& rate,
                  const Date& start, const Date& end)
            : rate(rate), startDate(start), endDate(end) {}
            ExchangeRate rate;
            Date startDate, endDate;
        };
      private:
        typedef BigInteger Key;
        mutable std::map<Key, std::list<Entry> > data_;
        Key hash(const Currency&, const Currency&) const;
        bool hashes(Key, const Currency&) const;
        void addKnownRates();
        ExchangeRate directLookup(const Currency& source,
                                  const Currency& target,
                                  const Date& date) const;
        ExchangeRate smartLookup(const Currency& source,
                                 const Currency& target,
                                 const Date& date,
                                 std::list<Integer> forbiddenCodes
                                        = std::list<Integer>()) const;
        const ExchangeRate* fetch(const Currency& source,
                                  const Currency& target,
                                  const Date& date) const;
    };

}


#endif