22 #ifndef NDN_CXX_LP_FIELD_DECL_HPP 23 #define NDN_CXX_LP_FIELD_DECL_HPP 28 #include "../encoding/block-helpers.hpp" 29 #include "../util/concepts.hpp" 30 #include <boost/concept/requires.hpp> 35 template<
typename TlvType,
typename T>
43 type.wireDecode(wire);
48 template<
typename TlvType>
58 template<
typename TlvType>
59 struct DecodeHelper<TlvType,
std::pair<Buffer::const_iterator, Buffer::const_iterator>>
61 static std::pair<Buffer::const_iterator, Buffer::const_iterator>
72 template<
typename encoding::Tag TAG,
typename TlvType,
typename T>
77 encode(EncodingImpl<TAG>& encoder, const T&
value)
79 return value.wireEncode(encoder);
83 template<
typename encoding::Tag TAG,
typename TlvType>
93 template<
typename encoding::Tag TAG,
typename TlvType>
94 struct EncodeHelper<TAG, TlvType,
std::pair<Buffer::const_iterator, Buffer::const_iterator>>
97 encode(EncodingImpl<TAG>& encoder,
const std::pair<Buffer::const_iterator, Buffer::const_iterator>&
value)
100 length += encoder.prependRange(value.first, value.second);
101 length += encoder.prependVarNumber(length);
107 template<
typename LOCATION,
typename VALUE, u
int64_t TYPE,
bool REPEATABLE = false>
113 typedef std::integral_constant<uint64_t, TYPE>
TlvType;
134 template<
typename encoding::Tag TAG,
typename T>
145 #endif // NDN_CXX_LP_FIELD_DECL_HPP
Copyright (c) 2011-2015 Regents of the University of California.
static T decode(const Block &wire)
size_t prependNonNegativeIntegerBlock(EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value)
Prepend a TLV element containing a non-negative integer.
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.
uint64_t readNonNegativeInteger(const Block &block)
Read a non-negative integer from a TLV element.
static size_t encode(EncodingImpl< TAG > &encoder, const T &value)
std::integral_constant< uint64_t, TYPE > TlvType
static ValueType decode(const Block &wire)
decodes a field
size_t value_size() const
Get size of TLV-VALUE aka TLV-LENGTH.
uint32_t type() const
Get TLV-TYPE.
static size_t encode(EncodingImpl< TAG > &encoder, const std::pair< Buffer::const_iterator, Buffer::const_iterator > &value)
std::integral_constant< bool, REPEATABLE > IsRepeatable
static std::pair< Buffer::const_iterator, Buffer::const_iterator > decode(const Block &wire)
static size_t encode(EncodingImpl< TAG > &encoder, const T &value)
encodes a field and prepends to encoder its Block with top-level type TYPE
static uint64_t decode(const Block &wire)
static size_t encode(EncodingImpl< TAG > &encoder, const uint64_t value)
std::string to_string(const V &v)
a concept check for TLV abstraction with .wireEncode method
a concept check for TLV abstraction with .wireDecode method and constructible from Block ...
represents an error in TLV encoding or decoding