21 #ifndef NLSR_ROUTE_NEXTHOP_HPP
22 #define NLSR_ROUTE_NEXTHOP_HPP
26 #include <ndn-cxx/encoding/block.hpp>
27 #include <ndn-cxx/encoding/encoding-buffer.hpp>
28 #include <ndn-cxx/encoding/tlv.hpp>
29 #include <ndn-cxx/net/face-uri.hpp>
31 #include <boost/operators.hpp>
46 class NextHop :
private boost::totally_ordered<NextHop>
53 NextHop(
const ndn::FaceUri& cfu,
double rc)
54 : m_connectingFaceUri(cfu)
68 return m_connectingFaceUri;
74 m_connectingFaceUri = cfu;
84 return static_cast<uint64_t
>(round(m_routeCost*HYPERBOLIC_COST_ADJUSTMENT_FACTOR));
87 return static_cast<uint64_t
>(m_routeCost);
112 return m_isHyperbolic;
115 template<ndn::encoding::Tag TAG>
117 wireEncode(ndn::EncodingImpl<TAG>& block)
const;
145 ndn::FaceUri m_connectingFaceUri;
146 double m_routeCost = 0.0;
147 bool m_isHyperbolic =
false;
149 mutable ndn::Block m_wire;
162 static constexpr uint64_t HYPERBOLIC_COST_ADJUSTMENT_FACTOR = 1000;
Data abstraction for Nexthop.
friend bool operator==(const NextHop &lhs, const NextHop &rhs)
void setRouteCost(const double rc)
friend bool operator<(const NextHop &lhs, const NextHop &rhs)
const ndn::Block & wireEncode() const
void setConnectingFaceUri(const ndn::FaceUri &cfu)
const ndn::FaceUri & getConnectingFaceUri() const
void wireDecode(const ndn::Block &wire)
double getRouteCost() const
void setHyperbolic(bool b)
NextHop(const ndn::FaceUri &cfu, double rc)
uint64_t getRouteCostAsAdjustedInteger() const
bool isHyperbolic() const
NextHop(const ndn::Block &block)
Copyright (c) 2014-2020, The University of Memphis, Regents of the University of California.
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(Adjacent)
std::ostream & operator<<(std::ostream &os, const Adjacent &adjacent)
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE