22 #ifndef NDN_CXX_LP_FIELD_DECL_HPP 23 #define NDN_CXX_LP_FIELD_DECL_HPP 29 #include "../encoding/block-helpers.hpp" 30 #include "../util/concepts.hpp" 31 #include <boost/concept/requires.hpp> 36 template<
typename TlvType,
typename T>
44 type.wireDecode(wire);
49 template<
typename TlvType>
64 template<
typename TlvType>
74 template<
typename TlvType>
75 struct DecodeHelper<TlvType,
std::pair<Buffer::const_iterator, Buffer::const_iterator>>
77 static std::pair<Buffer::const_iterator, Buffer::const_iterator>
89 template<
typename encoding::Tag TAG,
typename TlvType,
typename T>
96 return value.wireEncode(encoder);
100 template<
typename encoding::Tag TAG,
typename TlvType>
107 length += encoder.prependVarNumber(0);
108 length += encoder.prependVarNumber(TlvType::value);
113 template<
typename encoding::Tag TAG,
typename TlvType>
123 template<
typename encoding::Tag TAG,
typename TlvType>
124 struct EncodeHelper<TAG, TlvType,
std::pair<Buffer::const_iterator, Buffer::const_iterator>>
130 length += encoder.prependRange(value.first, value.second);
131 length += encoder.prependVarNumber(length);
132 length += encoder.prependVarNumber(TlvType::value);
137 template<
typename LOCATION,
typename VALUE, u
int64_t TYPE,
bool REPEATABLE = false>
143 typedef std::integral_constant<uint64_t, TYPE>
TlvType;
153 if (wire.
type() != TlvType::value) {
164 template<
typename encoding::Tag TAG,
typename T>
175 #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.
size_t value_size() const
Get size of TLV-VALUE aka TLV-LENGTH.
Represents a TLV element of NDN packet format.
static size_t encode(EncodingImpl< TAG > &encoder, const EmptyValue 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
Buffer::const_iterator value_begin() const
Get begin iterator of TLV-VALUE.
a concept check for TLV abstraction with .wireEncode method
static ValueType decode(const Block &wire)
decodes a field
Buffer::const_iterator value_end() const
Get end iterator of TLV-VALUE.
represents a zero-length TLV-VALUE
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 .wireDecode method and constructible from Block ...
uint32_t type() const
Get TLV-TYPE.
represents an error in TLV encoding or decoding
static EmptyValue decode(const Block &wire)