Data Stream

Defines data stream for reading and writing data in the form of bytes.

Functions

Functions Documentation

function unpack

template<typename T>
T eosio::unpack(
    const char * buffer,
    size_t len
)

Unpack data inside a fixed size buffer as T

Template parameters:

  • T - Type of the unpacked data

Parameters:

  • buffer - Pointer to the buffer
  • len - Length of the buffer

Returns:

T - The unpacked data

function unpack

template<typename T>
void eosio::unpack(
    T & res,
    const char * buffer,
    size_t len
)

Unpack data inside a fixed size buffer as T

Template parameters:

  • T - Type of the unpacked data

Parameters:

  • res - Variable to fill with the unpacking
  • buffer - Pointer to the buffer
  • len - Length of the buffer

Returns:

T - The unpacked data

function unpack

template<typename T>
T eosio::unpack(
    const std::vector< char > & bytes
)

Unpack data inside a variable size buffer as T

Template parameters:

  • T - Type of the unpacked data

Parameters:

  • bytes - Buffer

Returns:

T - The unpacked data

function pack_size

template<typename T>
size_t eosio::pack_size(
    const T & value
)

Get the size of the packed data

Template parameters:

  • T - Type of the data to be packed

Parameters:

  • value - Data to be packed

Returns:

size_t - Size of the packed data

function pack

template<typename T>
std::vector<char> eosio::pack(
    const T & value
)

Get packed data

Template parameters:

  • T - Type of the data to be packed

Parameters:

  • value - Data to be packed

Returns:

bytes - The packed data