25 #ifndef INCLUDED_Serialization_h_GUID_339B4851_CA90_41A6_E1CC_4F94A18614AC 26 #define INCLUDED_Serialization_h_GUID_339B4851_CA90_41A6_E1CC_4F94A18614AC 33 #include <boost/call_traits.hpp> 34 #include <boost/noncopyable.hpp> 42 namespace serialization {
47 template <
typename BufferType>
61 apply<T, DefaultSerializationTag<T> >(v);
72 template <
typename Tag,
typename T>
74 apply<T, Tag>(v, tag);
77 std::true_type isSerialize()
const {
return std::true_type(); }
79 std::false_type isDeserialize()
const {
return std::false_type(); }
84 template <
typename T,
typename Tag>
85 void apply(
typename boost::call_traits<T>::param_type v,
86 Tag
const &tag = Tag()) {
95 template <
typename BufferReaderType>
106 apply<T, DefaultSerializationTag<T> >(v);
114 template <
typename Tag,
typename T>
116 apply<T, Tag>(v, tag);
122 template <
typename Tag,
typename T>
124 apply<T *, Tag>(v, tag);
127 std::false_type isSerialize()
const {
return std::false_type(); }
128 std::true_type isDeserialize()
const {
return std::true_type(); }
133 template <
typename T,
typename Tag>
134 void apply(
typename boost::call_traits<T>::reference v,
135 Tag
const &tag = Tag()) {
138 BufferReaderType &m_reader;
151 template <
typename BufferType,
typename MessageClass>
154 "First argument must be a buffer object");
158 msg.processMessage(functor);
168 template <
typename BufferReaderType,
typename MessageClass>
171 "First argument must be a buffer reader object");
173 msg.processMessage(functor);
178 #endif // INCLUDED_Serialization_h_GUID_339B4851_CA90_41A6_E1CC_4F94A18614AC void operator()(T &v, Tag const &tag=Tag())
Main function call operator method, taking a "tag type" to specify non-default serialization-related ...
Definition: Serialization.h:115
Handles spatial transformations.
Definition: SerializationTraitExample_Complicated.h:40
void deserialize(BufferReaderType &reader, MessageClass &msg)
Deserializes a message from a buffer, using a MessageClass
Definition: Serialization.h:169
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
void serialize(BufferType &buf, MessageClass &msg)
Serializes a message into a buffer, using a MessageClass
Definition: Serialization.h:152
void deserializeRaw(BufferReaderType &reader, T &v, Tag const &tag=Tag())
Deserialize a value from a buffer, with optional tag to specify non-default traits.
Definition: SerializationTraits.h:118
void operator()(T *v, Tag const &tag=Tag())
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: Serialization.h:123
Functor class used by osvr::common::deserialize to deserialize a message (passed as the "process" arg...
Definition: Serialization.h:96
void operator()(T &v)
Main function call operator method.
Definition: Serialization.h:105
SerializeFunctor(BufferType &buf)
Constructor, taking the buffer.
Definition: Serialization.h:51
void operator()(T const &v, Tag const &tag=Tag())
Main function call operator method, taking a "tag type" to specify non-default serialization-related ...
Definition: Serialization.h:73
Type trait: is the given type a buffer?
Definition: BufferTraits.h:59
DeserializeFunctor(BufferReaderType &reader)
Constructor, taking the buffer reader.
Definition: Serialization.h:99
Functor class used by osvr::common::serialize to serialize a message (passed as the "process" argumen...
Definition: Serialization.h:48
void operator()(T const &v)
Main function call operator method.
Definition: Serialization.h:60
void serializeRaw(BufferType &buf, T const &v, Tag const &tag=Tag())
Serialize a value to a buffer, with optional tag to specify non-default traits.
Definition: SerializationTraits.h:109
Type trait: is the given type a buffer reader?
Definition: BufferTraits.h:63