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 <ndn-cxx/name.hpp>
29 #include <unordered_map>
30 
31 namespace nlsr {
32 
46 class NamePrefixTableEntry;
47 
49 {
50 public:
52  {
53  }
54 
56  {
57  }
58 
59  RoutingTablePoolEntry(const ndn::Name& dest)
60  {
61  m_destination = dest;
62  m_useCount = 1;
63  }
64 
65  RoutingTablePoolEntry(RoutingTableEntry& rte, uint64_t useCount)
66  {
69  m_useCount = useCount;
70  }
71 
72  RoutingTablePoolEntry(const ndn::Name& dest, uint64_t useCount)
73  {
74  m_destination = dest;
75  m_useCount = useCount;
76  }
77 
78  uint64_t
80  {
81  return m_useCount;
82  }
83 
84  uint64_t
86  {
87  return ++m_useCount;
88  }
89 
90  uint64_t
92  {
93  if (m_useCount != 0) {
94  return --m_useCount;
95  }
96  return 0;
97  }
98 
99  void
101  {
102  m_nexthopList = nhl;
103  }
104 
105 public:
106  std::unordered_map<ndn::Name, std::weak_ptr<NamePrefixTableEntry>>
108 
109 private:
110  uint64_t m_useCount;
111 
112 };
113 
114 bool
116 
117 std::ostream&
118 operator<<(std::ostream& os, RoutingTablePoolEntry& rtpe);
119 
120 } // namespace nlsr
121 
122 #endif // NLSR_ROUTING_TABLE_POOL_ENTRY_HPP
Data abstraction for RouteTableInfo.
const ndn::Name & getDestination() const
NexthopList & getNexthopList()
ndn::Name m_destination
NexthopList m_nexthopList
uint64_t incrementUseCount()
RoutingTablePoolEntry(const ndn::Name &dest)
uint64_t getUseCount()
RoutingTablePoolEntry(RoutingTableEntry &rte, uint64_t useCount)
void setNexthopList(NexthopList nhl)
~RoutingTablePoolEntry()
RoutingTablePoolEntry()
std::unordered_map< ndn::Name, std::weak_ptr< NamePrefixTableEntry > > namePrefixTableEntries
uint64_t decrementUseCount()
RoutingTablePoolEntry(const ndn::Name &dest, uint64_t useCount)
Copyright (c) 2014-2020, The University of Memphis, Regents of the University of California,...
std::ostream & operator<<(std::ostream &os, const Adjacent &adjacent)
Definition: adjacent.cpp:179
bool operator==(const NamePrefixTableEntry &lhs, const NamePrefixTableEntry &rhs)