Skip to content

IntegerEncoder

INCLUDE FILE
#include "IntegerEncoder.h"

class IntegerEncoder

Implements an encoder that encodes integer values, taking into account the minimum size and byte order.

DEFINITION
class IntegerEncoder;

enum Type

The value range accepted.

DEFINITION
enum Type;
VALUEDESCRIPTION
SIGNED

Accepts values in the range of two's complement signed integers.

UNSIGNED

Accepts values in the range of unsigned integers.

EITHER

Accepts values in the range of both signed and unsigned integers.

constructor IntegerEncoder

DEFINITION
IntegerEncoder ( Type  type,
std::optional< size_t >  size,
std::optional< uint64_t >  byte_order = {} );
PARAMETERDESCRIPTION
type
size
byte_order

constructor IntegerEncoder

DEFINITION
IntegerEncoder ( const Value & value );
PARAMETERDESCRIPTION
value

method byte_orderconst private

DEFINITION
uint64_t  byte_order ( ) const;
RETURNSDESCRIPTION
uint64_t

method byte_sizeconst

DEFINITION
std::optional< size_t >  byte_size ( ) const;
RETURNSDESCRIPTION
std::optional< size_t >

method default_byte_orderstatic

DEFINITION
static uint64_t  default_byte_order ( );
RETURNSDESCRIPTION
uint64_t

method encodeconst virtual

DEFINITION
virtual void  encode ( std::string & bytes,
const Value & value ) const;
PARAMETERDESCRIPTION
bytes
value

method encoded_sizeconst virtual

DEFINITION
virtual size_t  encoded_size ( const Value & value ) const;
PARAMETERDESCRIPTION
value
RETURNSDESCRIPTION
size_t

method fitsconst virtual

DEFINITION
virtual bool  fits ( const Value & value ) const;
PARAMETERDESCRIPTION
value
RETURNSDESCRIPTION
bool

method is_natural_encoderconst virtual

DEFINITION
virtual bool  is_natural_encoder ( const Value & value ) const;
PARAMETERDESCRIPTION
value
RETURNSDESCRIPTION
bool

method maximum_valueconst

DEFINITION
std::optional< Value >  maximum_value ( ) const;
RETURNSDESCRIPTION
std::optional< Value >

method minimum_valueconst

DEFINITION
std::optional< Value >  minimum_value ( ) const;
RETURNSDESCRIPTION
std::optional< Value >

method operator!=const

DEFINITION
bool  operator!= ( const IntegerEncoder & other ) const;
PARAMETERDESCRIPTION
other
RETURNSDESCRIPTION
bool

method operator==const virtual

DEFINITION
virtual bool  operator== ( const Encoder & other ) const;
PARAMETERDESCRIPTION
other
RETURNSDESCRIPTION
bool

method operator==const

DEFINITION
bool  operator== ( const IntegerEncoder & other ) const;
PARAMETERDESCRIPTION
other
RETURNSDESCRIPTION
bool

method serializeconst virtual

DEFINITION
virtual void  serialize ( std::ostream & stream ) const;
PARAMETERDESCRIPTION
stream

method size_rangeconst virtual

DEFINITION
virtual SizeRange  size_range ( ) const;
RETURNSDESCRIPTION
SizeRange

member big_endian_byte_orderstatic

DEFINITION
static const uint64_t  big_endian_byte_order;

member explicit_byte_orderprivate

DEFINITION
std::optional< uint64_t >  explicit_byte_order;

member little_endian_byte_orderstatic

DEFINITION
static const uint64_t  little_endian_byte_order;

member sizeprivate

DEFINITION
std::optional< size_t >  size;

member typeprivate

DEFINITION
Type  type;