ndn::lp::FieldDecl< LOCATION, VALUE, TYPE, REPEATABLE, DECODER_TAG, ENCODER_TAG > Class Template Reference

Declare a field. More...

#include <ndn-cxx/lp/field-decl.hpp>

Public Types

typedef LOCATION FieldLocation
 
typedef std::integral_constant< bool, REPEATABLE > IsRepeatable
 
typedef std::integral_constant< uint64_t, TYPE > TlvType
 
typedef VALUE ValueType
 

Static Public Member Functions

static ValueType decode (const Block &wire)
 Decode a field. More...
 
template<typename encoding::Tag TAG>
static size_t encode (EncodingImpl< TAG > &encoder, const ValueType &value)
 Encode a field and prepend to encoder. More...
 

Detailed Description

template<typename LOCATION, typename VALUE, uint64_t TYPE, bool REPEATABLE = false, typename DECODER_TAG = VALUE, typename ENCODER_TAG = VALUE>
class ndn::lp::FieldDecl< LOCATION, VALUE, TYPE, REPEATABLE, DECODER_TAG, ENCODER_TAG >

Declare a field.

Template Parameters
LOCATIONa tag that indicates where the field is in an LpPacket.
VALUEtype of field value.
TYPETLV-TYPE number of the field.
REPEATABLEwhether the field is repeatable.
DECODER_TAGselects a specialization of DecodeHelper.
ENCODER_TAGselects a specialization of EncodeHelper.

Definition at line 176 of file field-decl.hpp.

Member Typedef Documentation

◆ FieldLocation

template<typename LOCATION , typename VALUE , uint64_t TYPE, bool REPEATABLE = false, typename DECODER_TAG = VALUE, typename ENCODER_TAG = VALUE>
typedef LOCATION ndn::lp::FieldDecl< LOCATION, VALUE, TYPE, REPEATABLE, DECODER_TAG, ENCODER_TAG >::FieldLocation

Definition at line 179 of file field-decl.hpp.

◆ IsRepeatable

template<typename LOCATION , typename VALUE , uint64_t TYPE, bool REPEATABLE = false, typename DECODER_TAG = VALUE, typename ENCODER_TAG = VALUE>
typedef std::integral_constant<bool, REPEATABLE> ndn::lp::FieldDecl< LOCATION, VALUE, TYPE, REPEATABLE, DECODER_TAG, ENCODER_TAG >::IsRepeatable

Definition at line 182 of file field-decl.hpp.

◆ TlvType

template<typename LOCATION , typename VALUE , uint64_t TYPE, bool REPEATABLE = false, typename DECODER_TAG = VALUE, typename ENCODER_TAG = VALUE>
typedef std::integral_constant<uint64_t, TYPE> ndn::lp::FieldDecl< LOCATION, VALUE, TYPE, REPEATABLE, DECODER_TAG, ENCODER_TAG >::TlvType

Definition at line 181 of file field-decl.hpp.

◆ ValueType

template<typename LOCATION , typename VALUE , uint64_t TYPE, bool REPEATABLE = false, typename DECODER_TAG = VALUE, typename ENCODER_TAG = VALUE>
typedef VALUE ndn::lp::FieldDecl< LOCATION, VALUE, TYPE, REPEATABLE, DECODER_TAG, ENCODER_TAG >::ValueType

Definition at line 180 of file field-decl.hpp.

Member Function Documentation

◆ decode()

template<typename LOCATION , typename VALUE , uint64_t TYPE, bool REPEATABLE = false, typename DECODER_TAG = VALUE, typename ENCODER_TAG = VALUE>
static ValueType ndn::lp::FieldDecl< LOCATION, VALUE, TYPE, REPEATABLE, DECODER_TAG, ENCODER_TAG >::decode ( const Block wire)
inlinestatic

Decode a field.

Parameters
wirean element with top-level TLV-TYPE TlvType::value.
Returns
value of the field.
Exceptions
ndn::tlv::Errordecode failure.

Definition at line 190 of file field-decl.hpp.

◆ encode()

template<typename LOCATION , typename VALUE , uint64_t TYPE, bool REPEATABLE = false, typename DECODER_TAG = VALUE, typename ENCODER_TAG = VALUE>
template<typename encoding::Tag TAG>
static size_t ndn::lp::FieldDecl< LOCATION, VALUE, TYPE, REPEATABLE, DECODER_TAG, ENCODER_TAG >::encode ( EncodingImpl< TAG > &  encoder,
const ValueType value 
)
inlinestatic

Encode a field and prepend to encoder.

Parameters
encodera buffer encoder or estimator.
valuevalue of the field.

Definition at line 205 of file field-decl.hpp.