22 #include <ndn-cxx/util/exception.hpp> 23 #include <ndn-cxx/util/ostream-joiner.hpp> 37 m_content.emplace_back(prefix);
43 if (m_wire.hasWire()) {
47 ndn::EncodingEstimator estimator;
50 ndn::EncodingBuffer buffer(estimatedSize, 0);
53 m_wire = buffer.block();
57 template<ndn::encoding::Tag TAG>
61 size_t totalLength = 0;
63 for (
auto it = m_content.rbegin(); it != m_content.rend(); ++it) {
64 totalLength += it->wireEncode(block);
67 totalLength += block.prependVarNumber(totalLength);
79 NDN_THROW(ndn::tlv::Error(
"Expected PSyncContent element, but TLV has type " +
80 ndn::to_string(wire.type())));
88 for (
auto it = m_wire.elements_begin(); it != m_wire.elements_end(); ++it) {
89 if (it->type() == ndn::tlv::Name) {
90 m_content.emplace_back(*it);
93 NDN_THROW(ndn::tlv::Error(
"Expected Name element, but TLV has type " +
94 ndn::to_string(it->type())));
105 std::copy(content.begin(), content.end(), ndn::make_ostream_joiner(os,
", "));
std::ostream & operator<<(std::ostream &os, const IBLT &iblt)
const ndn::Block & wireEncode() const
void addContent(const ndn::Name &prefix)
void wireDecode(const ndn::Block &wire)
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(State)
const std::vector< ndn::Name > & getContent() const