29 #include <boost/range/adaptor/reversed.hpp> 64 template<encoding::Tag TAG>
68 size_t totalLength = 0;
73 totalLength += block.prependVarNumber(totalLength);
92 m_wire = buffer.block();
136 return os <<
"NextHopRecord(" 162 m_nextHopRecords.push_back(nh);
170 m_nextHopRecords.clear();
175 template<encoding::Tag TAG>
179 size_t totalLength = 0;
181 for (
const auto& nh : m_nextHopRecords | boost::adaptors::reversed) {
182 totalLength += nh.wireEncode(block);
184 totalLength += m_prefix.wireEncode(block);
186 totalLength += block.prependVarNumber(totalLength);
205 m_wire = buffer.block();
226 m_prefix.wireDecode(*val);
229 m_nextHopRecords.clear();
234 m_nextHopRecords.emplace_back(*val);
245 aNextHops.
size() != bNextHops.size())
248 std::vector<bool> matched(bNextHops.size(),
false);
249 return std::all_of(aNextHops.begin(), aNextHops.end(),
251 for (
size_t i = 0; i < bNextHops.size(); ++i) {
252 if (!matched[i] && bNextHops[i] == nh) {
264 os <<
"FibEntry(Prefix: " << entry.
getPrefix() <<
",\n" Copyright (c) 2011-2015 Regents of the University of California.
void wireDecode(const Block &block)
size_t prependNonNegativeIntegerBlock(EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value)
Prepend a TLV element containing a non-negative integer.
NextHopRecord & setFaceId(uint64_t faceId)
FibEntry & setPrefix(const Name &prefix)
const std::vector< NextHopRecord > & getNextHopRecords() const
void parse() const
Parse TLV-VALUE into sub-elements.
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(ChannelStatus)
Represents a TLV element of the NDN packet format.
bool hasWire() const noexcept
Check if the Block contains a fully encoded wire representation.
element_const_iterator elements_begin() const
Equivalent to elements().begin()
uint64_t readNonNegativeInteger(const Block &block)
Read a non-negative integer from a TLV element.
void wireDecode(const Block &block)
element_const_iterator elements_end() const
Equivalent to elements().end()
Copyright (c) 2011-2015 Regents of the University of California.
void reset() noexcept
Reset the Block to a default-constructed state.
Backport of ostream_joiner from the Library Fundamentals v2 TS.
FibEntry & clearNextHopRecords()
bool operator==(const ChannelStatus &a, const ChannelStatus &b)
ostream_joiner< std::decay_t< DelimT >, CharT, Traits > make_ostream_joiner(std::basic_ostream< CharT, Traits > &os, DelimT &&delimiter)
NextHopRecord & setCost(uint64_t cost)
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
Represents an absolute name.
concept check for an item in a Status Dataset
size_t size() const
Returns the number of components.
uint32_t type() const noexcept
Return the TLV-TYPE of the Block.
const Block & wireEncode() const
const Name & getPrefix() const
uint64_t getFaceId() const
EncodingImpl< EncoderTag > EncodingBuffer
const uint64_t INVALID_FACE_ID
const Block & wireEncode() const
EncodingImpl< EstimatorTag > EncodingEstimator
FibEntry & addNextHopRecord(const NextHopRecord &nh)