pdal::IStream

class IStream

Stream wrapper for input of binary data.

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

Public Functions

inline IStream()

Default constructor.

inline IStream(const std::string &filename)

Construct an IStream from a filename.

Parameters:

filename – File from which to read.

inline IStream(std::istream *stream)

Construct an IStream from an input stream pointer.

Parameters:

stream – Stream from which to read.

inline ~IStream()
inline 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 void close()

Close the underlying stream.

inline operator bool()

Return the state of the stream.

Returns:

The state of the underlying stream.

inline void seek(std::streampos pos)

Seek to a position in the underlying stream.

Parameters:

pos – Position to seek to,

inline 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 void skip(std::streamoff offset)

Skip relative to the current position.

Parameters:

offset – Offset from the current position.

inline std::streampos position() const

Determine the position of the get pointer.

Returns:

Current get position.

inline bool good() const

Determine if the underlying stream is good.

Returns:

Whether the underlying stream is good.

inline std::istream *stream()

Fetch a pointer to the underlying stream.

Returns:

Pointer to the underlying stream.

inline void pushStream(std::istream *strm)

Temporarily push a stream to read from.

Parameters:

strm – New stream to read from.

inline 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 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 void get(std::vector<char> &buf)

Fetch data from the stream into a vector of char.

Parameters:

buf – Buffer to fill.

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

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

Parameters:

buf – Buffer to fill.

inline 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 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.