Alchemy
1.0
A framework to robustly process network messages and structured data
|
Defines constructs that help manage byte-order conversion. More...
#include <Pb/detail/endianess.h>
Go to the source code of this file.
Classes | |
struct | Hg::EndianType< T, isSwap > |
Policy class used to perform byte-order operations. More... | |
struct | Hg::EndianType< T, false > |
Policy class used to perform byte-order operations. More... | |
struct | Hg::HostByteOrderT< E > |
Byte-order management policy for network data transfers. More... | |
struct | Hg::NetByteOrderT< E > |
Byte-order management policy for network data transfers. More... | |
Namespaces | |
namespace | Hg |
The MIT License(MIT)
| |
Functions | |
template<typename T > | |
T | Hg::EndianSwap (T input) |
A generic implementation that performs no action. More... | |
template<> | |
uint16_t | Hg::EndianSwap (uint16_t input) |
Endian Swap (Specialization, uint16_t) More... | |
template<> | |
int16_t | Hg::EndianSwap (int16_t input) |
Endian Swap (Specialization, int16_t) More... | |
template<> | |
uint32_t | Hg::EndianSwap (uint32_t input) |
Endian Swap (Specialization, uint32_t) More... | |
template<> | |
int32_t | Hg::EndianSwap (int32_t input) |
Endian Swap (Specialization, int32_t) More... | |
template<> | |
uint64_t | Hg::EndianSwap (uint64_t input) |
Endian Swap (Specialization, uint64_t) More... | |
template<> | |
int64_t | Hg::EndianSwap (int64_t input) |
Endian Swap (Specialization, int64_t) More... | |
Variables | |
const size_t | Hg::convert::k_16bits = 16 |
Bit-shift constant, 2-bytes. | |
const size_t | Hg::convert::k_24bits = 24 |
Bit-shift constant, 3-bytes. | |
const size_t | Hg::convert::k_32bits = 32 |
Bit-shift constant, 4-bytes. | |
const size_t | Hg::convert::k_40bits = 40 |
Bit-shift constant, 5-bytes. | |
const size_t | Hg::convert::k_48bits = 48 |
Bit-shift constant, 6-bytes. | |
const size_t | Hg::convert::k_56bits = 56 |
Bit-shift constant, 7-bytes. | |
const size_t | Hg::convert::k_64bits = 64 |
Bit-shift constant, 8-bytes. | |
const size_t | Hg::convert::k_8bits = 8 |
Bit-shift constant, 1-byte. | |
const Endianess | Hg::k_endianess = Endianess(ALCHEMY_ENDIANESS) |
< Constant indicates machine endianess. | |
Defines constructs that help manage byte-order conversion.
This file contains definitions, utilities and policy implementations to deal with byte-order characteristics for different machine architectures.
The final structure of byte-order conversion is an aggregate of two concepts into a set of user classes that can be used indiscriminately for the conversion of all data:
1) EndianSwap<T> This is a generic function that contains specializations for each type that may require byte-order management. The generic version performs no operations. Calling this function a second time with the result of the first call, will result with a value equal to the input of the first call.
2) EndianType<> This structure allows a discriminating ID to be associated with endian swap operations. Two ID's are specified to discriminate between Big-Endian and Little-Endian byte-orders. This structure provides a function swap_order, which will swap the byte-order of a value type according to the appropriate context.
The user classes, HostByteOrderT and NetByteOrderT, provide the appropriate context for converting between byte-orders. Both of these collectors provide the same interfaces with two functions:
Users should use these constructs for byte-order conversion:
The MIT License(MIT)
Definition in file byte_order.h.