OSVR Framework (Internal Development Docs)  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
SerializationTraits.h File Reference

Header. More...

#include <osvr/Common/AlignmentPadding.h>
#include <osvr/Common/Endianness.h>
#include <osvr/Common/SerializationTags.h>
#include <osvr/Util/BoolC.h>
#include <osvr/Util/Vec2C.h>
#include <osvr/Util/Vec3C.h>
#include <osvr/Util/TypeSafeId.h>
#include <boost/call_traits.hpp>
#include <boost/noncopyable.hpp>
#include <string>
#include <vector>
#include <type_traits>

Go to the source code of this file.

Classes

struct  osvr::common::serialization::SerializationTraits< Tag, Dummy >
 Traits class indicating how to serialize a type with a given tag. The default tag for a type T is DefaultSerializationTag<T> More...
 
struct  osvr::common::serialization::BaseSerializationTraits< T >
 Base of serialization traits, containing useful typedefs. More...
 
struct  osvr::common::serialization::SimpleStructSerialization< T >
 An alternate, simpler method of serializing things that are effectively structs is to explicitly specialize SimpleStructSerialization for your type, inheriting from SimpleStructSerializationBase, and having a member: template <typename F, typename T> static void apply(F &f, T &val) that just calls f with each member of your type (which will come in as val), optionally with a serialization tag. More...
 
struct  osvr::common::serialization::SimpleStructSerializationBase
 Mandatory base class for SimpleStructSerialization specializations: allows detection of specializations and generation of corresponding SerializationTraits automatically. More...
 
struct  osvr::common::serialization::SerializationTraits< DefaultSerializationTag< T >, typename SimpleStructSerialization< T >::is_specialized >
 Class template that specializes SerializationTraits for a given type, with the default serialization tag, if there is a valid SimpleStructSerialization specialization for that type. The automatically-generated code uses the SimpleStructSerialization specialization to implement the required methods of a full SerializationTraits specialization. More...
 
struct  osvr::common::serialization::ArithmeticSerializationTraits< T, Alignment >
 Serialization traits for a given arithmetic type (that is, a number type that has a network byte order) with a specified alignment. More...
 
struct  osvr::common::serialization::SerializationTraits< DefaultSerializationTag< T >, typename std::enable_if< std::is_arithmetic< T >::value &&!std::is_same< bool, T >::value >::type >
 Set up the default serialization traits for arithmetic types, aligning to their type size. More...
 
struct  osvr::common::serialization::SerializationTraits< DefaultSerializationTag< bool >, void >
 Set up the default serialization traits for bool, which we'll stick in uint8_t (OSVR_CBool) types. Note that if you're going for VRPN compatibility (re-implementing existing VRPN messages), be sure you serialize vrpn_bool, not just bool - VPRN uses 16-bits for a bool by default IIRC. More...
 
struct  osvr::common::serialization::SerializationTraits< EnumAsIntegerTag< EnumType, IntegerType >, void >
 
struct  osvr::common::serialization::SerializationTraits< DefaultSerializationTag< std::string >, void >
 String, length-prefixed. (default) More...
 
struct  osvr::common::serialization::SerializationTraits< StringOnlyMessageTag, void >
 Traits for the StringOnlyMessageTag: a string, not prefixed by length (only useful if a whole message is a string). More...
 
struct  osvr::common::serialization::SerializationTraits< AlignedDataBufferTag, void >
 Serialization traits for a raw data bytestream with the given alignment. More...
 
struct  osvr::common::serialization::SerializationTraits< DefaultSerializationTag< std::vector< ValueType > >, void >
 
struct  osvr::common::serialization::SimpleStructSerialization< OSVR_Vec2 >
 
struct  osvr::common::serialization::SimpleStructSerialization< OSVR_Vec3 >
 
struct  osvr::common::serialization::SimpleStructSerialization< util::TypeSafeId< Tag > >
 

Namespaces

 osvr
 <
 
 osvr::common
 Handles spatial transformations.
 

Typedefs

template<typename Tag >
using osvr::common::serialization::MissingSerializationTraitsForTagOrType = std::integral_constant< bool, std::is_same< Tag, Tag >::value >
 Dummy template for better error messages - inspired by http://stackoverflow.com/a/17917624/265522.
 

Functions

template<typename T , typename BufferType , typename Tag = DefaultSerializationTag<T>>
void osvr::common::serialization::serializeRaw (BufferType &buf, T const &v, Tag const &tag=Tag())
 Serialize a value to a buffer, with optional tag to specify non-default traits.
 
template<typename T , typename BufferReaderType , typename Tag = DefaultSerializationTag<T>>
void osvr::common::serialization::deserializeRaw (BufferReaderType &reader, T &v, Tag const &tag=Tag())
 Deserialize a value from a buffer, with optional tag to specify non-default traits.
 
template<typename T , typename Tag = DefaultSerializationTag<T>>
size_t osvr::common::serialization::getBufferSpaceRequiredRaw (size_t existingBufferSize, T const &v, Tag const &tag=Tag())
 Get the size a value from a buffer, with optional tag to specify non-default traits.
 

Detailed Description

Header.

Date
2015
Author
Sensics, Inc. http://sensics.com/osvr

Definition in file SerializationTraits.h.