Obaid | 793401d | 2014-02-27 19:13:49 -0600 | [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 NRD_RIB_HPP |
| 8 | #define NRD_RIB_HPP |
| 9 | |
| 10 | #include "common.hpp" |
| 11 | |
| 12 | namespace ndn { |
| 13 | namespace nrd { |
| 14 | |
| 15 | /** \brief represents the RIB |
| 16 | */ |
| 17 | class Rib |
| 18 | { |
| 19 | public: |
| 20 | typedef std::list<PrefixRegOptions> RibTable; |
| 21 | typedef RibTable::const_iterator const_iterator; |
| 22 | |
| 23 | Rib(); |
| 24 | |
| 25 | ~Rib(); |
| 26 | |
| 27 | const_iterator |
| 28 | find(const PrefixRegOptions& options) const; |
| 29 | |
| 30 | void |
| 31 | insert(const PrefixRegOptions& options); |
| 32 | |
| 33 | void |
| 34 | erase(const PrefixRegOptions& options); |
| 35 | |
Obaid | 6871187 | 2014-04-08 03:16:40 -0500 | [diff] [blame^] | 36 | void |
| 37 | erase(uint64_t faceId); |
| 38 | |
Obaid | 793401d | 2014-02-27 19:13:49 -0600 | [diff] [blame] | 39 | const_iterator |
| 40 | begin() const; |
| 41 | |
| 42 | const_iterator |
| 43 | end() const; |
| 44 | |
| 45 | size_t |
| 46 | size() const; |
| 47 | |
| 48 | size_t |
| 49 | empty() const; |
| 50 | |
| 51 | private: |
| 52 | // Note: Taking a list right now. A Trie will be used later to store |
| 53 | // prefixes |
| 54 | RibTable m_rib; |
| 55 | }; |
| 56 | |
| 57 | inline Rib::const_iterator |
| 58 | Rib::begin() const |
| 59 | { |
| 60 | return m_rib.begin(); |
| 61 | } |
| 62 | |
| 63 | inline Rib::const_iterator |
| 64 | Rib::end() const |
| 65 | { |
| 66 | return m_rib.end(); |
| 67 | } |
| 68 | |
| 69 | inline size_t |
| 70 | Rib::size() const |
| 71 | { |
| 72 | return m_rib.size(); |
| 73 | } |
| 74 | |
| 75 | inline size_t |
| 76 | Rib::empty() const |
| 77 | { |
| 78 | return m_rib.empty(); |
| 79 | } |
| 80 | |
| 81 | } // namespace nrd |
| 82 | } // namespace ndn |
| 83 | |
| 84 | #endif // NRD_RIB_HPP |