21 #ifndef NLSR_NEXTHOP_LIST_HPP
22 #define NLSR_NEXTHOP_LIST_HPP
27 #include <ndn-cxx/face.hpp>
28 #include <ndn-cxx/util/ostream-joiner.hpp>
43 template<
typename T = std::less<NextHop>>
59 auto it = std::find_if(m_nexthopList.begin(), m_nexthopList.end(),
60 [&nh] (
const auto& item) {
61 return item.getConnectingFaceUri() == nh.getConnectingFaceUri();
63 if (it == m_nexthopList.end()) {
64 m_nexthopList.insert(nh);
67 m_nexthopList.erase(it);
68 m_nexthopList.insert(nh);
80 auto it = std::find(m_nexthopList.begin(), m_nexthopList.end(), nh);
81 if (it != m_nexthopList.end()) {
82 m_nexthopList.erase(it);
89 return m_nexthopList.size();
95 m_nexthopList.clear();
98 const std::set<NextHop, T>&
101 return m_nexthopList;
105 typedef typename std::set<NextHop, T>::iterator
iterator;
112 return m_nexthopList.begin();
118 return m_nexthopList.end();
124 return m_nexthopList.begin();
130 return m_nexthopList.end();
136 return m_nexthopList.rbegin();
142 return m_nexthopList.rend();
146 std::set<NextHop, T> m_nexthopList;
162 return !(lhs == rhs);
170 std::copy(nhl.
cbegin(), nhl.
cend(), ndn::make_ostream_joiner(os,
"\n "));
Data abstraction for Nexthop.
const ndn::FaceUri & getConnectingFaceUri() const
double getRouteCost() const
std::set< NextHop, T >::iterator iterator
reverse_iterator rbegin() const
void removeNextHop(const NextHop &nh)
Remove a next hop from the Next Hop list.
const_iterator cend() const
const_iterator cbegin() const
void addNextHop(const NextHop &nh)
Adds a next hop to the list.
reverse_iterator rend() const
const std::set< NextHop, T > & getNextHops() const
std::set< NextHop, T >::const_iterator const_iterator
std::set< NextHop, T >::reverse_iterator reverse_iterator
Copyright (c) 2014-2020, The University of Memphis, Regents of the University of California.
bool operator!=(const NexthopListT< T > &lhs, const NexthopListT< T > &rhs)
std::ostream & operator<<(std::ostream &os, const Adjacent &adjacent)
bool operator==(const NamePrefixTableEntry &lhs, const NamePrefixTableEntry &rhs)
bool operator()(const NextHop &lhs, const NextHop &rhs) const