framework
|
Fundamental serializable definitions. More...
#include <type_traits>
#include <algorithm>
#include <framework/common/common_macros.hpp>
#include <framework/serializable/base_types.inl>
Go to the source code of this file.
Namespaces | |
framework | |
Framework namespace. | |
framework::serializable | |
Serializable namespace. | |
Constant Groups | |
framework | |
Framework namespace. | |
framework::serializable | |
Serializable namespace. | |
Functions | |
template<typename Input , typename T > | |
std::enable_if < std::is_arithmetic< T > ::value, bool >::type | framework::serializable::read_dispatch (T *, Input &in, T &out) |
Arithmetic read overload. | |
template<typename Output , typename T > | |
std::enable_if < std::is_arithmetic< T > ::value, bool >::type | framework::serializable::write_dispatch (T *, T in, Output &out) |
Arithmetic write overload. | |
template<typename Specification , typename... Args> | |
FRAMEWORK_ALWAYS_INLINE auto | framework::serializable::dispatch_read (Args &&...args) -> decltype(read_dispatch(static_cast< Specification * >(nullptr), std::forward< Args >(args)...)) |
Dispatched read forwarder. More... | |
template<typename Specification , typename... Args> | |
FRAMEWORK_ALWAYS_INLINE auto | framework::serializable::dispatch_write (Args &&...args) -> decltype(write_dispatch(static_cast< Specification * >(nullptr), std::forward< Args >(args)...)) |
Dispatched write forwarder. More... | |
template<std::size_t N, typename Stream > | |
bool | framework::serializable::stream_read (Stream &&stream, void *s) |
Stream read forwarder. More... | |
template<typename Stream > | |
bool | framework::serializable::stream_read (Stream &&stream, void *s, std::size_t n) |
Stream read forwarder. More... | |
template<std::size_t N, typename Stream > | |
bool | framework::serializable::stream_write (Stream &&stream, void const *s) |
Stream write forwarder. More... | |
template<typename Stream > | |
bool | framework::serializable::stream_write (Stream &&stream, void const *s, std::size_t n) |
Stream write forwarder. More... | |
template<typename Input , typename Output > | |
FRAMEWORK_ALWAYS_INLINE auto | framework::serializable::read (Input &&in, Output &&out) -> decltype(dispatch_read< reference_base< Output >>(std::forward< Input >(in), std::forward< Output >(out))) |
Read forwarder. More... | |
template<typename Input , typename Output > | |
FRAMEWORK_ALWAYS_INLINE auto | framework::serializable::write (Input &&in, Output &&out) -> decltype(dispatch_write< reference_base< Input >>(std::forward< Input >(in), std::forward< Output >(out))) |
Write forwarder. More... | |
Fundamental serializable definitions.
Provides the fundamental definitions extended by the remainder of this library to support specific types of serialization. Marshalling of data is performed using a collection of read/write method overloads, invoked as follows:
or through the following equivalent syntax:
It is important to note that the Specification provided to the above is used exclusively to define how the object is to be serialized. Specifically, there is no fundamental requirement that Specification
match the associated input or output object above This allows code to alter how the serialization of a class takes place without altering it's definition - for example, the following is well defined:
More commonly the alias template may be used to define part of the object's specification for use cases similar to the above. For example, the following computes a header-only checksum of the associated object: