ndn::encoding::Estimator Class Reference

Helper class to estimate size of TLV encoding. More...

#include <ndn-cxx/encoding/estimator.hpp>

+ Inheritance diagram for ndn::encoding::Estimator:
+ Collaboration diagram for ndn::encoding::Estimator:

Public Member Functions

size_t appendBlock (const Block &block) const
 Append TLV block block. More...
 
constexpr size_t appendByte (uint8_t) const noexcept
 Append a single byte. More...
 
constexpr size_t appendByteArray (const uint8_t *, size_t length) const noexcept
 Append a byte array array of length length. More...
 
constexpr size_t appendByteArrayBlock (uint32_t type, const uint8_t *array, size_t arraySize) const noexcept
 Append TLV block of type type and value from buffer array of size arraySize. More...
 
constexpr size_t appendBytes (span< const uint8_t > bytes) const noexcept
 Append a sequence of bytes. More...
 
constexpr size_t appendNonNegativeInteger (uint64_t n) const noexcept
 Append n in NonNegativeInteger encoding. More...
 
template<class Iterator >
constexpr size_t appendRange (Iterator first, Iterator last) const noexcept
 Append bytes from the range [first, last) More...
 
constexpr size_t appendVarNumber (uint64_t n) const noexcept
 Append n in VarNumber encoding. More...
 
size_t prependBlock (const Block &block) const
 Prepend TLV block block. More...
 
constexpr size_t prependByte (uint8_t) const noexcept
 Prepend a single byte. More...
 
constexpr size_t prependByteArray (const uint8_t *, size_t length) const noexcept
 Prepend a byte array array of length length. More...
 
constexpr size_t prependByteArrayBlock (uint32_t type, const uint8_t *array, size_t arraySize) const noexcept
 Prepend TLV block of type type and value from buffer array of size arraySize. More...
 
constexpr size_t prependBytes (span< const uint8_t > bytes) const noexcept
 Prepend a sequence of bytes. More...
 
constexpr size_t prependNonNegativeInteger (uint64_t n) const noexcept
 Prepend n in NonNegativeInteger encoding. More...
 
template<class Iterator >
constexpr size_t prependRange (Iterator first, Iterator last) const noexcept
 Prepend bytes from the range [first, last) More...
 
constexpr size_t prependVarNumber (uint64_t n) const noexcept
 Prepend n in VarNumber encoding. More...
 

Detailed Description

Helper class to estimate size of TLV encoding.

The interface of this class (mostly) matches that of the Encoder class.

See also
Encoder

Definition at line 37 of file estimator.hpp.

Member Function Documentation

◆ appendBlock()

size_t ndn::encoding::Estimator::appendBlock ( const Block block) const

Append TLV block block.

Deprecated:

Definition at line 41 of file estimator.cpp.

◆ appendByte()

constexpr size_t ndn::encoding::Estimator::appendByte ( uint8_t  ) const
inlineconstexprnoexcept

Append a single byte.

Deprecated:

Definition at line 75 of file estimator.hpp.

◆ appendByteArray()

constexpr size_t ndn::encoding::Estimator::appendByteArray ( const uint8_t *  ,
size_t  length 
) const
inlineconstexprnoexcept

Append a byte array array of length length.

Deprecated:

Definition at line 97 of file estimator.hpp.

◆ appendByteArrayBlock()

constexpr size_t ndn::encoding::Estimator::appendByteArrayBlock ( uint32_t  type,
const uint8_t *  array,
size_t  arraySize 
) const
inlineconstexprnoexcept

Append TLV block of type type and value from buffer array of size arraySize.

Deprecated:

Definition at line 175 of file estimator.hpp.

◆ appendBytes()

constexpr size_t ndn::encoding::Estimator::appendBytes ( span< const uint8_t >  bytes) const
inlineconstexprnoexcept

Append a sequence of bytes.

Definition at line 53 of file estimator.hpp.

◆ appendNonNegativeInteger()

constexpr size_t ndn::encoding::Estimator::appendNonNegativeInteger ( uint64_t  n) const
inlineconstexprnoexcept

Append n in NonNegativeInteger encoding.

Definition at line 153 of file estimator.hpp.

◆ appendRange()

template<class Iterator >
constexpr size_t ndn::encoding::Estimator::appendRange ( Iterator  first,
Iterator  last 
) const
inlineconstexprnoexcept

Append bytes from the range [first, last)

Definition at line 117 of file estimator.hpp.

◆ appendVarNumber()

constexpr size_t ndn::encoding::Estimator::appendVarNumber ( uint64_t  n) const
inlineconstexprnoexcept

Append n in VarNumber encoding.

Definition at line 135 of file estimator.hpp.

◆ prependBlock()

size_t ndn::encoding::Estimator::prependBlock ( const Block block) const

Prepend TLV block block.

Deprecated:

Definition at line 30 of file estimator.cpp.

◆ prependByte()

constexpr size_t ndn::encoding::Estimator::prependByte ( uint8_t  ) const
inlineconstexprnoexcept

Prepend a single byte.

Deprecated:

Definition at line 64 of file estimator.hpp.

◆ prependByteArray()

constexpr size_t ndn::encoding::Estimator::prependByteArray ( const uint8_t *  ,
size_t  length 
) const
inlineconstexprnoexcept

Prepend a byte array array of length length.

Deprecated:

Definition at line 86 of file estimator.hpp.

◆ prependByteArrayBlock()

constexpr size_t ndn::encoding::Estimator::prependByteArrayBlock ( uint32_t  type,
const uint8_t *  array,
size_t  arraySize 
) const
inlineconstexprnoexcept

Prepend TLV block of type type and value from buffer array of size arraySize.

Deprecated:

Definition at line 164 of file estimator.hpp.

◆ prependBytes()

constexpr size_t ndn::encoding::Estimator::prependBytes ( span< const uint8_t >  bytes) const
inlineconstexprnoexcept

Prepend a sequence of bytes.

Definition at line 44 of file estimator.hpp.

◆ prependNonNegativeInteger()

constexpr size_t ndn::encoding::Estimator::prependNonNegativeInteger ( uint64_t  n) const
inlineconstexprnoexcept

Prepend n in NonNegativeInteger encoding.

Definition at line 144 of file estimator.hpp.

◆ prependRange()

template<class Iterator >
constexpr size_t ndn::encoding::Estimator::prependRange ( Iterator  first,
Iterator  last 
) const
inlineconstexprnoexcept

Prepend bytes from the range [first, last)

Definition at line 107 of file estimator.hpp.

◆ prependVarNumber()

constexpr size_t ndn::encoding::Estimator::prependVarNumber ( uint64_t  n) const
inlineconstexprnoexcept

Prepend n in VarNumber encoding.

Definition at line 126 of file estimator.hpp.