![]() |
VSM C++ SDK
Vehicle Specific Modules SDK
|
VSM definitions to work with byte order. More...
Go to the source code of this file.
Classes | |
class | ugcs::vsm::Bo_value< T, Converter > |
Helper class for byte-order-dependent value representation. More... | |
Namespaces | |
ugcs | |
UGCS root namespace. | |
ugcs::vsm | |
All VSM SDK functionality resides in this namespace. | |
Macros | |
#define | _UGCS_VSM_BIG_ENDIAN_ |
#define | VSM_BSWAP16(x) (((x) >> 8) | ((x) << 8)) |
Swap bytes in 16-bits integer value. More... | |
#define | VSM_BSWAP32(x) __builtin_bswap32(x) |
Swap bytes in 32-bits integer value. More... | |
#define | VSM_BSWAP64(x) __builtin_bswap64(x) |
Swap bytes in 64-bits integer value. More... | |
#define | __VSM_BO_INT(type_size) int ## type_size ## _t |
Definitions for byte order conversions for all integer types. More... | |
#define | __VSM_BO_UINT(type_size) uint ## type_size ## _t |
#define | _VSM_DEF_BO_CONV(type_size, type_name) |
#define | VSM_DEF_BO_CONV(type_size) |
Typedefs | |
template<typename T > | |
using | ugcs::vsm::Le_value = Bo_value< T, internal::Le_converter > |
Little-endian value wrapper. More... | |
template<typename T > | |
using | ugcs::vsm::Be_value = Bo_value< T, internal::Be_converter > |
Big-endian value wrapper. More... | |
typedef Le_value< int8_t > | ugcs::vsm::Le_int8 |
Standard primitive types for little-endian byte order. More... | |
typedef Le_value< uint8_t > | ugcs::vsm::Le_uint8 |
typedef Le_value< int16_t > | ugcs::vsm::Le_int16 |
typedef Le_value< uint16_t > | ugcs::vsm::Le_uint16 |
typedef Le_value< int32_t > | ugcs::vsm::Le_int32 |
typedef Le_value< uint32_t > | ugcs::vsm::Le_uint32 |
typedef Le_value< float > | ugcs::vsm::Le_float |
typedef Le_value< double > | ugcs::vsm::Le_double |
typedef Be_value< int8_t > | ugcs::vsm::Be_int8 |
Standard primitive types for big-endian byte order. More... | |
typedef Be_value< uint8_t > | ugcs::vsm::Be_uint8 |
typedef Be_value< int16_t > | ugcs::vsm::Be_int16 |
typedef Be_value< uint16_t > | ugcs::vsm::Be_uint16 |
typedef Be_value< int32_t > | ugcs::vsm::Be_int32 |
typedef Be_value< uint32_t > | ugcs::vsm::Be_uint32 |
typedef Be_value< float > | ugcs::vsm::Be_float |
typedef Be_value< double > | ugcs::vsm::Be_double |
Functions | |
constexpr bool | ugcs::vsm::Is_system_le () |
Check if the system is little-endian. More... | |
constexpr bool | ugcs::vsm::Is_system_be () |
Check if the system is big-endian. More... | |
template<typename T > | |
constexpr T | ugcs::vsm::Convert_be_8 (T x) |
Stub for easier conversion functions generalization. More... | |
template<typename T > | |
constexpr T | ugcs::vsm::Convert_be_16 (T x) |
Convert 16 bits value byte order from BE to host byte order and vice versa. More... | |
template<typename T > | |
constexpr T | ugcs::vsm::Convert_be_32 (T x) |
Convert 32 bits value byte order from BE to host byte order and vice versa. More... | |
template<typename T > | |
constexpr T | ugcs::vsm::Convert_be_64 (T x) |
Convert 64 bits value byte order from BE to host byte order and vice versa. More... | |
template<typename T > | |
constexpr T | ugcs::vsm::Convert_le_8 (T x) |
Stub for easier conversion functions generalization. More... | |
template<typename T > | |
constexpr T | ugcs::vsm::Convert_le_16 (T x) |
Convert 16 bits value byte order from LE to host byte order and vice versa. More... | |
template<typename T > | |
constexpr T | ugcs::vsm::Convert_le_32 (T x) |
Convert 32 bits value byte order from LE to host byte order and vice versa. More... | |
template<typename T > | |
constexpr T | ugcs::vsm::Convert_le_64 (T x) |
Convert 64 bits value byte order from LE to host byte order and vice versa. More... | |
template<typename T > | |
constexpr T | ugcs::vsm::Convert_nh_8 (T x) |
Stub for easier conversion functions generalization. More... | |
template<typename T > | |
constexpr T | ugcs::vsm::Convert_nh_16 (T x) |
Convert 16 bits value byte order from network to host byte order and vice versa. More... | |
template<typename T > | |
constexpr T | ugcs::vsm::Convert_nh_32 (T x) |
Convert 32 bits value byte order from network to host byte order and vice versa. More... | |
template<typename T > | |
constexpr T | ugcs::vsm::Convert_nh_64 (T x) |
Convert 64 bits value byte order from network to host byte order and vice versa. More... | |
constexpr int8_t | ugcs::vsm::Ntoh (int8_t x) |
Convert value from network to host byte order. More... | |
constexpr int8_t | ugcs::vsm::Hton (int8_t x) |
Convert value from host to network byte order. More... | |
constexpr int8_t | ugcs::vsm::Le (int8_t x) |
Convert value from LE to host byte order and vice versa. More... | |
constexpr int8_t | ugcs::vsm::Be (int8_t x) |
Convert value from BE to host byte order and vice versa. More... | |
constexpr uint8_t | ugcs::vsm::Ntoh (uint8_t x) |
Convert value from network to host byte order. More... | |
constexpr uint8_t | ugcs::vsm::Hton (uint8_t x) |
Convert value from host to network byte order. More... | |
constexpr uint8_t | ugcs::vsm::Le (uint8_t x) |
Convert value from LE to host byte order and vice versa. More... | |
constexpr uint8_t | ugcs::vsm::Be (uint8_t x) |
Convert value from BE to host byte order and vice versa. More... | |
constexpr int16_t | ugcs::vsm::Ntoh (int16_t x) |
Convert value from network to host byte order. More... | |
constexpr int16_t | ugcs::vsm::Hton (int16_t x) |
Convert value from host to network byte order. More... | |
constexpr int16_t | ugcs::vsm::Le (int16_t x) |
Convert value from LE to host byte order and vice versa. More... | |
constexpr int16_t | ugcs::vsm::Be (int16_t x) |
Convert value from BE to host byte order and vice versa. More... | |
constexpr uint16_t | ugcs::vsm::Ntoh (uint16_t x) |
Convert value from network to host byte order. More... | |
constexpr uint16_t | ugcs::vsm::Hton (uint16_t x) |
Convert value from host to network byte order. More... | |
constexpr uint16_t | ugcs::vsm::Le (uint16_t x) |
Convert value from LE to host byte order and vice versa. More... | |
constexpr uint16_t | ugcs::vsm::Be (uint16_t x) |
Convert value from BE to host byte order and vice versa. More... | |
constexpr int32_t | ugcs::vsm::Ntoh (int32_t x) |
Convert value from network to host byte order. More... | |
constexpr int32_t | ugcs::vsm::Hton (int32_t x) |
Convert value from host to network byte order. More... | |
constexpr int32_t | ugcs::vsm::Le (int32_t x) |
Convert value from LE to host byte order and vice versa. More... | |
constexpr int32_t | ugcs::vsm::Be (int32_t x) |
Convert value from BE to host byte order and vice versa. More... | |
constexpr uint32_t | ugcs::vsm::Ntoh (uint32_t x) |
Convert value from network to host byte order. More... | |
constexpr uint32_t | ugcs::vsm::Hton (uint32_t x) |
Convert value from host to network byte order. More... | |
constexpr uint32_t | ugcs::vsm::Le (uint32_t x) |
Convert value from LE to host byte order and vice versa. More... | |
constexpr uint32_t | ugcs::vsm::Be (uint32_t x) |
Convert value from BE to host byte order and vice versa. More... | |
constexpr int64_t | ugcs::vsm::Ntoh (int64_t x) |
Convert value from network to host byte order. More... | |
constexpr int64_t | ugcs::vsm::Hton (int64_t x) |
Convert value from host to network byte order. More... | |
constexpr int64_t | ugcs::vsm::Le (int64_t x) |
Convert value from LE to host byte order and vice versa. More... | |
constexpr int64_t | ugcs::vsm::Be (int64_t x) |
Convert value from BE to host byte order and vice versa. More... | |
constexpr uint64_t | ugcs::vsm::Ntoh (uint64_t x) |
Convert value from network to host byte order. More... | |
constexpr uint64_t | ugcs::vsm::Hton (uint64_t x) |
Convert value from host to network byte order. More... | |
constexpr uint64_t | ugcs::vsm::Le (uint64_t x) |
Convert value from LE to host byte order and vice versa. More... | |
constexpr uint64_t | ugcs::vsm::Be (uint64_t x) |
Convert value from BE to host byte order and vice versa. More... | |
constexpr float | ugcs::vsm::Hton (float x) |
Convert float type from host to network format. More... | |
constexpr float | ugcs::vsm::Ntoh (float x) |
Convert float type from network to host format. More... | |
constexpr double | ugcs::vsm::Hton (double x) |
Convert double type from host to network format. More... | |
constexpr double | ugcs::vsm::Ntoh (double x) |
Convert double type from network to host format. More... | |
constexpr float | ugcs::vsm::Le (float x) |
Convert float type from LE to host format. More... | |
constexpr float | ugcs::vsm::Be (float x) |
Convert float type from BE to host format. More... | |
constexpr double | ugcs::vsm::Le (double x) |
Convert float type from LE to host format. More... | |
constexpr double | ugcs::vsm::Be (double x) |
Convert float type from BE to host format. More... | |
Bo_value (T value=0) | |
Construct value. More... | |
Bo_value & | operator= (T value) |
Assign new value. More... | |
operator T () const | |
Cast to underlying type. More... | |
T | Get () const |
Get the value of underlying type. More... | |
Variables | |
T | value |
Stored value (in wire byte order). More... | |
VSM definitions to work with byte order.
There is "endian.h" file present on some systems but it is not standardized and thus not cross-platform.
#define __VSM_BO_INT | ( | type_size | ) | int ## type_size ## _t |
Definitions for byte order conversions for all integer types.
#define _VSM_DEF_BO_CONV | ( | type_size, | |
type_name | |||
) |
#define VSM_BSWAP16 | ( | x | ) | (((x) >> 8) | ((x) << 8)) |
Swap bytes in 16-bits integer value.
#define VSM_BSWAP32 | ( | x | ) | __builtin_bswap32(x) |
Swap bytes in 32-bits integer value.
#define VSM_BSWAP64 | ( | x | ) | __builtin_bswap64(x) |
Swap bytes in 64-bits integer value.
#define VSM_DEF_BO_CONV | ( | type_size | ) |
__attribute__::Bo_value | ( | T | value = 0 | ) |
Construct value.
value | Value in host byte order. |
T __attribute__::Get | ( | ) | const |
Get the value of underlying type.
__attribute__::operator T | ( | ) | const |
Cast to underlying type.
Bo_value& __attribute__::operator= | ( | T | value | ) |
Assign new value.
value | Value in host byte order. |
T value |
Stored value (in wire byte order).