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

using FieldLocation = LOCATION
 
using IsRepeatable = std::bool_constant< REPEATABLE >
 
using TlvType = std::integral_constant< uint32_t, TYPE >
 
using ValueType = VALUE
 

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, uint32_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 173 of file field-decl.hpp.

Member Typedef Documentation

◆ FieldLocation

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

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

◆ IsRepeatable

template<typename LOCATION , typename VALUE , uint32_t TYPE, bool REPEATABLE = false, typename DECODER_TAG = VALUE, typename ENCODER_TAG = VALUE>
using ndn::lp::FieldDecl< LOCATION, VALUE, TYPE, REPEATABLE, DECODER_TAG, ENCODER_TAG >::IsRepeatable = std::bool_constant<REPEATABLE>

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

◆ TlvType

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

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

◆ ValueType

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

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

Member Function Documentation

◆ decode()

template<typename LOCATION , typename VALUE , uint32_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 187 of file field-decl.hpp.

◆ encode()

template<typename LOCATION , typename VALUE , uint32_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 202 of file field-decl.hpp.