25 #include <ndn-cxx/util/concepts.hpp> 26 #include <ndn-cxx/encoding/block-helpers.hpp> 31 BOOST_CONCEPT_ASSERT((ndn::WireEncodable<RoutingTableStatus>));
32 BOOST_CONCEPT_ASSERT((ndn::WireDecodable<RoutingTableStatus>));
33 static_assert(std::is_base_of<ndn::tlv::Error, RoutingTableStatus::Error>::value,
34 "RoutingTableStatus::Error must inherit from tlv::Error");
37 : m_hasRoutingtable(false)
49 m_routingtables.push_back(routetable);
51 m_hasRoutingtable =
true;
58 m_routingtables.clear();
59 m_hasRoutingtable =
false;
66 return m_hasRoutingtable;
69 template<ndn::encoding::Tag TAG>
73 size_t totalLength = 0;
75 for (std::list<RoutingTable>::const_reverse_iterator it = m_routingtables.rbegin();
76 it != m_routingtables.rend(); ++it) {
77 totalLength += it->wireEncode(block);
80 totalLength += block.prependVarNumber(totalLength);
91 if (m_wire.hasWire()) {
95 ndn::EncodingEstimator estimator;
98 ndn::EncodingBuffer buffer(estimatedSize, 0);
101 m_wire = buffer.block();
109 m_routingtables.clear();
111 m_hasRoutingtable =
false;
116 std::stringstream error;
117 error <<
"Expected RoutingTableStatus Block, but Block is of a different type: #" 119 BOOST_THROW_EXCEPTION(
Error(error.str()));
124 ndn::Block::element_const_iterator val = m_wire.elements_begin();
128 m_hasRoutingtable =
true;
131 if (val != m_wire.elements_end()) {
132 std::stringstream error;
133 error <<
"Expected the end of elements, but Block is of a different type: #" 135 BOOST_THROW_EXCEPTION(
Error(error.str()));
142 os <<
"Routing Table Status: " << std::endl;;
RoutingTableStatus & addRoutingTable(const RoutingTable &routeTable)
const ndn::Block & wireEncode() const
Data abstraction for routing table status.
Data abstraction for RouteTableInfo.
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
RoutingTableStatus & clearRoutingTable()
const std::list< RoutingTable > & getRoutingtable() const
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(Destination)
std::ostream & operator<<(std::ostream &os, const AdjacencyLsa &adjacencyLsa)
void wireDecode(const ndn::Block &wire)