routing-table-pool-entry.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NLSR_ROUTING_TABLE_POOL_ENTRY_HPP
23 #define NLSR_ROUTING_TABLE_POOL_ENTRY_HPP
24 
25 #include "routing-table-entry.hpp"
26 #include "nexthop-list.hpp"
27 
28 #include <iostream>
29 #include <ndn-cxx/name.hpp>
30 #include <unordered_map>
31 
32 namespace nlsr {
33 
47 class NamePrefixTableEntry;
48 
50 {
51 public:
53  {
54  }
55 
57  {
58  }
59 
60  RoutingTablePoolEntry(const ndn::Name& dest)
61  {
62  m_destination = dest;
63  m_useCount = 1;
64  }
65 
66  RoutingTablePoolEntry(RoutingTableEntry& rte, uint64_t useCount)
67  {
70  m_useCount = useCount;
71  }
72 
73  RoutingTablePoolEntry(const ndn::Name& dest, uint64_t useCount)
74  {
75  m_destination = dest;
76  m_useCount = useCount;
77  }
78 
79  uint64_t
81  {
82  return m_useCount;
83  }
84 
85  uint64_t
87  {
88  return ++m_useCount;
89  }
90 
91  uint64_t
93  {
94  if (m_useCount != 0) {
95  return --m_useCount;
96  }
97  return 0;
98  }
99 
100  void
102  {
103  m_nexthopList = nhl;
104  }
105 
106 public:
107  std::unordered_map<ndn::Name, std::weak_ptr<NamePrefixTableEntry>>
109 
110 private:
111  uint64_t m_useCount;
112 
113 };
114 
115 bool
117 
118 std::ostream&
119 operator<<(std::ostream& os, RoutingTablePoolEntry& rtpe);
120 
121 } // namespace nlsr
122 
123 #endif // NLSR_ROUTING_TABLE_POOL_ENTRY_HPP
std::ostream & operator<<(std::ostream &os, const Adjacent &adjacent)
Definition: adjacent.cpp:83
RoutingTablePoolEntry(const ndn::Name &dest)
const ndn::Name & getDestination() const
RoutingTablePoolEntry(RoutingTableEntry &rte, uint64_t useCount)
RoutingTablePoolEntry(const ndn::Name &dest, uint64_t useCount)
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
std::unordered_map< ndn::Name, std::weak_ptr< NamePrefixTableEntry > > namePrefixTableEntries
bool operator==(RoutingTableEntry &rhs)