28 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<MetaInfo>));
32 static_assert(std::is_base_of<tlv::Error, MetaInfo::Error>::value,
33 "MetaInfo::Error must inherit from tlv::Error");
37 , m_freshnessPeriod(-1)
58 m_freshnessPeriod = freshnessPeriod;
66 m_finalBlockId = finalBlockId;
70 const std::list<Block>&
79 for (std::list<Block>::const_iterator i = info.begin(); i != info.end(); ++i) {
80 if (!(128 <= i->type() && i->type() <= 252))
81 BOOST_THROW_EXCEPTION(
Error(
"AppMetaInfo block has type outside the application range " 93 if (!(128 <= block.
type() && block.
type() <= 252))
94 BOOST_THROW_EXCEPTION(
Error(
"AppMetaInfo block has type outside the application range " 98 m_appMetaInfo.push_back(block);
106 iter != m_appMetaInfo.end(); ++iter) {
107 if (iter->type() == tlvType) {
109 m_appMetaInfo.erase(iter);
119 for (std::list<Block>::const_iterator iter = m_appMetaInfo.begin();
120 iter != m_appMetaInfo.end(); ++iter) {
121 if (iter->type() == tlvType) {
128 template<encoding::Tag TAG>
138 size_t totalLength = 0;
140 for (std::list<Block>::const_reverse_iterator appMetaInfoItem = m_appMetaInfo.rbegin();
141 appMetaInfoItem != m_appMetaInfo.rend(); ++appMetaInfoItem) {
142 totalLength += encoder.prependBlock(*appMetaInfoItem);
146 if (!m_finalBlockId.
empty())
152 if (m_freshnessPeriod >= time::milliseconds::zero())
155 m_freshnessPeriod.count());
164 totalLength += encoder.prependVarNumber(totalLength);
187 m_wire = buffer.block();
221 m_freshnessPeriod = time::milliseconds::min();
239 for (; val != m_wire.
elements().end(); ++val) {
240 m_appMetaInfo.push_back(*val);
248 os <<
"ContentType: " << info.
getType();
257 os <<
", FinalBlockId: ";
262 for (std::list<Block>::const_iterator iter = info.
getAppMetaInfo().begin();
264 os <<
", AppMetaInfoTlvType: " << iter->type();
element_const_iterator elements_begin() const
bool hasWire() const
Check if the Block has fully encoded wire.
Copyright (c) 2011-2015 Regents of the University of California.
size_t prependNonNegativeIntegerBlock(EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value)
Helper to prepend TLV block type type containing non-negative integer value.
EncodingImpl< EstimatorTag > EncodingEstimator
std::ostream & operator<<(std::ostream &os, const Data &data)
element_const_iterator elements_end() const
size_t prependNestedBlock(EncodingImpl< TAG > &encoder, uint32_t type, const U &value)
Prepend a TLV block of type type with WireEncodable value as a value.
void parse() const
Parse wire buffer into subblocks.
Class representing a wire element of NDN-TLV packet format.
uint64_t readNonNegativeInteger(const Block &block)
Helper to read a non-negative integer from a block.
Table::const_iterator iterator
a concept check for TLV abstraction with .wireEncode method
EncodingImpl< EncoderTag > EncodingBuffer
void toUri(std::ostream &os) const
Write *this to the output stream, escaping characters according to the NDN URI Scheme.
element_container::const_iterator element_const_iterator
void reset()
Reset wire buffer of the element.
indicates content is the actual data bits
Component holds a read-only name component value.
Block blockFromValue() const
const element_container & elements() const
Get all subelements.
a concept check for TLV abstraction with .wireEncode method
a concept check for TLV abstraction with .wireDecode method and constructible from Block ...