18 StreamReader(std::istream &in) :
29 StreamReader(std::istream *in,
bool owns_stream) :
31 _owns_stream(owns_stream)
70 INLINE std::istream *StreamReader::
88 return (int8_t)_in->get();
96 return (uint8_t)_in->get();
104 int16_t readval, retval;
105 _in->read((
char *)&readval,
sizeof(readval));
116 int32_t readval, retval;
117 _in->read((
char *)&readval,
sizeof(readval));
128 int64_t readval, retval;
129 _in->read((
char *)&readval,
sizeof(readval));
140 uint16_t readval, retval;
141 _in->read((
char *)&readval,
sizeof(readval));
152 uint32_t readval, retval;
153 _in->read((
char *)&readval,
sizeof(readval));
164 uint64_t readval, retval;
165 _in->read((
char *)&readval,
sizeof(readval));
181 nassertr(
sizeof(
float) == 4, 0.0f);
183 float readval, retval;
184 _in->read((
char *)&readval,
sizeof(readval));
195 PN_float64 readval, retval;
196 _in->read((
char *)&readval,
sizeof(readval));
207 int16_t readval, retval;
208 _in->read((
char *)&readval,
sizeof(readval));
209 BigEndian s(&readval, 0,
sizeof(readval));
219 int32_t readval, retval;
220 _in->read((
char *)&readval,
sizeof(readval));
221 BigEndian s(&readval, 0,
sizeof(readval));
231 int64_t readval, retval;
232 _in->read((
char *)&readval,
sizeof(readval));
233 BigEndian s(&readval, 0,
sizeof(readval));
243 uint16_t readval, retval;
244 _in->read((
char *)&readval,
sizeof(readval));
245 BigEndian s(&readval, 0,
sizeof(readval));
255 uint32_t readval, retval;
256 _in->read((
char *)&readval,
sizeof(readval));
257 BigEndian s(&readval, 0,
sizeof(readval));
267 uint64_t readval, retval;
268 _in->read((
char *)&readval,
sizeof(readval));
269 BigEndian s(&readval, 0,
sizeof(readval));
284 nassertr(
sizeof(
float) == 4, 0.0f);
286 float readval, retval;
287 _in->read((
char *)&readval,
sizeof(readval));
288 BigEndian s(&readval, 0,
sizeof(readval));
298 PN_float64 readval, retval;
299 _in->read((
char *)&readval,
sizeof(readval));
300 BigEndian s(&readval, 0,
sizeof(readval));
uint16_t get_uint16()
Extracts an unsigned 16-bit integer.
int64_t get_int64()
Extracts a signed 64-bit integer.
int32_t get_int32()
Extracts a signed 32-bit integer.
int16_t get_be_int16()
Extracts a signed big-endian 16-bit integer.
uint16_t get_be_uint16()
Extracts an unsigned big-endian 16-bit integer.
uint64_t get_uint64()
Extracts an unsigned 64-bit integer.
int32_t get_be_int32()
Extracts a signed big-endian 32-bit integer.
PN_float64 get_be_float64()
Extracts a 64-bit big-endian floating-point number.
int64_t get_be_int64()
Extracts a signed big-endian 64-bit integer.
float get_be_float32()
Extracts a 32-bit single-precision big-endian floating-point number.
uint32_t get_uint32()
Extracts an unsigned 32-bit integer.
NativeNumericData and ReversedNumericData work together to provide a sneaky interface for automatical...
uint32_t get_be_uint32()
Extracts an unsigned big-endian 32-bit integer.
PN_float64 get_float64()
Extracts a 64-bit floating-point number.
float get_float32()
Extracts a 32-bit single-precision floating-point number.
NativeNumericData and ReversedNumericData work together to provide a sneaky interface for automatical...
void store_value(void *dest, size_t length) const
Copies the data, with byte reversal if appropriate, into the indicated numeric variable,...
int16_t get_int16()
Extracts a signed 16-bit integer.
int8_t get_int8()
Extracts a signed 8-bit integer.
void operator=(const StreamReader ©)
The copy constructor does not copy ownership of the stream.
A class to read sequential binary data directly from an istream.
void store_value(void *dest, size_t length) const
Copies the data, with byte reversal if appropriate, into the indicated numeric variable,...
uint8_t get_uint8()
Extracts an unsigned 8-bit integer.
uint64_t get_be_uint64()
Extracts an unsigned big-endian 64-bit integer.
bool get_bool()
Extracts a boolean value.