pdal::IStream

class pdal::IStream

Stream wrapper for input of binary data.

Subclassed by pdal::IBeStream, pdal::ILeStream, pdal::ISwitchableStream

Public Functions

inline PDAL_DLL IStream()

Default constructor.

inline PDAL_DLL IStream(const std::string &filename)

Construct an IStream from a filename.

Parameters

filename – File from which to read.

inline PDAL_DLL IStream(std::istream *stream)

Construct an IStream from an input stream pointer.

Parameters

stream – Stream from which to read.

inline PDAL_DLL ~IStream()
inline PDAL_DLL int open (const std::string &filename)

Open a file to extract.

Parameters

filename – Filename.

Returns

-1 if a stream is already assigned, 0 otherwise.

inline PDAL_DLL void close ()

Close the underlying stream.

inline PDAL_DLL operator bool()

Return the state of the stream.

Returns

The state of the underlying stream.

inline PDAL_DLL void seek (std::streampos pos)

Seek to a position in the underlying stream.

Parameters

pos – Position to seek to,

inline PDAL_DLL void seek (std::streampos off, std::ios_base::seekdir way)

Seek to an offset from a specified position.

Parameters
  • off – Offset.

  • way – Absolute position for offset (beg, end or cur)

inline PDAL_DLL void skip (std::streamoff offset)

Skip relative to the current position.

Parameters

offset – Offset from the current position.

inline PDAL_DLL std::streampos position () const

Determine the position of the get pointer.

Returns

Current get position.

inline PDAL_DLL bool good () const

Determine if the underlying stream is good.

Returns

Whether the underlying stream is good.

inline PDAL_DLL std::istream * stream ()

Fetch a pointer to the underlying stream.

Returns

Pointer to the underlying stream.

inline PDAL_DLL void pushStream (std::istream *strm)

Temporarily push a stream to read from.

Parameters

strm – New stream to read from.

inline PDAL_DLL std::istream * popStream ()

Pop the current stream and return it.

The last stream on the stack cannot be popped.

Returns

Pointer to the popped stream.

inline PDAL_DLL void get (std::string &s, size_t size)

Fetch data from the stream into a string.

NOTE - Stops when a null byte is encountered. Use a buffer/vector reader to read data with embedded nulls.

Parameters
  • s – String to fill.

  • size – Maximum number of bytes to extract.

inline PDAL_DLL void get (std::vector< char > &buf)

Fetch data from the stream into a vector of char.

Parameters

buf – Buffer to fill.

inline PDAL_DLL void get (std::vector< unsigned char > &buf)

Fetch data from the stream into a vector of unsigned char.

Parameters

buf – Buffer to fill.

inline PDAL_DLL void get (char *buf, size_t size)

Fetch data from the stream into the specified buffer of char.

Parameters
  • buf – Buffer to fill.

  • size – Number of bytes to extract.

inline PDAL_DLL void get (unsigned char *buf, size_t size)

Fetch data from the stream into the specified buffer of unsigned char.

Parameters
  • buf – Buffer to fill.

  • size – Number of bytes to extract.