8#ifndef INCLUDED_BSLX_MARSHALLINGUTIL
9#define INCLUDED_BSLX_MARSHALLINGUTIL
244#include <bslscm_version.h>
250#include <bsl_cstring.h>
322 static void putInt32(
char *buffer,
int value);
330 static void putInt24(
char *buffer,
int value);
338 static void putInt16(
char *buffer,
int value);
345 static void putInt8(
char *buffer,
int value);
355 static void putFloat64(
char *buffer,
double value);
363 static void putFloat32(
char *buffer,
float value);
436 static void getInt32(
int *variable,
const char *buffer);
443 static void getUint32(
unsigned int *variable,
const char *buffer);
450 static void getInt24(
int *variable,
const char *buffer);
457 static void getUint24(
unsigned int *variable,
const char *buffer);
464 static void getInt16(
short *variable,
const char *buffer);
471 static void getUint16(
unsigned short *variable,
const char *buffer);
473 static void getInt8(
char *variable,
const char *buffer);
474 static void getInt8(
signed char *variable,
const char *buffer);
478 static void getInt8(
unsigned char *variable,
const char *buffer);
487 static void getFloat64(
double *variable,
const char *buffer);
494 static void getFloat32(
float *variable,
const char *buffer);
560 const unsigned int *values,
573 const unsigned int *values,
586 const unsigned short *values,
593 const signed char *values,
601 const unsigned char *values,
615 const double *values,
842 const char *bytes =
reinterpret_cast<char *
>(&value);
844#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
845 buffer[0] = bytes[7];
846 buffer[1] = bytes[6];
847 buffer[2] = bytes[5];
848 buffer[3] = bytes[4];
849 buffer[4] = bytes[3];
850 buffer[5] = bytes[2];
851 buffer[6] = bytes[1];
852 buffer[7] = bytes[0];
863 const char *bytes =
reinterpret_cast<char *
>(&value);
865#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
866 buffer[0] = bytes[6];
867 buffer[1] = bytes[5];
868 buffer[2] = bytes[4];
869 buffer[3] = bytes[3];
870 buffer[4] = bytes[2];
871 buffer[5] = bytes[1];
872 buffer[6] = bytes[0];
883 const char *bytes =
reinterpret_cast<char *
>(&value);
885#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
886 buffer[0] = bytes[5];
887 buffer[1] = bytes[4];
888 buffer[2] = bytes[3];
889 buffer[3] = bytes[2];
890 buffer[4] = bytes[1];
891 buffer[5] = bytes[0];
902 const char *bytes =
reinterpret_cast<char *
>(&value);
904#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
905 buffer[0] = bytes[4];
906 buffer[1] = bytes[3];
907 buffer[2] = bytes[2];
908 buffer[3] = bytes[1];
909 buffer[4] = bytes[0];
920 const char *bytes =
reinterpret_cast<char *
>(&value);
922#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
923 buffer[0] = bytes[3];
924 buffer[1] = bytes[2];
925 buffer[2] = bytes[1];
926 buffer[3] = bytes[0];
937 const char *bytes =
reinterpret_cast<char *
>(&value);
939#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
940 buffer[0] = bytes[2];
941 buffer[1] = bytes[1];
942 buffer[2] = bytes[0];
953 const char *bytes =
reinterpret_cast<char *
>(&value);
955#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
956 buffer[0] = bytes[1];
957 buffer[1] = bytes[0];
968 *buffer =
static_cast<char>(value);
978 const char *bytes =
reinterpret_cast<char *
>(&value);
980#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
981 buffer[0] = bytes[
sizeof value - 1];
982 buffer[1] = bytes[
sizeof value - 2];
983 buffer[2] = bytes[
sizeof value - 3];
984 buffer[3] = bytes[
sizeof value - 4];
985 buffer[4] = bytes[
sizeof value - 5];
986 buffer[5] = bytes[
sizeof value - 6];
987 buffer[6] = bytes[
sizeof value - 7];
988 buffer[7] = bytes[
sizeof value - 8];
999 const char *bytes =
reinterpret_cast<char *
>(&value);
1001#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1002 buffer[0] = bytes[
sizeof value - 1];
1003 buffer[1] = bytes[
sizeof value - 2];
1004 buffer[2] = bytes[
sizeof value - 3];
1005 buffer[3] = bytes[
sizeof value - 4];
1021 *variable = 0x80 & buffer[0] ? -1 : 0;
1024 char *bytes =
reinterpret_cast<char *
>(variable);
1026#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1027 bytes[7] = buffer[0];
1028 bytes[6] = buffer[1];
1029 bytes[5] = buffer[2];
1030 bytes[4] = buffer[3];
1031 bytes[3] = buffer[4];
1032 bytes[2] = buffer[5];
1033 bytes[1] = buffer[6];
1034 bytes[0] = buffer[7];
1053 char *bytes =
reinterpret_cast<char *
>(variable);
1055#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1056 bytes[7] = buffer[0];
1057 bytes[6] = buffer[1];
1058 bytes[5] = buffer[2];
1059 bytes[4] = buffer[3];
1060 bytes[3] = buffer[4];
1061 bytes[2] = buffer[5];
1062 bytes[1] = buffer[6];
1063 bytes[0] = buffer[7];
1078 *variable = 0x80 & buffer[0] ? -1 : 0;
1080 char *bytes =
reinterpret_cast<char *
>(variable);
1082#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1083 bytes[6] = buffer[0];
1084 bytes[5] = buffer[1];
1085 bytes[4] = buffer[2];
1086 bytes[3] = buffer[3];
1087 bytes[2] = buffer[4];
1088 bytes[1] = buffer[5];
1089 bytes[0] = buffer[6];
1106 char *bytes =
reinterpret_cast<char *
>(variable);
1108#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1109 bytes[6] = buffer[0];
1110 bytes[5] = buffer[1];
1111 bytes[4] = buffer[2];
1112 bytes[3] = buffer[3];
1113 bytes[2] = buffer[4];
1114 bytes[1] = buffer[5];
1115 bytes[0] = buffer[6];
1130 *variable = 0x80 & buffer[0] ? -1 : 0;
1132 char *bytes =
reinterpret_cast<char *
>(variable);
1134#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1135 bytes[5] = buffer[0];
1136 bytes[4] = buffer[1];
1137 bytes[3] = buffer[2];
1138 bytes[2] = buffer[3];
1139 bytes[1] = buffer[4];
1140 bytes[0] = buffer[5];
1157 char *bytes =
reinterpret_cast<char *
>(variable);
1159#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1160 bytes[5] = buffer[0];
1161 bytes[4] = buffer[1];
1162 bytes[3] = buffer[2];
1163 bytes[2] = buffer[3];
1164 bytes[1] = buffer[4];
1165 bytes[0] = buffer[5];
1180 *variable = 0x80 & buffer[0] ? -1 : 0;
1182 char *bytes =
reinterpret_cast<char *
>(variable);
1184#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1185 bytes[4] = buffer[0];
1186 bytes[3] = buffer[1];
1187 bytes[2] = buffer[2];
1188 bytes[1] = buffer[3];
1189 bytes[0] = buffer[4];
1206 char *bytes =
reinterpret_cast<char *
>(variable);
1208#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1209 bytes[4] = buffer[0];
1210 bytes[3] = buffer[1];
1211 bytes[2] = buffer[2];
1212 bytes[1] = buffer[3];
1213 bytes[0] = buffer[4];
1228 *variable = 0x80 & buffer[0] ? -1 : 0;
1231 char *bytes =
reinterpret_cast<char *
>(variable);
1233#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1234 bytes[3] = buffer[0];
1235 bytes[2] = buffer[1];
1236 bytes[1] = buffer[2];
1237 bytes[0] = buffer[3];
1255 char *bytes =
reinterpret_cast<char *
>(variable);
1257#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1258 bytes[3] = buffer[0];
1259 bytes[2] = buffer[1];
1260 bytes[1] = buffer[2];
1261 bytes[0] = buffer[3];
1275 *variable = 0x80 & buffer[0] ? -1 : 0;
1277 char *bytes =
reinterpret_cast<char *
>(variable);
1279#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1280 bytes[2] = buffer[0];
1281 bytes[1] = buffer[1];
1282 bytes[0] = buffer[2];
1298 char *bytes =
reinterpret_cast<char *
>(variable);
1300#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1301 bytes[2] = buffer[0];
1302 bytes[1] = buffer[1];
1303 bytes[0] = buffer[2];
1318 *variable =
static_cast<short>(0x80 & buffer[0] ? -1 : 0);
1322 char *bytes =
reinterpret_cast<char *
>(variable);
1324#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1325 bytes[1] = buffer[0];
1326 bytes[0] = buffer[1];
1344 char *bytes =
reinterpret_cast<char *
>(variable);
1346#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1347 bytes[1] = buffer[0];
1348 bytes[0] = buffer[1];
1362 *variable = *buffer;
1371 getInt8(
reinterpret_cast<char *
>(variable), buffer);
1380 getInt8(
reinterpret_cast<char *
>(variable), buffer);
1395 char *bytes =
reinterpret_cast<char *
>(variable);
1397#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1398 bytes[
sizeof *variable - 1] = buffer[0];
1399 bytes[
sizeof *variable - 2] = buffer[1];
1400 bytes[
sizeof *variable - 3] = buffer[2];
1401 bytes[
sizeof *variable - 4] = buffer[3];
1402 bytes[
sizeof *variable - 5] = buffer[4];
1403 bytes[
sizeof *variable - 6] = buffer[5];
1404 bytes[
sizeof *variable - 7] = buffer[6];
1405 bytes[
sizeof *variable - 8] = buffer[7];
1421 char *bytes =
reinterpret_cast<char *
>(variable);
1423#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1424 bytes[
sizeof *variable - 1] = buffer[0];
1425 bytes[
sizeof *variable - 2] = buffer[1];
1426 bytes[
sizeof *variable - 3] = buffer[2];
1427 bytes[
sizeof *variable - 4] = buffer[3];
1444 bsl::memcpy(buffer, values, numValues);
1449 const signed char *values,
1456 putArrayInt8(buffer,
reinterpret_cast<const char *
>(values), numValues);
1461 const unsigned char *values,
1468 putArrayInt8(buffer,
reinterpret_cast<const char *
>(values), numValues);
1482 bsl::memcpy(variables, buffer, numVariables);
1494 getArrayInt8(
reinterpret_cast<char *
>(variables), buffer, numVariables);
1506 getArrayInt8(
reinterpret_cast<char *
>(variables), buffer, numVariables);
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1762
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bslx_byteinstream.h:377
unsigned long long Uint64
Definition bsls_types.h:137
long long Int64
Definition bsls_types.h:132
Definition bslx_marshallingutil.h:263
static void getArrayFloat64(double *variables, const char *buffer, int numVariables)
static void putArrayInt24(char *buffer, const int *values, int numValues)
static void putInt16(char *buffer, int value)
Definition bslx_marshallingutil.h:949
static void putInt24(char *buffer, int value)
Definition bslx_marshallingutil.h:933
static void putArrayInt48(char *buffer, const bsls::Types::Int64 *values, int numValues)
static void getArrayInt24(int *variables, const char *buffer, int numVariables)
static void putArrayInt56(char *buffer, const bsls::Types::Uint64 *values, int numValues)
static void getUint24(unsigned int *variable, const char *buffer)
Definition bslx_marshallingutil.h:1291
static void getInt56(bsls::Types::Int64 *variable, const char *buffer)
Definition bslx_marshallingutil.h:1072
static void getInt32(int *variable, const char *buffer)
Definition bslx_marshallingutil.h:1222
static void getFloat32(float *variable, const char *buffer)
Definition bslx_marshallingutil.h:1412
static void getArrayUint48(bsls::Types::Uint64 *variables, const char *buffer, int numVariables)
static void getArrayFloat32(float *variables, const char *buffer, int numVariables)
static void putArrayInt64(char *buffer, const bsls::Types::Uint64 *values, int numValues)
static void getUint16(unsigned short *variable, const char *buffer)
Definition bslx_marshallingutil.h:1335
static void getUint64(bsls::Types::Uint64 *variable, const char *buffer)
Definition bslx_marshallingutil.h:1043
static void getInt40(bsls::Types::Int64 *variable, const char *buffer)
Definition bslx_marshallingutil.h:1174
static void getUint56(bsls::Types::Uint64 *variable, const char *buffer)
Definition bslx_marshallingutil.h:1098
static void putArrayFloat64(char *buffer, const double *values, int numValues)
static void putArrayInt32(char *buffer, const int *values, int numValues)
static void getInt64(bsls::Types::Int64 *variable, const char *buffer)
Definition bslx_marshallingutil.h:1014
static void putArrayInt48(char *buffer, const bsls::Types::Uint64 *values, int numValues)
static void putFloat64(char *buffer, double value)
Definition bslx_marshallingutil.h:974
static void putArrayInt8(char *buffer, const char *values, int numValues)
Definition bslx_marshallingutil.h:1436
static void getArrayInt56(bsls::Types::Int64 *variables, const char *buffer, int numVariables)
static void putArrayInt40(char *buffer, const bsls::Types::Int64 *values, int numValues)
@ k_SIZEOF_INT8
Definition bslx_marshallingutil.h:279
@ k_SIZEOF_INT48
Definition bslx_marshallingutil.h:274
@ k_SIZEOF_FLOAT64
Definition bslx_marshallingutil.h:280
@ k_SIZEOF_INT64
Definition bslx_marshallingutil.h:272
@ k_SIZEOF_INT24
Definition bslx_marshallingutil.h:277
@ k_SIZEOF_INT56
Definition bslx_marshallingutil.h:273
@ k_SIZEOF_INT16
Definition bslx_marshallingutil.h:278
@ k_SIZEOF_FLOAT32
Definition bslx_marshallingutil.h:281
@ k_SIZEOF_INT40
Definition bslx_marshallingutil.h:275
@ k_SIZEOF_INT32
Definition bslx_marshallingutil.h:276
static void putFloat32(char *buffer, float value)
Definition bslx_marshallingutil.h:995
static void putArrayInt24(char *buffer, const unsigned int *values, int numValues)
static void getArrayInt32(int *variables, const char *buffer, int numVariables)
static void putArrayInt40(char *buffer, const bsls::Types::Uint64 *values, int numValues)
static void getArrayUint64(bsls::Types::Uint64 *variables, const char *buffer, int numVariables)
static void getArrayInt48(bsls::Types::Int64 *variables, const char *buffer, int numVariables)
static void getArrayInt8(char *variables, const char *buffer, int numVariables)
Definition bslx_marshallingutil.h:1474
static void putInt8(char *buffer, int value)
Definition bslx_marshallingutil.h:964
static void getArrayUint56(bsls::Types::Uint64 *variables, const char *buffer, int numVariables)
static void putArrayInt56(char *buffer, const bsls::Types::Int64 *values, int numValues)
static void putArrayInt32(char *buffer, const unsigned int *values, int numValues)
static void getArrayUint16(unsigned short *variables, const char *buffer, int numVariables)
static void getInt16(short *variable, const char *buffer)
Definition bslx_marshallingutil.h:1312
static void getArrayUint32(unsigned int *variables, const char *buffer, int numVariables)
static void getFloat64(double *variable, const char *buffer)
Definition bslx_marshallingutil.h:1386
static void getArrayInt64(bsls::Types::Int64 *variables, const char *buffer, int numVariables)
static void getUint48(bsls::Types::Uint64 *variable, const char *buffer)
Definition bslx_marshallingutil.h:1149
static void putArrayInt64(char *buffer, const bsls::Types::Int64 *values, int numValues)
static void getInt24(int *variable, const char *buffer)
Definition bslx_marshallingutil.h:1270
static void putInt64(char *buffer, bsls::Types::Int64 value)
Definition bslx_marshallingutil.h:838
static void getArrayInt40(bsls::Types::Int64 *variables, const char *buffer, int numVariables)
static void getArrayInt16(short *variables, const char *buffer, int numVariables)
static void getUint40(bsls::Types::Uint64 *variable, const char *buffer)
Definition bslx_marshallingutil.h:1198
static void putInt32(char *buffer, int value)
Definition bslx_marshallingutil.h:916
static void putArrayInt16(char *buffer, const short *values, int numValues)
static void putArrayFloat32(char *buffer, const float *values, int numValues)
static void putInt56(char *buffer, bsls::Types::Int64 value)
Definition bslx_marshallingutil.h:859
static void putArrayInt16(char *buffer, const unsigned short *values, int numValues)
static void getInt48(bsls::Types::Int64 *variable, const char *buffer)
Definition bslx_marshallingutil.h:1124
static void getUint32(unsigned int *variable, const char *buffer)
Definition bslx_marshallingutil.h:1246
static void getArrayUint40(bsls::Types::Uint64 *variables, const char *buffer, int numVariables)
static void putInt48(char *buffer, bsls::Types::Int64 value)
Definition bslx_marshallingutil.h:879
static void getInt8(char *variable, const char *buffer)
Definition bslx_marshallingutil.h:1357
static void putInt40(char *buffer, bsls::Types::Int64 value)
Definition bslx_marshallingutil.h:898
static void getArrayUint24(unsigned int *variables, const char *buffer, int numVariables)