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()) {
87 serializeRaw(m_buf, v, 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()) {
136 deserializeRaw(m_reader, v, 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 ...
void deserialize(BufferReaderType &reader, MessageClass &msg)
Deserializes a message from a buffer, using a MessageClass
void serialize(BufferType &buf, MessageClass &msg)
Serializes a message into a buffer, using a MessageClass
void operator()(T *v, Tag const &tag=Tag())
Functor class used by osvr::common::deserialize to deserialize a message (passed as the "process" arg...
void operator()(T &v)
Main function call operator method.
SerializeFunctor(BufferType &buf)
Constructor, taking the buffer.
void operator()(T const &v, Tag const &tag=Tag())
Main function call operator method, taking a "tag type" to specify non-default serialization-related ...
Type trait: is the given type a buffer?
DeserializeFunctor(BufferReaderType &reader)
Constructor, taking the buffer reader.
Functor class used by osvr::common::serialize to serialize a message (passed as the "process" argumen...
void operator()(T const &v)
Main function call operator method.
Type trait: is the given type a buffer reader?