Skip to main content

eosio::fixed_bytes

Module: Core API / Fixed Size Byte Array

More...

#include <fixed_bytes.hpp>

Public Types

Name
typedef uint128_tword_t

Public Functions

Name
constexpr size_tnum_words()
constexpr size_tpadded_bytes()
template <typename FirstWord ,typename... Rest>
fixed_bytes< Size >
make_from_word_sequence(typename std::enable_if< std::is_integral< FirstWord >::value &&std::is_unsigned< FirstWord >::value &&!std::is_same< FirstWord, bool >::value &&sizeof(FirstWord)<=sizeof(word_t) &&all_true<(std::is_same< FirstWord, Rest >::value)... >::value, FirstWord >::type first_word, Rest... rest)
constexprfixed_bytes()
fixed_bytes(const std::array< word_t, num_words()> & arr)
template <typename Word ,size_t NumWords,typename Enable =typename std::enable_if<std::is_integral<Word>::value && std::is_unsigned<Word>::value && !std::is_same<Word, bool>::value && std::less<size_t>{}(sizeof(Word), sizeof(word_t))>::type>
fixed_bytes(const std::array< Word, NumWords > & arr)
template <typename Word ,size_t NumWords,typename Enable =typename std::enable_if<std::is_integral<Word>::value && std::is_unsigned<Word>::value && !std::is_same<Word, bool>::value && std::less<size_t>{}(sizeof(Word), sizeof(word_t))>::type>
fixed_bytes(const Word(&) arr[NumWords])
const auto &get_array() const
autodata()
autosize() const
std::array< uint8_t, Size >extract_as_byte_array() const
voidprint() const

Detailed Description

template <size_t Size>
class eosio::fixed_bytes;

Template Parameters:

Fixed size byte array sorted lexicographically

Public Types Documentation

typedef word_t

typedef uint128_t eosio::fixed_bytes< Size >::word_t;

Public Functions Documentation

function num_words

static inline constexpr size_t num_words()

Get number of words contained in this fixed_bytes object. A word is defined to be 16 bytes in size

function padded_bytes

static inline constexpr size_t padded_bytes()

Get number of padded bytes contained in this fixed_bytes object. Padded bytes are the remaining bytes inside the fixed_bytes object after all the words are allocated

function make_from_word_sequence

template <typename FirstWord ,
typename... Rest>
static inline fixed_bytes< Size > make_from_word_sequence(
typename std::enable_if< std::is_integral< FirstWord >::value &&std::is_unsigned< FirstWord >::value &&!std::is_same< FirstWord, bool >::value &&sizeof(FirstWord)<=sizeof(word_t) &&all_true<(std::is_same< FirstWord, Rest >::value)... >::value, FirstWord >::type first_word,
Rest... rest
)

Parameters:

  • first_word - The first word in the sequence
  • rest - The remaining words in the sequence

Template Parameters:

  • FirstWord - The type of the first word in the sequence
  • Rest - The type of the remaining words in the sequence

Create a new fixed_bytes object from a sequence of words

function fixed_bytes

inline constexpr fixed_bytes()

Default constructor to fixed_bytes object which initializes all bytes to zero

function fixed_bytes

inline fixed_bytes(
const std::array< word_t, num_words()> & arr
)

Parameters:

  • arr data

Constructor to fixed_bytes object from std::array of num_words() word_t types

function fixed_bytes

template <typename Word ,
size_t NumWords,
typename Enable =typename std::enable_if<std::is_integral`<Word>`::value && std::is_unsigned`<Word>`::value && !std::is_same<Word, bool>::value && std::less<size_t>{}(sizeof(Word), sizeof(word_t))>::type>
inline fixed_bytes(
const std::array< Word, NumWords > & arr
)

Parameters:

  • arr - Source data

Constructor to fixed_bytes object from std::array of Word types smaller in size than word_t

function fixed_bytes

template <typename Word ,
size_t NumWords,
typename Enable =typename std::enable_if<std::is_integral`<Word>`::value && std::is_unsigned`<Word>`::value && !std::is_same<Word, bool>::value && std::less<size_t>{}(sizeof(Word), sizeof(word_t))>::type>
inline fixed_bytes(
const Word(&) arr[NumWords]
)

Parameters:

  • arr - Source data

Constructor to fixed_bytes object from fixed-sized C array of Word types smaller in size than word_t

function get_array

inline const auto & get_array() const

Get the contained std::array

function data

inline auto data()

Get the underlying data of the contained std::array

function size

inline auto size() const

Get the size of the contained std::array

function extract_as_byte_array

inline std::array< uint8_t, Size > extract_as_byte_array() const

Return: - the extracted data as array of bytes

Extract the contained data as an array of bytes

function print

inline void print() const

Parameters:

  • val to be printed

Prints fixed_bytes as a hexidecimal string


Updated on 2022-12-05 at 15:38:08 +0000