12 #ifndef __LIDAR_STREAM_H__ 13 #define __LIDAR_STREAM_H__ 18 LT_BEGIN_LIDAR_NAMESPACE
153 size_t read(
void *buf,
size_t nbytes);
163 template<
typename TYPE>
bool get_le(TYPE &value)
165 size_t nbytes = read(&value,
sizeof(TYPE));
167 Endian::swap<sizeof(TYPE)>(&value);
168 return nbytes ==
sizeof(TYPE);
179 template<
typename TYPE>
bool get_be(TYPE &value)
181 size_t nbytes = read(&value,
sizeof(TYPE));
183 Endian::swap<sizeof(TYPE)>(&value);
184 return nbytes ==
sizeof(TYPE);
198 bool get_str(
char *&line,
size_t &length);
237 void close(
bool doFlush =
true);
273 size_t write(
const void *buf,
size_t nbytes);
283 template<
typename TYPE>
bool put_le(TYPE value)
286 Endian::swap<sizeof(TYPE)>(&value);
287 return write(&value,
sizeof(TYPE)) ==
sizeof(TYPE);
298 template<
typename TYPE>
bool put_be(TYPE value)
301 Endian::swap<sizeof(TYPE)>(&value);
302 return write(&value,
sizeof(TYPE)) ==
sizeof(TYPE);
315 bool put_str(
const char *str,
size_t length = static_cast<size_t>(-1));
351 LT_END_LIDAR_NAMESPACE
352 #endif // __LIDAR_STREAM_H__ IO::offset_type offset_type
Integer data type for seek() and tell() offsets.
Stream is the base class for buffered input and output for IO objects.
lt_int64 offset_type
Integer data type for file offsets and sizes.
IO is the base class for binary input and output.
bool get_le(TYPE &value)
Read little endian data.
StreamWriter implements buffered writes to IO objects.
bool put_be(TYPE value)
Write little endian data.
StreamReader implements buffered reads from IO objects.
Location is a helper structure for holding the location of data in a IO object.
IO * getIO()
Get the underlying IO object.
seek from the current location in the file
#define HOST_IS_BIG_ENDIAN
Use this macro when you need to know the host is big endian.
#define HOST_IS_LITTLE_ENDIAN
Use this macro when you need to know the host is little endian.
bool put_le(TYPE value)
Write little endian data.
bool get_be(TYPE &value)
Read big endian data.
seek from the end of the file
seek from the begining of the file