blob: 3196817f27b7cc492a447bf9029d244aaa9ebb5c [file] [log] [blame]
Obaid793401d2014-02-27 19:13:49 -06001/* -*- 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
12namespace ndn {
13namespace nrd {
14
15/** \brief represents the RIB
16 */
17class Rib
18{
19public:
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
Obaid68711872014-04-08 03:16:40 -050036 void
37 erase(uint64_t faceId);
38
Obaid793401d2014-02-27 19:13:49 -060039 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
51private:
52 // Note: Taking a list right now. A Trie will be used later to store
53 // prefixes
54 RibTable m_rib;
55};
56
57inline Rib::const_iterator
58Rib::begin() const
59{
60 return m_rib.begin();
61}
62
63inline Rib::const_iterator
64Rib::end() const
65{
66 return m_rib.end();
67}
68
69inline size_t
70Rib::size() const
71{
72 return m_rib.size();
73}
74
75inline size_t
76Rib::empty() const
77{
78 return m_rib.empty();
79}
80
81} // namespace nrd
82} // namespace ndn
83
84#endif // NRD_RIB_HPP