nexthop-list.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
21 #ifndef NLSR_NEXTHOP_LIST_HPP
22 #define NLSR_NEXTHOP_LIST_HPP
23 
24 #include "nexthop.hpp"
25 #include "adjacent.hpp"
26 
27 #include <set>
28 #include <iostream>
29 #include <boost/cstdint.hpp>
30 #include <ndn-cxx/face.hpp>
31 
32 namespace nlsr {
33 
35  bool
36  operator() (const NextHop& nh1, const NextHop& nh2) const {
38  return true;
39  }
41  return nh1.getConnectingFaceUri() < nh2.getConnectingFaceUri();
42  }
43  else {
44  return false;
45  }
46  }
47 };
48 
50 {
51 public:
53  {
54  }
55 
57  {
58  }
59 
67  void
68  addNextHop(const NextHop& nh);
69 
75  void
76  removeNextHop(const NextHop& nh);
77 
78  size_t
79  size() const
80  {
81  return m_nexthopList.size();
82  }
83 
84  void
86  {
87  m_nexthopList.clear();
88  }
89 
90  const std::set<NextHop, NextHopComparator>&
91  getNextHops() const
92  {
93  return m_nexthopList;
94  }
95 
96  typedef std::set<NextHop, NextHopComparator>::iterator iterator;
97  typedef std::set<NextHop, NextHopComparator>::const_iterator const_iterator;
98 
99  iterator
101  {
102  return m_nexthopList.begin();
103  }
104 
105  iterator
106  end()
107  {
108  return m_nexthopList.end();
109  }
110 
111  const_iterator
112  cbegin() const
113  {
114  return m_nexthopList.begin();
115  }
116 
117  const_iterator
118  cend() const
119  {
120  return m_nexthopList.end();
121  }
122 
123  void
124  writeLog();
125 
126 private:
127  std::set<NextHop, NextHopComparator> m_nexthopList;
128 };
129 
130 bool
132 
133 bool
134 operator==(const NexthopList& lhs, const NexthopList& rhs);
135 
136 bool
137 operator!=(const NexthopList& lhs, const NexthopList& rhs);
138 
139 std::ostream&
140 operator<<(std::ostream& os, const NexthopList& nhl);
141 
142 } // namespace nlsr
143 
144 #endif // NLSR_NEXTHOP_LIST_HPP
bool operator()(const NextHop &nh1, const NextHop &nh2) const
const std::set< NextHop, NextHopComparator > & getNextHops() const
std::ostream & operator<<(std::ostream &os, const Adjacent &adjacent)
Definition: adjacent.cpp:83
bool operator==(const NamePrefixTableEntry &lhs, const NamePrefixTableEntry &rhs)
size_t size() const
const_iterator cend() const
const_iterator cbegin() const
bool operator!=(const NexthopList &lhs, const NexthopList &rhs)
const std::string & getConnectingFaceUri() const
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
uint64_t getRouteCostAsAdjustedInteger() const
std::set< NextHop, NextHopComparator >::iterator iterator
std::set< NextHop, NextHopComparator >::const_iterator const_iterator