22 #include <ndn-cxx/util/exception.hpp>
23 #include <ndn-cxx/util/ostream-joiner.hpp>
36 m_content.emplace_back(prefix);
42 if (m_wire.hasWire()) {
46 ndn::EncodingEstimator estimator;
49 ndn::EncodingBuffer buffer(estimatedSize, 0);
52 m_wire = buffer.block();
56 template<ndn::encoding::Tag TAG>
60 size_t totalLength = 0;
62 for (
auto it = m_content.rbegin(); it != m_content.rend(); ++it) {
63 totalLength += it->wireEncode(block);
66 totalLength += block.prependVarNumber(totalLength);
78 NDN_THROW(ndn::tlv::Error(
"PSyncContent", wire.type()));
86 for (
auto it = m_wire.elements_begin(); it != m_wire.elements_end(); ++it) {
87 if (it->type() == ndn::tlv::Name) {
88 m_content.emplace_back(*it);
91 NDN_THROW(ndn::tlv::Error(
"Name", it->type()));
102 std::copy(content.begin(), content.end(), ndn::make_ostream_joiner(os,
", "));
const std::vector< ndn::Name > & getContent() const
void wireDecode(const ndn::Block &wire)
void addContent(const ndn::Name &prefix)
const ndn::Block & wireEncode() const
std::ostream & operator<<(std::ostream &os, const IBLT &iblt)
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(State)