24 #ifndef NDN_ENCODING_BLOCK_HPP 25 #define NDN_ENCODING_BLOCK_HPP 89 bool verifyLength =
true);
99 Block(
const Block& block, Buffer::const_iterator begin, Buffer::const_iterator end,
100 bool verifyLength =
true);
111 Buffer::const_iterator begin, Buffer::const_iterator end,
112 Buffer::const_iterator valueBegin, Buffer::const_iterator valueEnd);
120 Block(
const uint8_t* buf,
size_t bufSize);
126 Block(uint32_t type);
145 fromStream(std::istream& is);
153 static std::tuple<bool, Block>
163 static std::tuple<bool, Block>
164 fromBuffer(
const uint8_t* buf,
size_t bufSize);
175 return m_type == std::numeric_limits<uint32_t>::max();
202 Buffer::const_iterator
208 Buffer::const_iterator
225 shared_ptr<const Buffer>
248 return m_buffer !=
nullptr;
254 Buffer::const_iterator
263 Buffer::const_iterator
280 blockFromValue()
const;
304 get(uint32_t type)
const;
311 find(uint32_t type)
const;
318 remove(uint32_t type);
333 push_back(
const Block& element);
357 return m_elements.begin();
365 return m_elements.end();
373 return m_elements.size();
379 operator boost::asio::const_buffer()
const;
433 return !(lhs == rhs);
438 #endif // NDN_ENCODING_BLOCK_HPP
shared_ptr< const Buffer > m_buffer
underlying buffer storing TLV-VALUE and possibly TLV-TYPE and TLV-LENGTH fields
bool empty() const
Check if the Block is empty.
Copyright (c) 2013-2017 Regents of the University of California.
bool hasValue() const
Get begin iterator of TLV-VALUE.
Error(const std::string &what)
const element_container & elements() const
Get container of sub elements.
Buffer::const_iterator m_valueBegin
Buffer::const_iterator m_begin
element_container::const_iterator element_const_iterator
element_container m_elements
sub elements
Represents a TLV element of NDN packet format.
Buffer::const_iterator value_begin() const
Get begin iterator of TLV-VALUE.
Buffer::const_iterator value_end() const
Get end iterator of TLV-VALUE.
uint32_t m_size
total size including Type-Length-Value
Buffer::const_iterator m_valueEnd
bool operator!=(const Block &lhs, const Block &rhs)
element_container::iterator element_iterator
size_t elements_size() const
Equivalent to elements().size()
uint32_t type() const
Get TLV-TYPE.
static std::tuple< bool, const uint8_t *, size_t, const uint8_t *, size_t > parse(const Data &data)
Buffer::const_iterator m_end
bool operator==(const Data &lhs, const Data &rhs)
shared_ptr< const Buffer > getBuffer() const
Get underlying buffer.
element_const_iterator elements_end() const
Equivalent to elements().end()
element_const_iterator elements_begin() const
Equivalent to elements().begin()
std::vector< Block > element_container
EncodingImpl< EncoderTag > EncodingBuffer
represents an error in TLV encoding or decoding
EncodingImpl< EstimatorTag > EncodingEstimator
shared_ptr< const Buffer > ConstBufferPtr