Junxiao Shi | cbba04c | 2014-01-26 14:21:22 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (C) 2014 Named Data Networking Project |
| 4 | * See COPYING for copyright and distribution information. |
| 5 | */ |
| 6 | |
| 7 | #ifndef NFD_TABLE_PIT_HPP |
| 8 | #define NFD_TABLE_PIT_HPP |
| 9 | |
| 10 | #include "pit-entry.hpp" |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 11 | namespace nfd { |
Junxiao Shi | cbba04c | 2014-01-26 14:21:22 -0700 | [diff] [blame] | 12 | namespace pit { |
| 13 | |
| 14 | /** \class DataMatchResult |
| 15 | * \brief an unordered iterable of all PIT entries matching Data |
| 16 | * This type shall support: |
| 17 | * iterator<shared_ptr<pit::Entry>> begin() |
| 18 | * iterator<shared_ptr<pit::Entry>> end() |
| 19 | */ |
| 20 | typedef std::vector<shared_ptr<pit::Entry> > DataMatchResult; |
| 21 | |
| 22 | } // namespace pit |
| 23 | |
| 24 | /** \class Pit |
| 25 | * \brief represents the PIT |
| 26 | */ |
| 27 | class Pit : noncopyable |
| 28 | { |
| 29 | public: |
| 30 | Pit(); |
| 31 | |
| 32 | ~Pit(); |
| 33 | |
| 34 | /** \brief inserts a FIB entry for prefix |
| 35 | * If an entry for exact same prefix exists, that entry is returned. |
| 36 | * \return{ the entry, and true for new entry, false for existing entry } |
| 37 | */ |
| 38 | std::pair<shared_ptr<pit::Entry>, bool> |
| 39 | insert(const Interest& interest); |
| 40 | |
| 41 | /** \brief performs a Data match |
| 42 | * \return{ an iterable of all PIT entries matching data } |
| 43 | */ |
| 44 | shared_ptr<pit::DataMatchResult> |
| 45 | findAllDataMatches(const Data& data) const; |
| 46 | |
| 47 | /// removes a PIT entry |
| 48 | void |
| 49 | remove(shared_ptr<pit::Entry> pitEntry); |
| 50 | |
| 51 | private: |
| 52 | std::list<shared_ptr<pit::Entry> > m_table; |
| 53 | }; |
| 54 | |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 55 | } // namespace nfd |
Junxiao Shi | cbba04c | 2014-01-26 14:21:22 -0700 | [diff] [blame] | 56 | |
| 57 | #endif // NFD_TABLE_PIT_HPP |