struct signed_int

Class List > signed_int

Public Attributes

Type Name
int32_t value

Public Functions

Type Name
signed_int (int32_t v = 0)
operator int32_t () const
signed_int & operator= (const T & v)
signed_int operator++ (int)
signed_int & operator++ ()

Friends

Type Name
friend bool operator==
friend bool operator==
friend bool operator==
friend bool operator!=
friend bool operator!=
friend bool operator!=
friend bool operator<
friend bool operator<
friend bool operator<
friend bool operator>=
friend bool operator>=
friend bool operator>=
friend DataStream & operator<<
friend DataStream & operator>>

Detailed Description

Variable Length Signed Integer. This provides more efficient serialization of 32-bit signed int. It serializes a 32-bit signed integer in as few bytes as possible.

Note:

`varint32' is signed and uses Zig-Zag encoding

Public Attributes Documentation

variable value

int32_t signed_int::value;

Contained value

Public Functions Documentation

function signed_int

signed_int::signed_int(
    int32_t v = 0
)

Construct a new signed int object

Parameters:

  • v - Source

function operator int32_t

signed_int::operator int32_t() const

Convert signed_int to primitive 32-bit signed integer

Returns:

int32_t - The converted result

function operator=

template<typename T>
signed_int& signed_int::operator=(
    const T & v
)

Assign an object that is convertible to int32_t

Template parameters:

  • T - Type of the assignment object

Parameters:

  • v - Source

Returns:

unsigned_int& - Reference to this object

function operator++ (1/2)

signed_int signed_int::operator++(
    int 
)

Increment operator

Returns:

signed_int - New signed_int with value incremented from the current object's value

function operator++ (2/2)

signed_int& signed_int::operator++()

Increment operator

Returns:

signed_int - Reference to current object

Friends Documentation

friend operator== (1/3)

bool operator==(
    const signed_int & i,
    const int32_t & v
)

Check equality between a signed_int object and 32-bit integer

Parameters:

  • i - signed_int object to compare
  • v - 32-bit integer to compare

Returns:

true - if equal

Returns:

false - otherwise

friend operator== (2/3)

bool operator==(
    const int32_t & i,
    const signed_int & v
)

Check equality between 32-bit integer and a signed_int object

Parameters:

  • i - 32-bit integer to compare
  • v - signed_int object to compare

Returns:

true - if equal

Returns:

false - otherwise

friend operator== (3/3)

bool operator==(
    const signed_int & i,
    const signed_int & v
)

Check equality between two signed_int objects

Parameters:

Returns:

true - if equal

Returns:

false - otherwise

friend operator!= (1/3)

bool operator!=(
    const signed_int & i,
    const int32_t & v
)

Check inequality between a signed_int object and 32-bit integer

Parameters:

  • i - signed_int object to compare
  • v - 32-bit integer to compare

Returns:

true - if inequal

Returns:

false - otherwise

friend operator!= (2/3)

bool operator!=(
    const int32_t & i,
    const signed_int & v
)

Check inequality between 32-bit integer and a signed_int object

Parameters:

  • i - 32-bit integer to compare
  • v - signed_int object to compare

Returns:

true - if unequal

Returns:

false - otherwise

friend operator!= (3/3)

bool operator!=(
    const signed_int & i,
    const signed_int & v
)

Check inequality between two signed_int objects

Parameters:

Returns:

true - if inequal

Returns:

false - otherwise

friend operator< (1/3)

bool operator<(
    const signed_int & i,
    const int32_t & v
)

Check if the given signed_int object is less than the given 32-bit integer

Parameters:

  • i - signed_int object to compare
  • v - 32-bit integer to compare

Returns:

true - if i less than v

Returns:

false - otherwise

friend operator< (2/3)

bool operator<(
    const int32_t & i,
    const signed_int & v
)

Check if the given 32-bit integer is less than the given signed_int object

Parameters:

  • i - 32-bit integer to compare
  • v - signed_int object to compare

Returns:

true - if i less than v

Returns:

false - otherwise

friend operator< (3/3)

bool operator<(
    const signed_int & i,
    const signed_int & v
)

Check if the first given signed_int is less than the second given signed_int object

Parameters:

Returns:

true - if i less than v

Returns:

false - otherwise

friend operator>= (1/3)

bool operator>=(
    const signed_int & i,
    const int32_t & v
)

Check if the given signed_int object is greater or equal to the given 32-bit integer

Parameters:

  • i - signed_int object to compare
  • v - 32-bit integer to compare

Returns:

true - if i is greater or equal to v

Returns:

false - otherwise

friend operator>= (2/3)

bool operator>=(
    const int32_t & i,
    const signed_int & v
)

Check if the given 32-bit integer is greater or equal to the given signed_int object

Parameters:

  • i - 32-bit integer to compare
  • v - signed_int object to compare

Returns:

true - if i is greater or equal to v

Returns:

false - otherwise

friend operator>= (3/3)

bool operator>=(
    const signed_int & i,
    const signed_int & v
)

Check if the first given signed_int is greater or equal to the second given signed_int object

Parameters:

Returns:

true - if i is greater or equal to v

Returns:

false - otherwise

friend operator<<

template<typename DataStream>
DataStream& operator<<(
    DataStream & ds,
    const signed_int & v
)

Serialize an signed_int object with as few bytes as possible

Parameters:

  • ds - The stream to write
  • v - The value to serialize

Template parameters:

  • DataStream - Type of datastream

Returns:

DataStream& - Reference to the datastream

friend operator>>

template<typename DataStream>
DataStream& operator>>(
    DataStream & ds,
    signed_int & vi
)

Deserialize an signed_int object

Parameters:

  • ds - The stream to read
  • vi - The destination for deserialized value

Template parameters:

  • DataStream - Type of datastream

Returns:

DataStream& - Reference to the datastream


The documentation for this class was generated from the following file: libraries/eosiolib/varint.hpp