YAMI4 - core
yami::core::serializable Class Reference

Common interface for serializable data source. More...

#include <serializable.h>

Inherited by yami::core::parameters, and yami::core::raw_buffer_data_source.

List of all members.

Public Member Functions

virtual result get_serialize_buffer_size (std::size_t &size) const =0
 Finds the total size of serialization buffer.
virtual result serialize (char **buffers, const std::size_t *buffer_sizes, std::size_t num_of_buffers) const =0
 Serializes current content into given buffer(s).

Detailed Description

Serializable data source allows to fill the given set up buffers with binary data that corresponds to the actual data source content. The purpose of this interface is to allow uniform treatment of parameters objects with wrapped raw binary buffers.


Member Function Documentation

virtual result yami::core::serializable::get_serialize_buffer_size ( std::size_t &  size) const [pure virtual]

Computes the total size of serialization buffer(s) for the current content of this object.

Parameters:
sizeThe computed size of buffer.
Returns:
  • ok if operation was successful
  • nesting_too_deep if the level of nesting in this object is deeper than the limit

Implemented in yami::core::parameters, and yami::core::raw_buffer_data_source.

virtual result yami::core::serializable::serialize ( char **  buffers,
const std::size_t *  buffer_sizes,
std::size_t  num_of_buffers 
) const [pure virtual]

Serializes the current content of this object into the given buffer(s). The serialization buffer does not have to be contiguous and any number of buffer segments is allowed, provided that the size of each buffer segment is a multiple of 4 (32 bits).
The function scatters the serialized data into subsequent buffers as they become filled.
The buffers are provided as array of buffer pointers and their sizes.

Parameters:
buffersPointer to the array of buffer pointers (each of type char *).
buffer_sizesPointer to the array of buffer sizes.
num_of_buffersNumber of buffers described by the array.
Returns:
  • ok if operation was successful
  • not_enough_space if the buffers are not big enough for all the data
  • other relevant error code, depending on implementation

Implemented in yami::core::parameters, and yami::core::raw_buffer_data_source.