22 #ifndef NDN_CXX_LP_FIELD_DECL_HPP    23 #define NDN_CXX_LP_FIELD_DECL_HPP    32 #include <boost/concept/requires.hpp>    33 #include <boost/endian/conversion.hpp>    40 struct NonNegativeIntegerTag;
    42 template<
typename TlvType, 
typename T>
    50     type.wireDecode(wire);
    55 template<
typename TlvType>
    69 template<
typename TlvType>
    79 template<
typename TlvType>
    87                                 " must contain a 64-bit integer"));
    90     std::memcpy(&n, wire.
value(), 
sizeof(n));
    91     return boost::endian::big_to_native(n);
    95 template<
typename TlvType>
    96 struct DecodeHelper<TlvType, 
std::pair<Buffer::const_iterator, Buffer::const_iterator>>
    98   static std::pair<Buffer::const_iterator, Buffer::const_iterator>
   103                                 " cannot be empty"));
   109 template<
typename encoding::Tag TAG, 
typename TlvType, 
typename T>
   116     return value.wireEncode(encoder);
   120 template<
typename encoding::Tag TAG, 
typename TlvType>
   127     length += encoder.prependVarNumber(0);
   128     length += encoder.prependVarNumber(TlvType::value);
   133 template<
typename encoding::Tag TAG, 
typename TlvType>
   143 template<
typename encoding::Tag TAG, 
typename TlvType>
   149     boost::endian::native_to_big_inplace(value);
   150     return encoder.prependByteArrayBlock(TlvType::value,
   151                                          reinterpret_cast<const uint8_t*>(&value), 
sizeof(value));
   155 template<
typename encoding::Tag TAG, 
typename TlvType>
   156 struct EncodeHelper<TAG, TlvType, 
std::pair<Buffer::const_iterator, Buffer::const_iterator>>
   162     length += encoder.prependRange(value.first, value.second);
   163     length += encoder.prependVarNumber(length);
   164     length += encoder.prependVarNumber(TlvType::value);
   177 template<
typename LOCATION, 
typename VALUE, uint64_t TYPE, 
bool REPEATABLE = 
false,
   178          typename DECODER_TAG = VALUE, 
typename ENCODER_TAG = VALUE>
   184   typedef std::integral_constant<uint64_t, TYPE> 
TlvType;
   195     if (wire.
type() != TlvType::value) {
   206   template<
typename encoding::Tag TAG>
   217 #endif // NDN_CXX_LP_FIELD_DECL_HPP static ValueType decode(const Block &wire)
Decode a field. 
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. 
std::string to_string(const T &val)
std::integral_constant< bool, REPEATABLE > IsRepeatable
static size_t encode(EncodingImpl< TAG > &encoder, uint64_t value)
size_t value_size() const noexcept
Return the 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)
Buffer::const_iterator value_begin() const
Get begin iterator of TLV-VALUE. 
a concept check for TLV abstraction with .wireEncode method 
static size_t encode(EncodingImpl< TAG > &encoder, uint64_t value)
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 ValueType &value)
Encode a field and prepend to encoder. 
static size_t encode(EncodingImpl< TAG > &encoder, const std::pair< Buffer::const_iterator, Buffer::const_iterator > &value)
static std::pair< Buffer::const_iterator, Buffer::const_iterator > decode(const Block &wire)
const uint8_t * value() const noexcept
Return a raw pointer to the beginning of TLV-VALUE. 
static uint64_t decode(const Block &wire)
a concept check for TLV abstraction with .wireDecode method and constructible from Block ...
static uint64_t decode(const Block &wire)
std::integral_constant< uint64_t, TYPE > TlvType
uint32_t type() const
Return the TLV-TYPE of the Block. 
represents an error in TLV encoding or decoding 
static EmptyValue decode(const Block &wire)