pdal::IStream

class pdal::IStream

Stream wrapper for input of binary data.

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

Public Functions

PDAL_DLL IStream()

Default constructor.

PDAL_DLL IStream(const std::string &filename)

Construct an IStream from a filename.

Parameters
  • filename: File from which to read.

PDAL_DLL IStream(std::istream *stream)

Construct an IStream from an input stream pointer.

Parameters
  • stream: Stream from which to read.

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

Open a file to extract.

Return
-1 if a stream is already assigned, 0 otherwise.
Parameters
  • filename: Filename.

PDAL_DLL void pdal::IStream::close()

Close the underlying stream.

PDAL_DLL operator bool()

Return the state of the stream.

Return
The state of the underlying stream.

PDAL_DLL void pdal::IStream::seek(std::streampos pos)

Seek to a position in the underlying stream.

Parameters
  • pos: Position to seek to,

PDAL_DLL void pdal::IStream::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)

PDAL_DLL void pdal::IStream::skip(std::streamoff offset)

Skip relative to the current position.

Parameters
  • offset: Offset from the current position.

PDAL_DLL std::streampos pdal::IStream::position() const

Determine the position of the get pointer.

Return
Current get position.

PDAL_DLL bool pdal::IStream::good() const

Determine if the underlying stream is good.

Return
Whether the underlying stream is good.

PDAL_DLL std::istream* pdal::IStream::stream()

Fetch a pointer to the underlying stream.

Return
Pointer to the underlying stream.

PDAL_DLL void pdal::IStream::pushStream(std::istream * strm)

Temporarily push a stream to read from.

Parameters
  • strm: New stream to read from.

PDAL_DLL std::istream* pdal::IStream::popStream()

Pop the current stream and return it.

The last stream on the stack cannot be popped.

Return
Pointer to the popped stream.

PDAL_DLL void pdal::IStream::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.

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

Fetch data from the stream into a vector of char.

Parameters
  • buf: Buffer to fill.

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

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

Parameters
  • buf: Buffer to fill.

PDAL_DLL void pdal::IStream::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.

PDAL_DLL void pdal::IStream::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.