22 #include <ndn-cxx/util/ostream-joiner.hpp> 34 m_content.emplace_back(prefix);
40 if (m_wire.hasWire()) {
44 ndn::EncodingEstimator estimator;
47 ndn::EncodingBuffer buffer(estimatedSize, 0);
50 m_wire = buffer.block();
54 template<ndn::encoding::Tag TAG>
58 size_t totalLength = 0;
60 for (std::vector<ndn::Name>::const_reverse_iterator it = m_content.rbegin();
61 it != m_content.rend(); ++it) {
62 totalLength += it->wireEncode(block);
65 totalLength += block.prependVarNumber(totalLength);
76 auto blockType = wire.type();
78 BOOST_THROW_EXCEPTION(ndn::tlv::Error(
"Expected PSyncContent Block, but Block is of type: #" +
79 ndn::to_string(blockType)));
85 for (
auto it = m_wire.elements_begin(); it != m_wire.elements_end(); ++it) {
86 if (it->type() == ndn::tlv::Name) {
87 m_content.emplace_back(*it);
90 BOOST_THROW_EXCEPTION(ndn::tlv::Error(
"Expected Name Block, but Block is of type: #" +
91 ndn::to_string(it->type())));
102 std::copy(content.begin(), content.end(), ndn::make_ostream_joiner(os,
", "));
void addContent(const ndn::Name &prefix)
const ndn::Block & wireEncode() const
const std::vector< ndn::Name > & getContent() const
std::ostream & operator<<(std::ostream &out, const BloomFilter &bf)
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(State)
void wireDecode(const ndn::Block &wire)