8#ifndef INCLUDED_BSLX_INSTREAMFUNCTIONS
9#define INCLUDED_BSLX_INSTREAMFUNCTIONS
522#include <bslscm_version.h>
533#include <bsl_string.h>
534#include <bsl_vector.h>
536#ifndef BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
553namespace InStreamFunctions {
565template <
class STREAM>
573 static STREAM&
getArray(STREAM& stream,
bool *result,
int length);
574 static STREAM&
getArray(STREAM& stream,
char *result,
int length);
575 static STREAM&
getArray(STREAM& stream,
signed char *result,
int length);
576 static STREAM&
getArray(STREAM& stream,
unsigned char *result,
int length);
577 static STREAM&
getArray(STREAM& stream,
short *result,
int length);
578 static STREAM&
getArray(STREAM& stream,
579 unsigned short *result,
581 static STREAM&
getArray(STREAM& stream,
int *result,
int length);
582 static STREAM&
getArray(STREAM& stream,
unsigned int *result,
int length);
583 static STREAM&
getArray(STREAM& stream,
586 static STREAM&
getArray(STREAM& stream,
589 static STREAM&
getArray(STREAM& stream,
float *result,
int length);
590 static STREAM&
getArray(STREAM& stream,
double *result,
int length);
598 template <
class VALUE_TYPE,
class ALLOC>
599 static STREAM&
getArray(STREAM& stream,
644 template <
class STREAM,
class VALUE_TYPE>
646 VALUE_TYPE& variable,
662 template <
class STREAM,
class VALUE_TYPE>
664 VALUE_TYPE& variable,
682 template <
class STREAM,
class VALUE_TYPE>
683 STREAM&
bdexStreamIn(STREAM& stream, VALUE_TYPE& variable);
695 template <
class STREAM,
class VALUE_TYPE>
696 STREAM&
bdexStreamIn(STREAM& stream, VALUE_TYPE& variable,
int version);
708 template <
class STREAM>
709 STREAM&
bdexStreamIn(STREAM& stream,
bool& variable,
int version = 0);
719 template <
class STREAM>
720 STREAM&
bdexStreamIn(STREAM& stream,
char& variable,
int version = 0);
730 template <
class STREAM>
732 signed char& variable,
743 template <
class STREAM>
745 unsigned char& variable,
756 template <
class STREAM>
757 STREAM&
bdexStreamIn(STREAM& stream,
short& variable,
int version = 0);
767 template <
class STREAM>
769 unsigned short& variable,
780 template <
class STREAM>
781 STREAM&
bdexStreamIn(STREAM& stream,
int& variable,
int version = 0);
791 template <
class STREAM>
793 unsigned int& variable,
804 template <
class STREAM>
805 STREAM&
bdexStreamIn(STREAM& stream,
long& variable,
int version = 0);
815 template <
class STREAM>
817 unsigned long& variable,
828 template <
class STREAM>
841 template <
class STREAM>
854 template <
class STREAM>
855 STREAM&
bdexStreamIn(STREAM& stream,
float& variable,
int version = 0);
865 template <
class STREAM>
866 STREAM&
bdexStreamIn(STREAM& stream,
double& variable,
int version = 0);
876 template <
class STREAM>
889 template <
class STREAM,
class ALLOC>
902 template <
class STREAM,
class ALLOC>
915 template <
class STREAM,
class ALLOC>
928 template <
class STREAM,
class ALLOC>
941 template <
class STREAM,
class ALLOC>
954 template <
class STREAM,
class ALLOC>
967 template <
class STREAM,
class ALLOC>
980 template <
class STREAM,
class ALLOC>
993 template <
class STREAM,
class ALLOC>
1006 template <
class STREAM,
class ALLOC>
1019 template <
class STREAM,
class ALLOC>
1035 template <
class STREAM,
class VALUE_TYPE,
class ALLOC>
1049 template <
class STREAM,
class VALUE_TYPE,
class ALLOC>
1064template <
class STREAM>
1071 return stream.getArrayInt8(
reinterpret_cast<char*
>(result), length);
1074template <
class STREAM>
1081 return stream.getArrayInt8(result, length);
1084template <
class STREAM>
1088 signed char *result,
1091 return stream.getArrayInt8(result, length);
1094template <
class STREAM>
1098 unsigned char *result,
1101 return stream.getArrayUint8(result, length);
1104template <
class STREAM>
1111 return stream.getArrayInt16(result, length);
1114template <
class STREAM>
1118 unsigned short *result,
1121 return stream.getArrayUint16(result, length);
1124template <
class STREAM>
1131 return stream.getArrayInt32(result, length);
1134template <
class STREAM>
1138 unsigned int *result,
1141 return stream.getArrayUint32(result, length);
1144template <
class STREAM>
1151 return stream.getArrayInt64(result, length);
1154template <
class STREAM>
1161 return stream.getArrayUint64(result, length);
1164template <
class STREAM>
1171 return stream.getArrayFloat32(result, length);
1174template <
class STREAM>
1181 return stream.getArrayFloat64(result, length);
1184template <
class STREAM>
1185template <
class VALUE_TYPE,
class ALLOC>
1191 stream.getLength(length);
1202 k_INITIAL_ALLOCATION_COUNT = 16 * 1024 * 1024 /
sizeof(VALUE_TYPE)
1205 const int initialLength = length < k_INITIAL_ALLOCATION_COUNT
1207 : k_INITIAL_ALLOCATION_COUNT;
1209 variable.
resize(initialLength);
1215 STREAM& result = getArray(stream, &variable[0], initialLength);
1217 if (!!stream && length > initialLength) {
1219 return getArray(stream,
1220 &variable[initialLength],
1221 length - initialLength);
1232template <
class STREAM,
class VALUE_TYPE>
1235 VALUE_TYPE& variable,
1239 int enumVariable = 0;
1240 stream.getInt32(enumVariable);
1243 variable =
static_cast<VALUE_TYPE
>(enumVariable);
1248template <
class STREAM,
class VALUE_TYPE>
1251 VALUE_TYPE& variable,
1258 return variable.bdexStreamIn(stream, version);
1261template <
class STREAM,
class VALUE_TYPE>
1270 int version = maxSupportedBdexVersion(&variable, 0);
1272 stream.getVersion(version);
1279 return bdexStreamIn(stream, variable, version);
1282template <
class STREAM,
class VALUE_TYPE>
1285 VALUE_TYPE& variable,
1294template <
class STREAM>
1302 stream.getInt8(temp);
1303 variable =
static_cast<bool>(temp);
1308template <
class STREAM>
1314 return stream.getInt8(variable);
1317template <
class STREAM>
1320 signed char& variable,
1323 return stream.getInt8(variable);
1326template <
class STREAM>
1329 unsigned char& variable,
1332 return stream.getUint8(variable);
1335template <
class STREAM>
1341 return stream.getInt16(variable);
1344template <
class STREAM>
1347 unsigned short& variable,
1350 return stream.getUint16(variable);
1353template <
class STREAM>
1359 return stream.getInt32(variable);
1362template <
class STREAM>
1365 unsigned int& variable,
1368 return stream.getUint32(variable);
1371template <
class STREAM>
1378 stream.getInt32(temp);
1383template <
class STREAM>
1386 unsigned long& variable,
1389 unsigned int temp = 0;
1391 stream.getUint32(temp);
1396template <
class STREAM>
1402 return stream.getInt64(variable);
1405template <
class STREAM>
1411 return stream.getUint64(variable);
1414template <
class STREAM>
1420 return stream.getFloat32(variable);
1423template <
class STREAM>
1429 return stream.getFloat64(variable);
1432template <
class STREAM>
1438 return stream.getString(variable);
1441template <
class STREAM,
class ALLOC>
1451template <
class STREAM,
class ALLOC>
1462template <
class STREAM,
class ALLOC>
1473template <
class STREAM,
class ALLOC>
1483template <
class STREAM,
class ALLOC>
1494template <
class STREAM,
class ALLOC>
1504template <
class STREAM,
class ALLOC>
1515template <
class STREAM,
class ALLOC>
1526template <
class STREAM,
class ALLOC>
1537template <
class STREAM,
class ALLOC>
1547template <
class STREAM,
class ALLOC>
1557template <
class STREAM,
class VALUE_TYPE,
class ALLOC>
1564 stream.getVersion(version);
1570 return bdexStreamIn(stream, variable, version);
1573template <
class STREAM,
class VALUE_TYPE,
class ALLOC>
1582 stream.getLength(length);
1594 k_INITIAL_ALLOCATION_COUNT =
1595 16 * 1024 * 1024 /
sizeof(VALUE_TYPE)
1598 const int initialLength = length < k_INITIAL_ALLOCATION_COUNT
1600 : k_INITIAL_ALLOCATION_COUNT;
1602 variable.
resize(initialLength);
1608 for (Iterator it = variable.
begin(); it != variable.
end(); ++it) {
1609 bdexStreamIn(stream, *it, version);
1618 if (length > initialLength) {
1621 for (Iterator it = variable.
begin() + initialLength;
1622 it != variable.
end();
1624 bdexStreamIn(stream, *it, version);
Definition bslstl_string.h:1252
iterator begin() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2866
iterator end() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2874
Definition bslstl_vector.h:1120
VALUE_TYPE * iterator
Definition bslstl_vector.h:1152
void resize(size_type newSize)
Definition bslstl_vector.h:4189
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
STREAM & bdexStreamIn(STREAM &stream, VALUE_TYPE &variable)
Definition bslx_instreamfunctions.h:1263
STREAM & bdexStreamInImp(STREAM &stream, VALUE_TYPE &variable, int version, const IsEnumType &)
Definition bslx_instreamfunctions.h:1234
int maxSupportedBdexVersion(const TYPE *, int versionSelector)
Definition bslx_versionfunctions.h:531
@ k_NO_VERSION
Definition bslx_versionfunctions.h:344
Definition bslx_byteinstream.h:377
Definition bslmf_conditional.h:123
unsigned long long Uint64
Definition bsls_types.h:139
long long Int64
Definition bsls_types.h:134
Definition bslx_instreamfunctions.h:566
static STREAM & getArray(STREAM &stream, bool *result, int length)
Definition bslx_instreamfunctions.h:1066
Definition bslx_instreamfunctions.h:613
Definition bslx_instreamfunctions.h:626