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__