8#ifndef INCLUDED_BSLX_INSTREAMFUNCTIONS
9#define INCLUDED_BSLX_INSTREAMFUNCTIONS
516#include <bslscm_version.h>
527#include <bsl_string.h>
528#include <bsl_vector.h>
530#ifndef BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
540namespace InStreamFunctions {
556template <
class STREAM>
564 static STREAM&
getArray(STREAM& stream,
bool *result,
int length);
565 static STREAM&
getArray(STREAM& stream,
char *result,
int length);
566 static STREAM&
getArray(STREAM& stream,
signed char *result,
int length);
567 static STREAM&
getArray(STREAM& stream,
unsigned char *result,
int length);
568 static STREAM&
getArray(STREAM& stream,
short *result,
int length);
569 static STREAM&
getArray(STREAM& stream,
570 unsigned short *result,
572 static STREAM&
getArray(STREAM& stream,
int *result,
int length);
573 static STREAM&
getArray(STREAM& stream,
unsigned int *result,
int length);
574 static STREAM&
getArray(STREAM& stream,
577 static STREAM&
getArray(STREAM& stream,
580 static STREAM&
getArray(STREAM& stream,
float *result,
int length);
581 static STREAM&
getArray(STREAM& stream,
double *result,
int length);
589 template <
class VALUE_TYPE,
class ALLOC>
590 static STREAM&
getArray(STREAM& stream,
630 template <
class STREAM,
class VALUE_TYPE>
632 VALUE_TYPE& variable,
647 template <
class STREAM,
class VALUE_TYPE>
649 VALUE_TYPE& variable,
666 template <
class STREAM,
class VALUE_TYPE>
667 STREAM&
bdexStreamIn(STREAM& stream, VALUE_TYPE& variable);
679 template <
class STREAM,
class VALUE_TYPE>
680 STREAM&
bdexStreamIn(STREAM& stream, VALUE_TYPE& variable,
int version);
692 template <
class STREAM>
693 STREAM&
bdexStreamIn(STREAM& stream,
bool& variable,
int version = 0);
703 template <
class STREAM>
704 STREAM&
bdexStreamIn(STREAM& stream,
char& variable,
int version = 0);
714 template <
class STREAM>
716 signed char& variable,
727 template <
class STREAM>
729 unsigned char& variable,
740 template <
class STREAM>
741 STREAM&
bdexStreamIn(STREAM& stream,
short& variable,
int version = 0);
751 template <
class STREAM>
753 unsigned short& variable,
764 template <
class STREAM>
765 STREAM&
bdexStreamIn(STREAM& stream,
int& variable,
int version = 0);
775 template <
class STREAM>
777 unsigned int& variable,
788 template <
class STREAM>
789 STREAM&
bdexStreamIn(STREAM& stream,
long& variable,
int version = 0);
799 template <
class STREAM>
801 unsigned long& variable,
812 template <
class STREAM>
825 template <
class STREAM>
838 template <
class STREAM>
839 STREAM&
bdexStreamIn(STREAM& stream,
float& variable,
int version = 0);
849 template <
class STREAM>
850 STREAM&
bdexStreamIn(STREAM& stream,
double& variable,
int version = 0);
860 template <
class STREAM>
873 template <
class STREAM,
class ALLOC>
886 template <
class STREAM,
class ALLOC>
899 template <
class STREAM,
class ALLOC>
912 template <
class STREAM,
class ALLOC>
925 template <
class STREAM,
class ALLOC>
938 template <
class STREAM,
class ALLOC>
951 template <
class STREAM,
class ALLOC>
964 template <
class STREAM,
class ALLOC>
977 template <
class STREAM,
class ALLOC>
990 template <
class STREAM,
class ALLOC>
1003 template <
class STREAM,
class ALLOC>
1019 template <
class STREAM,
class VALUE_TYPE,
class ALLOC>
1033 template <
class STREAM,
class VALUE_TYPE,
class ALLOC>
1048template <
class STREAM>
1055 return stream.getArrayInt8(
reinterpret_cast<char*
>(result), length);
1058template <
class STREAM>
1065 return stream.getArrayInt8(result, length);
1068template <
class STREAM>
1072 signed char *result,
1075 return stream.getArrayInt8(result, length);
1078template <
class STREAM>
1082 unsigned char *result,
1085 return stream.getArrayUint8(result, length);
1088template <
class STREAM>
1095 return stream.getArrayInt16(result, length);
1098template <
class STREAM>
1102 unsigned short *result,
1105 return stream.getArrayUint16(result, length);
1108template <
class STREAM>
1115 return stream.getArrayInt32(result, length);
1118template <
class STREAM>
1122 unsigned int *result,
1125 return stream.getArrayUint32(result, length);
1128template <
class STREAM>
1135 return stream.getArrayInt64(result, length);
1138template <
class STREAM>
1145 return stream.getArrayUint64(result, length);
1148template <
class STREAM>
1155 return stream.getArrayFloat32(result, length);
1158template <
class STREAM>
1165 return stream.getArrayFloat64(result, length);
1168template <
class STREAM>
1169template <
class VALUE_TYPE,
class ALLOC>
1175 stream.getLength(length);
1186 k_INITIAL_ALLOCATION_COUNT = 16 * 1024 * 1024 /
sizeof(VALUE_TYPE)
1189 const int initialLength = length < k_INITIAL_ALLOCATION_COUNT
1191 : k_INITIAL_ALLOCATION_COUNT;
1193 variable.
resize(initialLength);
1199 STREAM& result = getArray(stream, &variable[0], initialLength);
1201 if (!!stream && length > initialLength) {
1203 return getArray(stream,
1204 &variable[initialLength],
1205 length - initialLength);
1216template <
class STREAM,
class VALUE_TYPE>
1219 VALUE_TYPE& variable,
1223 int enumVariable = 0;
1224 stream.getInt32(enumVariable);
1227 variable =
static_cast<VALUE_TYPE
>(enumVariable);
1232template <
class STREAM,
class VALUE_TYPE>
1235 VALUE_TYPE& variable,
1242 return variable.bdexStreamIn(stream, version);
1245template <
class STREAM,
class VALUE_TYPE>
1254 int version = maxSupportedBdexVersion(&variable, 0);
1256 stream.getVersion(version);
1263 return bdexStreamIn(stream, variable, version);
1266template <
class STREAM,
class VALUE_TYPE>
1269 VALUE_TYPE& variable,
1278template <
class STREAM>
1286 stream.getInt8(temp);
1287 variable =
static_cast<bool>(temp);
1292template <
class STREAM>
1298 return stream.getInt8(variable);
1301template <
class STREAM>
1304 signed char& variable,
1307 return stream.getInt8(variable);
1310template <
class STREAM>
1313 unsigned char& variable,
1316 return stream.getUint8(variable);
1319template <
class STREAM>
1325 return stream.getInt16(variable);
1328template <
class STREAM>
1331 unsigned short& variable,
1334 return stream.getUint16(variable);
1337template <
class STREAM>
1343 return stream.getInt32(variable);
1346template <
class STREAM>
1349 unsigned int& variable,
1352 return stream.getUint32(variable);
1355template <
class STREAM>
1362 stream.getInt32(temp);
1367template <
class STREAM>
1370 unsigned long& variable,
1373 unsigned int temp = 0;
1375 stream.getUint32(temp);
1380template <
class STREAM>
1386 return stream.getInt64(variable);
1389template <
class STREAM>
1395 return stream.getUint64(variable);
1398template <
class STREAM>
1404 return stream.getFloat32(variable);
1407template <
class STREAM>
1413 return stream.getFloat64(variable);
1416template <
class STREAM>
1422 return stream.getString(variable);
1425template <
class STREAM,
class ALLOC>
1435template <
class STREAM,
class ALLOC>
1446template <
class STREAM,
class ALLOC>
1457template <
class STREAM,
class ALLOC>
1467template <
class STREAM,
class ALLOC>
1478template <
class STREAM,
class ALLOC>
1488template <
class STREAM,
class ALLOC>
1499template <
class STREAM,
class ALLOC>
1510template <
class STREAM,
class ALLOC>
1521template <
class STREAM,
class ALLOC>
1531template <
class STREAM,
class ALLOC>
1541template <
class STREAM,
class VALUE_TYPE,
class ALLOC>
1548 stream.getVersion(version);
1554 return bdexStreamIn(stream, variable, version);
1557template <
class STREAM,
class VALUE_TYPE,
class ALLOC>
1566 stream.getLength(length);
1578 k_INITIAL_ALLOCATION_COUNT =
1579 16 * 1024 * 1024 /
sizeof(VALUE_TYPE)
1582 const int initialLength = length < k_INITIAL_ALLOCATION_COUNT
1584 : k_INITIAL_ALLOCATION_COUNT;
1586 variable.
resize(initialLength);
1592 for (Iterator it = variable.
begin(); it != variable.
end(); ++it) {
1593 bdexStreamIn(stream, *it, version);
1602 if (length > initialLength) {
1605 for (Iterator it = variable.
begin() + initialLength;
1606 it != variable.
end();
1608 bdexStreamIn(stream, *it, version);
Definition bslstl_string.h:1281
iterator begin() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2511
iterator end() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2519
Definition bslstl_vector.h:1025
VALUE_TYPE * iterator
Definition bslstl_vector.h:1057
void resize(size_type newSize)
Definition bslstl_vector.h:3616
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
STREAM & bdexStreamIn(STREAM &stream, VALUE_TYPE &variable)
Definition bslx_instreamfunctions.h:1247
STREAM & bdexStreamInImp(STREAM &stream, VALUE_TYPE &variable, int version, const IsEnumType &)
Definition bslx_instreamfunctions.h:1218
int maxSupportedBdexVersion(const TYPE *, int versionSelector)
Definition bslx_versionfunctions.h:519
@ k_NO_VERSION
Definition bslx_versionfunctions.h:334
Definition bslx_byteinstream.h:377
Definition bslmf_conditional.h:120
unsigned long long Uint64
Definition bsls_types.h:137
long long Int64
Definition bsls_types.h:132
Definition bslx_instreamfunctions.h:557
static STREAM & getArray(STREAM &stream, bool *result, int length)
Definition bslx_instreamfunctions.h:1050
Definition bslx_instreamfunctions.h:602
Definition bslx_instreamfunctions.h:613