25 #include <ndn-cxx/util/concepts.hpp> 26 #include <ndn-cxx/encoding/block-helpers.hpp> 31 BOOST_CONCEPT_ASSERT((ndn::WireEncodable<Destination>));
32 BOOST_CONCEPT_ASSERT((ndn::WireDecodable<Destination>));
33 static_assert(std::is_base_of<ndn::tlv::Error, Destination::Error>::value,
34 "Destination::Error must inherit from tlv::Error");
43 template<ndn::encoding::Tag TAG>
47 size_t totalLength = 0;
49 totalLength += m_name.wireEncode(encoder);
51 totalLength += encoder.prependVarNumber(totalLength);
62 if (m_wire.hasWire()) {
66 ndn::EncodingEstimator estimator;
69 ndn::EncodingBuffer buffer(estimatedSize, 0);
72 m_wire = buffer.block();
85 std::stringstream error;
86 error <<
"Expected Destination Block, but Block is of a different type: #" 88 BOOST_THROW_EXCEPTION(
Error(error.str()));
93 ndn::Block::element_const_iterator val = m_wire.elements_begin();
95 if (val != m_wire.elements_end() && val->type() == ndn::tlv::Name) {
96 m_name.wireDecode(*val);
100 BOOST_THROW_EXCEPTION(
Error(
"Missing required Name field"));
107 os <<
"Destination: " << Destination.
getName();
111 std::shared_ptr<Destination>
114 std::shared_ptr<Destination> desInfo = std::make_shared<Destination>();
Data abstraction for Destination.
const ndn::Block & wireEncode() const
std::shared_ptr< Destination > makeDes(const RoutingTableEntry &rte)
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(AdjacencyLsa)
const ndn::Name & getDestination() const
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
const ndn::Name & getName() const
void wireDecode(const ndn::Block &wire)
std::ostream & operator<<(std::ostream &os, const AdjacencyLsa &adjacencyLsa)