8#ifndef INCLUDED_BSLX_MARSHALLINGUTIL
9#define INCLUDED_BSLX_MARSHALLINGUTIL
244#include <bslscm_version.h>
250#include <bsl_cstring.h>
334 static void putInt32(
char *buffer,
int value);
344 static void putInt24(
char *buffer,
int value);
354 static void putInt16(
char *buffer,
int value);
363 static void putInt8(
char *buffer,
int value);
375 static void putFloat64(
char *buffer,
double value);
385 static void putFloat32(
char *buffer,
float value);
476 static void getInt32(
int *variable,
const char *buffer);
485 static void getUint32(
unsigned int *variable,
const char *buffer);
494 static void getInt24(
int *variable,
const char *buffer);
503 static void getUint24(
unsigned int *variable,
const char *buffer);
512 static void getInt16(
short *variable,
const char *buffer);
521 static void getUint16(
unsigned short *variable,
const char *buffer);
527 static void getInt8(
char *variable,
const char *buffer);
528 static void getInt8(
signed char *variable,
const char *buffer);
529 static void getInt8(
unsigned char *variable,
const char *buffer);
539 static void getFloat64(
double *variable,
const char *buffer);
547 static void getFloat32(
float *variable,
const char *buffer);
618 const unsigned int *values,
632 const unsigned int *values,
646 const unsigned short *values,
659 const signed char *values,
662 const unsigned char *values,
678 const double *values,
938 const char *bytes =
reinterpret_cast<char *
>(&value);
940#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
941 buffer[0] = bytes[7];
942 buffer[1] = bytes[6];
943 buffer[2] = bytes[5];
944 buffer[3] = bytes[4];
945 buffer[4] = bytes[3];
946 buffer[5] = bytes[2];
947 buffer[6] = bytes[1];
948 buffer[7] = bytes[0];
959 const char *bytes =
reinterpret_cast<char *
>(&value);
961#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
962 buffer[0] = bytes[6];
963 buffer[1] = bytes[5];
964 buffer[2] = bytes[4];
965 buffer[3] = bytes[3];
966 buffer[4] = bytes[2];
967 buffer[5] = bytes[1];
968 buffer[6] = bytes[0];
979 const char *bytes =
reinterpret_cast<char *
>(&value);
981#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
982 buffer[0] = bytes[5];
983 buffer[1] = bytes[4];
984 buffer[2] = bytes[3];
985 buffer[3] = bytes[2];
986 buffer[4] = bytes[1];
987 buffer[5] = bytes[0];
998 const char *bytes =
reinterpret_cast<char *
>(&value);
1000#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1001 buffer[0] = bytes[4];
1002 buffer[1] = bytes[3];
1003 buffer[2] = bytes[2];
1004 buffer[3] = bytes[1];
1005 buffer[4] = bytes[0];
1016 const char *bytes =
reinterpret_cast<char *
>(&value);
1018#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1019 buffer[0] = bytes[3];
1020 buffer[1] = bytes[2];
1021 buffer[2] = bytes[1];
1022 buffer[3] = bytes[0];
1033 const char *bytes =
reinterpret_cast<char *
>(&value);
1035#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1036 buffer[0] = bytes[2];
1037 buffer[1] = bytes[1];
1038 buffer[2] = bytes[0];
1049 const char *bytes =
reinterpret_cast<char *
>(&value);
1051#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1052 buffer[0] = bytes[1];
1053 buffer[1] = bytes[0];
1064 *buffer =
static_cast<char>(value);
1074 const char *bytes =
reinterpret_cast<char *
>(&value);
1076#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1077 buffer[0] = bytes[
sizeof value - 1];
1078 buffer[1] = bytes[
sizeof value - 2];
1079 buffer[2] = bytes[
sizeof value - 3];
1080 buffer[3] = bytes[
sizeof value - 4];
1081 buffer[4] = bytes[
sizeof value - 5];
1082 buffer[5] = bytes[
sizeof value - 6];
1083 buffer[6] = bytes[
sizeof value - 7];
1084 buffer[7] = bytes[
sizeof value - 8];
1095 const char *bytes =
reinterpret_cast<char *
>(&value);
1097#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1098 buffer[0] = bytes[
sizeof value - 1];
1099 buffer[1] = bytes[
sizeof value - 2];
1100 buffer[2] = bytes[
sizeof value - 3];
1101 buffer[3] = bytes[
sizeof value - 4];
1117 *variable = 0x80 & buffer[0] ? -1 : 0;
1120 char *bytes =
reinterpret_cast<char *
>(variable);
1122#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1123 bytes[7] = buffer[0];
1124 bytes[6] = buffer[1];
1125 bytes[5] = buffer[2];
1126 bytes[4] = buffer[3];
1127 bytes[3] = buffer[4];
1128 bytes[2] = buffer[5];
1129 bytes[1] = buffer[6];
1130 bytes[0] = buffer[7];
1149 char *bytes =
reinterpret_cast<char *
>(variable);
1151#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1152 bytes[7] = buffer[0];
1153 bytes[6] = buffer[1];
1154 bytes[5] = buffer[2];
1155 bytes[4] = buffer[3];
1156 bytes[3] = buffer[4];
1157 bytes[2] = buffer[5];
1158 bytes[1] = buffer[6];
1159 bytes[0] = buffer[7];
1174 *variable = 0x80 & buffer[0] ? -1 : 0;
1176 char *bytes =
reinterpret_cast<char *
>(variable);
1178#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1179 bytes[6] = buffer[0];
1180 bytes[5] = buffer[1];
1181 bytes[4] = buffer[2];
1182 bytes[3] = buffer[3];
1183 bytes[2] = buffer[4];
1184 bytes[1] = buffer[5];
1185 bytes[0] = buffer[6];
1202 char *bytes =
reinterpret_cast<char *
>(variable);
1204#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1205 bytes[6] = buffer[0];
1206 bytes[5] = buffer[1];
1207 bytes[4] = buffer[2];
1208 bytes[3] = buffer[3];
1209 bytes[2] = buffer[4];
1210 bytes[1] = buffer[5];
1211 bytes[0] = buffer[6];
1226 *variable = 0x80 & buffer[0] ? -1 : 0;
1228 char *bytes =
reinterpret_cast<char *
>(variable);
1230#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1231 bytes[5] = buffer[0];
1232 bytes[4] = buffer[1];
1233 bytes[3] = buffer[2];
1234 bytes[2] = buffer[3];
1235 bytes[1] = buffer[4];
1236 bytes[0] = buffer[5];
1253 char *bytes =
reinterpret_cast<char *
>(variable);
1255#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1256 bytes[5] = buffer[0];
1257 bytes[4] = buffer[1];
1258 bytes[3] = buffer[2];
1259 bytes[2] = buffer[3];
1260 bytes[1] = buffer[4];
1261 bytes[0] = buffer[5];
1276 *variable = 0x80 & buffer[0] ? -1 : 0;
1278 char *bytes =
reinterpret_cast<char *
>(variable);
1280#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1281 bytes[4] = buffer[0];
1282 bytes[3] = buffer[1];
1283 bytes[2] = buffer[2];
1284 bytes[1] = buffer[3];
1285 bytes[0] = buffer[4];
1302 char *bytes =
reinterpret_cast<char *
>(variable);
1304#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1305 bytes[4] = buffer[0];
1306 bytes[3] = buffer[1];
1307 bytes[2] = buffer[2];
1308 bytes[1] = buffer[3];
1309 bytes[0] = buffer[4];
1324 *variable = 0x80 & buffer[0] ? -1 : 0;
1327 char *bytes =
reinterpret_cast<char *
>(variable);
1329#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1330 bytes[3] = buffer[0];
1331 bytes[2] = buffer[1];
1332 bytes[1] = buffer[2];
1333 bytes[0] = buffer[3];
1351 char *bytes =
reinterpret_cast<char *
>(variable);
1353#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1354 bytes[3] = buffer[0];
1355 bytes[2] = buffer[1];
1356 bytes[1] = buffer[2];
1357 bytes[0] = buffer[3];
1371 *variable = 0x80 & buffer[0] ? -1 : 0;
1373 char *bytes =
reinterpret_cast<char *
>(variable);
1375#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1376 bytes[2] = buffer[0];
1377 bytes[1] = buffer[1];
1378 bytes[0] = buffer[2];
1394 char *bytes =
reinterpret_cast<char *
>(variable);
1396#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1397 bytes[2] = buffer[0];
1398 bytes[1] = buffer[1];
1399 bytes[0] = buffer[2];
1414 *variable =
static_cast<short>(0x80 & buffer[0] ? -1 : 0);
1418 char *bytes =
reinterpret_cast<char *
>(variable);
1420#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1421 bytes[1] = buffer[0];
1422 bytes[0] = buffer[1];
1440 char *bytes =
reinterpret_cast<char *
>(variable);
1442#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1443 bytes[1] = buffer[0];
1444 bytes[0] = buffer[1];
1458 *variable = *buffer;
1467 getInt8(
reinterpret_cast<char *
>(variable), buffer);
1476 getInt8(
reinterpret_cast<char *
>(variable), buffer);
1491 char *bytes =
reinterpret_cast<char *
>(variable);
1493#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1494 bytes[
sizeof *variable - 1] = buffer[0];
1495 bytes[
sizeof *variable - 2] = buffer[1];
1496 bytes[
sizeof *variable - 3] = buffer[2];
1497 bytes[
sizeof *variable - 4] = buffer[3];
1498 bytes[
sizeof *variable - 5] = buffer[4];
1499 bytes[
sizeof *variable - 6] = buffer[5];
1500 bytes[
sizeof *variable - 7] = buffer[6];
1501 bytes[
sizeof *variable - 8] = buffer[7];
1517 char *bytes =
reinterpret_cast<char *
>(variable);
1519#if BSLS_PLATFORM_IS_LITTLE_ENDIAN
1520 bytes[
sizeof *variable - 1] = buffer[0];
1521 bytes[
sizeof *variable - 2] = buffer[1];
1522 bytes[
sizeof *variable - 3] = buffer[2];
1523 bytes[
sizeof *variable - 4] = buffer[3];
1540 bsl::memcpy(buffer, values, numValues);
1545 const signed char *values,
1552 putArrayInt8(buffer,
reinterpret_cast<const char *
>(values), numValues);
1557 const unsigned char *values,
1564 putArrayInt8(buffer,
reinterpret_cast<const char *
>(values), numValues);
1578 bsl::memcpy(variables, buffer, numVariables);
1590 getArrayInt8(
reinterpret_cast<char *
>(variables), buffer, numVariables);
1602 getArrayInt8(
reinterpret_cast<char *
>(variables), buffer, numVariables);
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1917
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
Definition bslx_byteinstream.h:377
unsigned long long Uint64
Definition bsls_types.h:139
long long Int64
Definition bsls_types.h:134
Definition bslx_marshallingutil.h:265
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:1045
static void putInt24(char *buffer, int value)
Definition bslx_marshallingutil.h:1029
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:1387
static void getInt56(bsls::Types::Int64 *variable, const char *buffer)
Definition bslx_marshallingutil.h:1168
static void getInt32(int *variable, const char *buffer)
Definition bslx_marshallingutil.h:1318
static void getFloat32(float *variable, const char *buffer)
Definition bslx_marshallingutil.h:1508
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:1431
static void getUint64(bsls::Types::Uint64 *variable, const char *buffer)
Definition bslx_marshallingutil.h:1139
static void getInt40(bsls::Types::Int64 *variable, const char *buffer)
Definition bslx_marshallingutil.h:1270
static void getUint56(bsls::Types::Uint64 *variable, const char *buffer)
Definition bslx_marshallingutil.h:1194
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:1110
static void putArrayInt48(char *buffer, const bsls::Types::Uint64 *values, int numValues)
static void putFloat64(char *buffer, double value)
Definition bslx_marshallingutil.h:1070
static void putArrayInt8(char *buffer, const char *values, int numValues)
Definition bslx_marshallingutil.h:1532
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:281
@ k_SIZEOF_INT48
Definition bslx_marshallingutil.h:276
@ k_SIZEOF_FLOAT64
Definition bslx_marshallingutil.h:282
@ k_SIZEOF_INT64
Definition bslx_marshallingutil.h:274
@ k_SIZEOF_INT24
Definition bslx_marshallingutil.h:279
@ k_SIZEOF_INT56
Definition bslx_marshallingutil.h:275
@ k_SIZEOF_INT16
Definition bslx_marshallingutil.h:280
@ k_SIZEOF_FLOAT32
Definition bslx_marshallingutil.h:283
@ k_SIZEOF_INT40
Definition bslx_marshallingutil.h:277
@ k_SIZEOF_INT32
Definition bslx_marshallingutil.h:278
static void putFloat32(char *buffer, float value)
Definition bslx_marshallingutil.h:1091
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:1570
static void putInt8(char *buffer, int value)
Definition bslx_marshallingutil.h:1060
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:1408
static void getArrayUint32(unsigned int *variables, const char *buffer, int numVariables)
static void getFloat64(double *variable, const char *buffer)
Definition bslx_marshallingutil.h:1482
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:1245
static void putArrayInt64(char *buffer, const bsls::Types::Int64 *values, int numValues)
static void getInt24(int *variable, const char *buffer)
Definition bslx_marshallingutil.h:1366
static void putInt64(char *buffer, bsls::Types::Int64 value)
Definition bslx_marshallingutil.h:934
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:1294
static void putInt32(char *buffer, int value)
Definition bslx_marshallingutil.h:1012
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:955
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:1220
static void getUint32(unsigned int *variable, const char *buffer)
Definition bslx_marshallingutil.h:1342
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:975
static void getInt8(char *variable, const char *buffer)
Definition bslx_marshallingutil.h:1453
static void putInt40(char *buffer, bsls::Types::Int64 value)
Definition bslx_marshallingutil.h:994
static void getArrayUint24(unsigned int *variables, const char *buffer, int numVariables)