Defines data stream for reading and writing data in the form of bytes.
Classes
Type | Name |
---|---|
class | eosio::datastream A data stream for reading and writing data in the form of bytes. |
class | eosio::datastream< size_t > Specialization of datastream used to help determine the final size of a serialized value. Specialization of datastream used to help determine the final size of a serialized value. |
Functions
Functions Documentation
function operator<<
template<typename Stream, typename T>
datastream<Stream>& eosio::operator<<(
datastream< Stream > & ds,
const eosio::binary_extension< T > & be
)
Serialize a binary_extension.
Serialize a binary_extension into a stream
Parameters:
- ds - The stream to write
- opt - The value to serialize
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator>>
template<typename Stream, typename T>
datastream<Stream>& eosio::operator>>(
datastream< Stream > & ds,
eosio::binary_extension< T > & be
)
Deserialize a binary_extension.
Deserialize a binary_extension from a stream
Parameters:
- ds - The stream to read
- opt - The destination for deserialized value
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator<<
template<typename Stream, typename... Ts>
datastream<Stream>& eosio::operator<<(
datastream< Stream > & ds,
const std::variant< Ts... > & var
)
Serialize an std::variant.
Serialize an std::variant into a stream
Parameters:
- ds - The stream to write
- opt - The value to serialize
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function deserialize
template<int I, typename Stream, typename... Ts>
void eosio::deserialize(
datastream< Stream > & ds,
std::variant< Ts... > & var,
int i
)
function operator>>
template<typename Stream, typename... Ts>
datastream<Stream>& eosio::operator>>(
datastream< Stream > & ds,
std::variant< Ts... > & var
)
Deserialize an std::variant.
Deserialize an std::variant from a stream
Parameters:
- ds - The stream to read
- opt - The destination for deserialized value
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator<<
template<typename DataStream, typename T1, typename T2>
DataStream& eosio::operator<<(
DataStream & ds,
const std::pair< T1, T2 > & t
)
Serialize an std::pair.
Serialize an std::pair
Parameters:
- ds - The stream to write
- t - The value to serialize
Template parameters:
- DataStream - Type of datastream
- Args - Type of the objects contained in the tuple
Returns:
DataStream& - Reference to the datastream
function operator>>
template<typename DataStream, typename T1, typename T2>
DataStream& eosio::operator>>(
DataStream & ds,
std::pair< T1, T2 > & t
)
Deserialize an std::pair.
Deserialize an std::pair
Parameters:
- ds - The stream to read
- t - The destination for deserialized value
Template parameters:
- DataStream - Type of datastream
- Args - Type of the objects contained in the tuple
Returns:
DataStream& - Reference to the datastream
function operator<<
template<typename Stream, typename T>
datastream<Stream>& eosio::operator<<(
datastream< Stream > & ds,
const std::optional< T > & opt
)
Serialize an optional.
Serialize an optional into a stream
Parameters:
- ds - The stream to write
- opt - The value to serialize
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator>>
template<typename Stream, typename T>
datastream<Stream>& eosio::operator>>(
datastream< Stream > & ds,
std::optional< T > & opt
)
Deserialize an optional.
Deserialize an optional from a stream
Parameters:
- ds - The stream to read
- opt - The destination for deserialized value
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator<<
template<typename Stream>
datastream<Stream>& eosio::operator<<(
datastream< Stream > & ds,
const eosio::symbol_code sym_code
)
Serialize a symbol_code.
Serialize a symbol_code into a stream
Parameters:
- ds - The stream to write
- sym - The value to serialize
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator>>
template<typename Stream>
datastream<Stream>& eosio::operator>>(
datastream< Stream > & ds,
eosio::symbol_code & sym_code
)
Deserialize a symbol_code.
Deserialize a symbol_code from a stream
Parameters:
- ds - The stream to read
- symbol - The destination for deserialized value
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator<<
template<typename Stream>
datastream<Stream>& eosio::operator<<(
datastream< Stream > & ds,
const eosio::symbol sym
)
Serialize a symbol.
Serialize a symbol into a stream
Parameters:
- ds - The stream to write
- sym - The value to serialize
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator>>
template<typename Stream>
datastream<Stream>& eosio::operator>>(
datastream< Stream > & ds,
eosio::symbol & sym
)
Deserialize a symbol.
Deserialize a symbol from a stream
Parameters:
- ds - The stream to read
- symbol - The destination for deserialized value
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator<<
template<typename Stream, typename T>
datastream<Stream>& eosio::operator<<(
datastream< Stream > & ds,
const ::eosio::ignore_wrapper< T > & val
)
Serialize ignored_wrapper
Serialize an ignored_wrapper type into a stream
Parameters:
- ds - The stream to write
- val - The value to serialize
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator<<
template<typename Stream, typename T>
datastream<Stream>& eosio::operator<<(
datastream< Stream > & ds,
const ::eosio::ignore< T > & val
)
Serialize an ignored type.
Serialize an ignored type into a stream
Parameters:
- ds - The stream to write
- ignore - The value to serialize
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator>>
template<typename Stream, typename T>
datastream<Stream>& eosio::operator>>(
datastream< Stream > & ds,
::eosio::ignore< T >
)
Deserialize an ignored type.
Deserialize an ignored type from a stream
Parameters:
- ds - The stream to read
- ignored - The destination for deserialized value
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator<<
template<typename Stream>
datastream<Stream>& eosio::operator<<(
datastream< Stream > & ds,
const capi_public_key & pubkey
)
Serialize a public_key.
Serialize a public_key into a stream
Parameters:
- ds - The stream to write
- pubkey - The value to serialize
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator>>
template<typename Stream>
datastream<Stream>& eosio::operator>>(
datastream< Stream > & ds,
capi_public_key & pubkey
)
Deserialize a public_key.
Deserialize a public_key from a stream
Parameters:
- ds - The stream to read
- pubkey - The destination for deserialized value
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator<<
template<typename Stream>
datastream<Stream>& eosio::operator<<(
datastream< Stream > & ds,
const eosio::public_key & pubkey
)
Serialize an eosio::public_key.
Serialize an eosio::public_key into a stream
Parameters:
- ds - The stream to write
- pubkey - The value to serialize
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator>>
template<typename Stream>
datastream<Stream>& eosio::operator>>(
datastream< Stream > & ds,
eosio::public_key & pubkey
)
Deserialize an eosio::public_key.
Deserialize an eosio::public_key from a stream
Parameters:
- ds - The stream to read
- pubkey - The destination for deserialized value
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator<<
template<typename Stream>
datastream<Stream>& eosio::operator<<(
datastream< Stream > & ds,
const eosio::signature & sig
)
Serialize an eosio::signature.
Serialize an eosio::signature into a stream
Parameters:
- ds - The stream to write
- sig - The value to serialize
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator>>
template<typename Stream>
datastream<Stream>& eosio::operator>>(
datastream< Stream > & ds,
eosio::signature & sig
)
Deserialize an eosio::signature.
Deserialize an eosio::signature from a stream
Parameters:
- ds - The stream to read
- sig - The destination for deserialized value
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator<<
template<typename Stream>
datastream<Stream>& eosio::operator<<(
datastream< Stream > & ds,
const key256 & d
)
Serialize a key256.
Serialize a key256 into a stream
Parameters:
- ds - The stream to write
- d - The value to serialize
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator>>
template<typename Stream>
datastream<Stream>& eosio::operator>>(
datastream< Stream > & ds,
key256 & d
)
Deserialize a key256.
Deserialize a key256 from a stream
Parameters:
- ds - The stream to read
- d - The destination for deserialized value
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator<<
template<typename Stream, size_t Size>
datastream<Stream>& eosio::operator<<(
datastream< Stream > & ds,
const fixed_bytes< Size > & d
)
Serialize a fixed_bytes.
Serialize a fixed_bytes into a stream
Parameters:
- ds - The stream to write
- d - The value to serialize
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator>>
template<typename Stream, size_t Size>
datastream<Stream>& eosio::operator>>(
datastream< Stream > & ds,
fixed_bytes< Size > & d
)
Deserialize a fixed_bytes.
Deserialize a fixed_bytes from a stream
Parameters:
- ds - The stream to read
- d - The destination for deserialized value
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator<<
template<typename Stream>
datastream<Stream>& eosio::operator<<(
datastream< Stream > & ds,
const bool & d
)
Serialize a bool into a stream.
Serialize a bool into a stream
Parameters:
- ds - The stream to read
- d - The value to serialize
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator>>
template<typename Stream>
datastream<Stream>& eosio::operator>>(
datastream< Stream > & ds,
bool & d
)
Deserialize a bool.
Deserialize a bool from a stream
Parameters:
- ds - The stream to read
- d - The destination for deserialized value
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator<<
template<typename Stream>
datastream<Stream>& eosio::operator<<(
datastream< Stream > & ds,
const capi_checksum256 & d
)
Serialize a checksum256.
Serialize a checksum256 into a stream
Parameters:
- ds - The stream to write
- d - The value to serialize
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator>>
template<typename Stream>
datastream<Stream>& eosio::operator>>(
datastream< Stream > & ds,
capi_checksum256 & d
)
Deserialize a checksum256.
Deserialize a checksum256 from a stream
Parameters:
- ds - The stream to read
- d - The destination for deserialized value
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator<<
template<typename DataStream>
DataStream& eosio::operator<<(
DataStream & ds,
const std::string & v
)
Serialize a string.
Serialize a string into a stream
Parameters:
- ds - The stream to write
- v - The value to serialize
Template parameters:
- DataStream - Type of datastream
Returns:
DataStream& - Reference to the datastream
function operator>>
template<typename DataStream>
DataStream& eosio::operator>>(
DataStream & ds,
std::string & v
)
Deserialize a string.
Deserialize a string from a stream
Parameters:
- ds - The stream to read
- v - The destination for deserialized value
Template parameters:
- DataStream - Type of datastream
Returns:
DataStream& - Reference to the datastream
function operator<<
template<typename DataStream, typename T, std::size_t N>
DataStream& eosio::operator<<(
DataStream & ds,
const std::array< T, N > & v
)
Serialize a fixed size std::array.
Serialize a fixed size std::array
Parameters:
- ds - The stream to write
- v - The value to serialize
Template parameters:
- DataStream - Type of datastream
- T - Type of the object contained in the array
- N - Size of the array
Returns:
DataStream& - Reference to the datastream
function operator>>
template<typename DataStream, typename T, std::size_t N>
DataStream& eosio::operator>>(
DataStream & ds,
std::array< T, N > & v
)
Deserialize a fixed size std::array.
Deserialize a fixed size std::array
Parameters:
- ds - The stream to read
- v - The destination for deserialized value
Template parameters:
- DataStream - Type of datastream
- T - Type of the object contained in the array
- N - Size of the array
Returns:
DataStream& - Reference to the datastream
function operator>>
template<typename DataStream, typename T, std::enable_if_t< _datastream_detail::is_pointer< T >()> *>
DataStream& eosio::operator>>(
DataStream & ds,
T
)
Deserialize a a pointer.
Pointer should not be serialized, so this function will always throws an error
Parameters:
- ds - The stream to read
Template parameters:
- DataStream - Type of datastream
- T - Type of the pointer
Returns:
DataStream& - Reference to the datastream
Post
Throw an exception if it is a pointer
function operator<<
template<typename DataStream, typename T, std::size_t N, std::enable_if_t<!_datastream_detail::is_primitive< T >() &&!_datastream_detail::is_pointer< T >()> *>
DataStream & eosio::operator<<(
DataStream & ds,
const T(&) v
)
Serialize a fixed size C array of non-primitive and non-pointer type.
Serialize a fixed size C array of primitive type. Serialize a fixed size C array of non-primitive and non-pointer type
Parameters:
- ds - The stream to write
- v - The value to serialize
Template parameters:
- DataStream - Type of datastream
- T - Type of the pointer
Returns:
DataStream& - Reference to the datastream
Serialize a fixed size C array of primitive type
Parameters:
- ds - The stream to write
- v - The value to serialize
Template parameters:
- DataStream - Type of datastream
- T - Type of the pointer
Returns:
DataStream& - Reference to the datastream
function operator>>
template<typename DataStream, typename T, std::size_t N, std::enable_if_t<!_datastream_detail::is_primitive< T >() &&!_datastream_detail::is_pointer< T >()> *>
DataStream & eosio::operator>>(
DataStream & ds,
T(&) v
)
Deserialize a fixed size C array of non-primitive and non-pointer type.
Deserialize a fixed size C array of primitive type. Deserialize a fixed size C array of non-primitive and non-pointer type
Parameters:
- ds - The stream to read
- v - The destination for deserialized value
Template parameters:
- T - Type of the object contained in the array
- N - Size of the array
- DataStream - Type of datastream
Returns:
DataStream& - Reference to the datastream
Deserialize a fixed size C array of primitive type
Parameters:
- ds - The stream to read
- v - The destination for deserialized value
Template parameters:
- T - Type of the object contained in the array
- N - Size of the array
- DataStream - Type of datastream
Returns:
DataStream& - Reference to the datastream
function operator<<
template<typename DataStream>
DataStream& eosio::operator<<(
DataStream & ds,
const std::vector< char > & v
)
Serialize a vector of char.
Serialize a vector of char
Parameters:
- ds - The stream to write
- v - The value to serialize
Template parameters:
- DataStream - Type of datastream
Returns:
DataStream& - Reference to the datastream
function operator<<
template<typename DataStream, typename T>
DataStream& eosio::operator<<(
DataStream & ds,
const std::vector< T > & v
)
Serialize a vector.
Serialize a vector
Parameters:
- ds - The stream to write
- v - The value to serialize
Template parameters:
- DataStream - Type of datastream
- T - Type of the object contained in the vector
Returns:
DataStream& - Reference to the datastream
function operator>>
template<typename DataStream>
DataStream& eosio::operator>>(
DataStream & ds,
std::vector< char > & v
)
Deserialize a vector of char.
Deserialize a vector of char
Parameters:
- ds - The stream to read
- v - The destination for deserialized value
Template parameters:
- DataStream - Type of datastream
Returns:
DataStream& - Reference to the datastream
function operator>>
template<typename DataStream, typename T>
DataStream& eosio::operator>>(
DataStream & ds,
std::vector< T > & v
)
Deserialize a vector.
Deserialize a vector
Parameters:
- ds - The stream to read
- v - The destination for deserialized value
Template parameters:
- DataStream - Type of datastream
- T - Type of the object contained in the vector
Returns:
DataStream& - Reference to the datastream
function operator<<
template<typename DataStream, typename T>
DataStream& eosio::operator<<(
DataStream & ds,
const std::set< T > & s
)
Serialize a set.
Serialize a set
Parameters:
- ds - The stream to write
- s - The value to serialize
Template parameters:
- DataStream - Type of datastream
- T - Type of the object contained in the set
Returns:
DataStream& - Reference to the datastream
function operator>>
template<typename DataStream, typename T>
DataStream& eosio::operator>>(
DataStream & ds,
std::set< T > & s
)
Deserialize a set.
Deserialize a set
Parameters:
- ds - The stream to read
- s - The destination for deserialized value
Template parameters:
- DataStream - Type of datastream
- T - Type of the object contained in the set
Returns:
DataStream& - Reference to the datastream
function operator<<
template<typename DataStream, typename K, typename V>
DataStream& eosio::operator<<(
DataStream & ds,
const std::map< K, V > & m
)
Serialize a map.
Serialize a map
Parameters:
- ds - The stream to write
- m - The value to serialize
Template parameters:
- DataStream - Type of datastream
- K - Type of the key contained in the map
- V - Type of the value contained in the map
Returns:
DataStream& - Reference to the datastream
function operator>>
template<typename DataStream, typename K, typename V>
DataStream& eosio::operator>>(
DataStream & ds,
std::map< K, V > & m
)
Deserialize a map.
Deserialize a map
Parameters:
- ds - The stream to read
- m - The destination for deserialized value
Template parameters:
- DataStream - Type of datastream
- K - Type of the key contained in the map
- V - Type of the value contained in the map
Returns:
DataStream& - Reference to the datastream
function operator<<
template<typename DataStream, typename T>
DataStream& eosio::operator<<(
DataStream & ds,
const boost::container::flat_set< T > & s
)
Serialize a flat_set.
Serialize a flat_set
Parameters:
- ds - The stream to write
- s - The value to serialize
Template parameters:
- DataStream - Type of datastream
- T - Type of the value contained in the flat_set
Returns:
DataStream& - Reference to the datastream
function operator>>
template<typename DataStream, typename T>
DataStream& eosio::operator>>(
DataStream & ds,
boost::container::flat_set< T > & s
)
Deserialize a flat_set.
Deserialize a flat_set
Parameters:
- ds - The stream to read
- s - The destination for deserialized value
Template parameters:
- DataStream - Type of datastream
- T - Type of the value contained in the flat_set
Returns:
DataStream& - Reference to the datastream
function operator<<
template<typename DataStream, typename K, typename V>
DataStream& eosio::operator<<(
DataStream & ds,
const boost::container::flat_map< K, V > & m
)
Serialize a flat map.
Serialize a flat map
Parameters:
- ds - The stream to write
- m - The value to serialize
Template parameters:
- DataStream - Type of datastream
- K - Type of the key contained in the flat map
- V - Type of the value contained in the flat map
Returns:
DataStream& - Reference to the datastream
function operator>>
template<typename DataStream, typename K, typename V>
DataStream& eosio::operator>>(
DataStream & ds,
boost::container::flat_map< K, V > & m
)
Deserialize a flat map.
Deserialize a flat map
Parameters:
- ds - The stream to read
- m - The destination for deserialized value
Template parameters:
- DataStream - Type of datastream
- K - Type of the key contained in the flat map
- V - Type of the value contained in the flat map
Returns:
DataStream& - Reference to the datastream
function operator<<
template<typename DataStream, typename... Args>
DataStream& eosio::operator<<(
DataStream & ds,
const std::tuple< Args... > & t
)
Serialize a tuple.
Serialize a tuple
Parameters:
- ds - The stream to write
- t - The value to serialize
Template parameters:
- DataStream - Type of datastream
- Args - Type of the objects contained in the tuple
Returns:
DataStream& - Reference to the datastream
function operator>>
template<typename DataStream, typename... Args>
DataStream& eosio::operator>>(
DataStream & ds,
std::tuple< Args... > & t
)
Deserialize a tuple.
Deserialize a tuple
Parameters:
- ds - The stream to read
- t - The destination for deserialized value
Template parameters:
- DataStream - Type of datastream
- Args - Type of the objects contained in the tuple
Returns:
DataStream& - Reference to the datastream
function operator<<
template<typename DataStream, typename T, std::enable_if_t< std::is_class< T >::value > *>
DataStream & eosio::operator<<(
DataStream & ds,
const T & v
)
Serialize a class.
Serialize a primitive type. Serialize a class
Parameters:
- ds - The stream to write
- v - The value to serialize
Template parameters:
- DataStream - Type of datastream
- T - Type of class
Returns:
DataStream& - Reference to the datastream
Serialize a primitive type
Parameters:
- ds - The stream to write
- v - The value to serialize
Template parameters:
- DataStream - Type of datastream
- T - Type of the primitive type
Returns:
DataStream& - Reference to the datastream
function operator>>
template<typename DataStream, typename T, std::enable_if_t< std::is_class< T >::value > *>
DataStream & eosio::operator>>(
DataStream & ds,
T & v
)
Deserialize a class.
Deserialize a primitive type. Deserialize a class
Parameters:
- ds - The stream to read
- v - The destination for deserialized value
Template parameters:
- DataStream - Type of datastream
- T - Type of class
Returns:
DataStream& - Reference to the datastream
Deserialize a primitive type
Parameters:
- ds - The stream to read
- v - The destination for deserialized value
Template parameters:
- DataStream - Type of datastream
- T - Type of the primitive type
Returns:
DataStream& - Reference to the datastream
function unpack
template<typename T>
T eosio::unpack(
const char * buffer,
size_t len
)
Unpack data inside a fixed size buffer as T.
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>
T eosio::unpack(
const std::vector< char > & bytes
)
Unpack data inside a variable size buffer as T.
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.
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.
Get packed data
Template parameters:
- T - Type of the data to be packed
Parameters:
- value - Data to be packed
Returns:
bytes - The packed data
function operator<<
template<typename Stream>
datastream<Stream>& eosio::operator<<(
datastream< Stream > & ds,
const capi_checksum160 & cs
)
Serializea capi_checksum160 type.
Serialize a capi_checksum160 type
Parameters:
- ds - The stream to write
- cs - The value to serialize
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator>>
template<typename Stream>
datastream<Stream>& eosio::operator>>(
datastream< Stream > & ds,
capi_checksum160 & cs
)
Deserialize a capi_checksum160 type.
Deserialize a capi_checksum160 type
Parameters:
- ds - The stream to read
- cs - The destination for deserialized value
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator<<
template<typename Stream>
datastream<Stream>& eosio::operator<<(
datastream< Stream > & ds,
const capi_checksum512 & cs
)
Serialize a capi_checksum512 type.
Serialize a capi_checksum512 type
Parameters:
- ds - The stream to write
- cs - The value to serialize
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream
function operator>>
template<typename Stream>
datastream<Stream>& eosio::operator>>(
datastream< Stream > & ds,
capi_checksum512 & cs
)
Deserialize a capi_checksum512 type.
Deserialize a capi_checksum512 type
Parameters:
- ds - The stream to read
- cs - The destination for deserialized value
Template parameters:
- Stream - Type of datastream buffer
Returns:
datastream