24 #include <ndn-cxx/encoding/block-helpers.hpp>
28 template<ndn::encoding::Tag TAG>
32 size_t totalLength = 0;
35 totalLength += ndn::encoding::prependStringBlock(block,
nlsr::tlv::Uri, m_connectingFaceUri);
37 totalLength += block.prependVarNumber(totalLength);
48 if (m_wire.hasWire()) {
52 ndn::EncodingEstimator estimator;
55 ndn::EncodingBuffer buffer(estimatedSize, 0);
58 m_wire = buffer.block();
66 m_connectingFaceUri =
"";
72 NDN_THROW(
Error(
"NextHop", m_wire.type()));
77 auto val = m_wire.elements_begin();
79 if (val != m_wire.elements_end() && val->type() ==
nlsr::tlv::Uri) {
80 m_connectingFaceUri = ndn::encoding::readString(*val);
84 NDN_THROW(
Error(
"Missing required Uri field"));
88 m_routeCost = ndn::encoding::readDouble(*val);
92 NDN_THROW(
Error(
"Missing required CostDouble field"));
Data abstraction for Nexthop.
const ndn::Block & wireEncode() const
void wireDecode(const ndn::Block &wire)
const std::string & getConnectingFaceUri() const
double getRouteCost() const
uint64_t getRouteCostAsAdjustedInteger() const
Copyright (c) 2014-2020, The University of Memphis, Regents of the University of California.
std::ostream & operator<<(std::ostream &os, const Adjacent &adjacent)
bool operator==(const NamePrefixTableEntry &lhs, const NamePrefixTableEntry &rhs)
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(Adjacent)