28 #include <boost/range/adaptor/reversed.hpp> 33 BOOST_CONCEPT_ASSERT((StatusDatasetItem<NextHopRecord>));
34 BOOST_CONCEPT_ASSERT((StatusDatasetItem<FibEntry>));
63 template<encoding::Tag TAG>
67 size_t totalLength = 0;
72 totalLength += block.prependVarNumber(totalLength);
91 m_wire = buffer.block();
135 return os <<
"NextHopRecord(" 161 m_nextHopRecords.push_back(nh);
169 m_nextHopRecords.clear();
174 template<encoding::Tag TAG>
178 size_t totalLength = 0;
180 for (
const auto& nh : m_nextHopRecords | boost::adaptors::reversed) {
181 totalLength += nh.wireEncode(block);
183 totalLength += m_prefix.wireEncode(block);
185 totalLength += block.prependVarNumber(totalLength);
204 m_wire = buffer.block();
225 m_prefix.wireDecode(*val);
228 m_nextHopRecords.clear();
233 m_nextHopRecords.emplace_back(*val);
244 aNextHops.
size() != bNextHops.size())
247 std::vector<bool> matched(bNextHops.size(),
false);
248 return std::all_of(aNextHops.begin(), aNextHops.end(),
250 for (
size_t i = 0; i < bNextHops.size(); ++i) {
251 if (!matched[i] && bNextHops[i] == nh) {
263 os <<
"FibEntry(Prefix: " << entry.
getPrefix() <<
",\n"
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)
const Block & wireEncode() const
FibEntry & setPrefix(const Name &prefix)
Represents a TLV element of NDN packet format.
bool hasWire() const noexcept
Check if the Block contains a fully encoded wire representation.
uint64_t readNonNegativeInteger(const Block &block)
Read a non-negative integer from a TLV element.
void wireDecode(const Block &block)
const Block & wireEncode() const
const Name & getPrefix() const
void reset() noexcept
Reset the Block to a default-constructed state.
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)
#define NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(ClassName)
size_t size() const
Get number of components.
NextHopRecord & setCost(uint64_t cost)
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
Represents an absolute name.
void parse() const
Parse TLV-VALUE into sub-elements.
uint32_t type() const
Return the TLV-TYPE of the Block.
const std::vector< NextHopRecord > & getNextHopRecords() const
element_const_iterator elements_end() const
Equivalent to elements().end()
uint64_t getFaceId() const
element_const_iterator elements_begin() const
Equivalent to elements().begin()
EncodingImpl< EncoderTag > EncodingBuffer
const uint64_t INVALID_FACE_ID
EncodingImpl< EstimatorTag > EncodingEstimator
FibEntry & addNextHopRecord(const NextHopRecord &nh)