OSVR-Core
Classes | Namespaces | Typedefs | Functions
IntegerByteSwap.h File Reference

Header providing optimized integer byte-swap functionality through a single function template, implemented using platform special functions or intrinsics where possible. More...

#include <osvr/Util/StdInt.h>
#include <osvr/Common/ConfigByteSwapping.h>
#include <boost/integer.hpp>
#include <type_traits>

Go to the source code of this file.

Classes

struct  osvr::common::detail::UnspecializedByteSwapBase
 Tag type used only for recognizing ByteSwap specializations that aren't explicitly specialized. More...
 
struct  osvr::common::detail::ByteSwap< T >
 Template for providing/describing optimized/intrinsic byte swap functions. More...
 
struct  osvr::common::detail::NoOpFunction
 
struct  osvr::common::detail::ByteSwap< uint8_t >
 no-op swap for 1 byte. More...
 
struct  osvr::common::detail::ByteSwap< int8_t >
 no-op swap for 1 byte. More...
 
struct  osvr::common::detail::IntegerByteSwapTraits< T >
 Traits assisting selection of optimized integer byte swapping. More...
 

Namespaces

 osvr
 The main namespace for all C++ elements of the framework, internal and external.
 
 osvr::common
 Handles spatial transformations.
 

Typedefs

template<typename T >
using osvr::common::detail::IsByteSwapperUnspecialized = std::integral_constant< bool, std::is_base_of< UnspecializedByteSwapBase, T >::value >
 Trait: For a given T=ByteSwap<ValueType> struct, is ByteSwap<ValueType> default/unspecialized?
 
template<typename T >
using osvr::common::detail::IsByteSwapperSpecialized = std::integral_constant< bool, !IsByteSwapperUnspecialized< T >::value >
 Trait: For a given T=ByteSwap<ValueType> struct, is ByteSwap<ValueType> specialized?
 

Functions

template<typename T >
T osvr::common::detail::genericByteSwap (T const v)
 Universal byte-swap function that always works, but isn't necessarily optimized. More...
 
template<typename T >
T osvr::common::detail::integerByteSwapImpl (T const v, typename std::enable_if< IntegerByteSwapTraits< T >::HAVE_BYTESWAPPER >::type *=nullptr)
 Implementation of integerByteSwap(): Gets called when we have an exact match to an explicit specialization.
 
template<typename T >
T osvr::common::detail::integerByteSwapImpl (T const v, typename std::enable_if<(!IntegerByteSwapTraits< T >::HAVE_BYTESWAPPER) &&(IntegerByteSwapTraits< T >::HAVE_OPPPOSITEBYTESWAPPER)>::type *=nullptr)
 Implementation of integerByteSwap(): Gets called when we do not have an exact match to an explicit specialization, but we do have a match if we switch the signedness. More...
 
template<typename T >
T osvr::common::detail::integerByteSwapImpl (T const v, typename std::enable_if<(!IntegerByteSwapTraits< T >::HAVE_BYTESWAPPER) &&(!IntegerByteSwapTraits< T >::HAVE_OPPPOSITEBYTESWAPPER)>::type *=nullptr)
 Implementation of integerByteSwap(): Gets called if no explicit specialization exists (for the type or its opposite-signedness relative)
 
template<typename Type >
Type osvr::common::integerByteSwap (Type const v)
 Swap the order of bytes of an arbitrary integer type.
 

Detailed Description

Header providing optimized integer byte-swap functionality through a single function template, implemented using platform special functions or intrinsics where possible.

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

Function Documentation

§ genericByteSwap()

template<typename T >
T osvr::common::detail::genericByteSwap ( T const  v)
inline

Universal byte-swap function that always works, but isn't necessarily optimized.

§ integerByteSwapImpl()

template<typename T >
T osvr::common::detail::integerByteSwapImpl ( T const  v,
typename std::enable_if<(!IntegerByteSwapTraits< T >::HAVE_BYTESWAPPER) &&(IntegerByteSwapTraits< T >::HAVE_OPPPOSITEBYTESWAPPER)>::type *  = nullptr 
)
inline

Implementation of integerByteSwap(): Gets called when we do not have an exact match to an explicit specialization, but we do have a match if we switch the signedness.