pdal::Extractor

class pdal::Extractor

Buffer wrapper for input of binary data from a buffer.

Subclassed by pdal::BeExtractor, pdal::LeExtractor, pdal::SwitchableExtractor

Public Functions

inline Extractor(const char *buf, std::size_t size)

Construct an extractor to operate on a buffer.

Parameters
  • buf – Buffer to extract from.

  • size – Buffer size.

inline operator bool()

Determine if the buffer is good.

Returns

Whether the buffer is good.

inline void seek(std::size_t pos)

Seek to a position in the buffer.

Parameters

pos – Position to seek in buffer.

inline void skip(std::size_t cnt)

Advance buffer position.

Parameters

cnt – Number of bytes to skip in buffer.

inline size_t position() const

Return the get position of buffer.

Returns

Get position.

inline bool good() const

Determine whether the extractor is good (the get pointer is in the buffer).

Returns

Whether the get pointer is valid.

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

Extract a string of a particular size from the buffer.

Trim trailing null bytes.

Parameters
  • s – String to extract to.

  • size – Number of bytes to extract from buffer into string.

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

Extract data to char vector.

Vector must be sized to indicate number of bytes to extract.

Parameters

buf – Vector to which bytes should be extracted.

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

Extract data to unsigned char vector.

Vector must be sized to indicate number of bytes to extract.

Parameters

buf – Vector to which bytes should be extracted.

inline void get(char *buf, size_t size)

Extract data into a provided buffer.

Parameters
  • buf – Pointer to buffer to which bytes should be extracted.

  • size – Number of bytes to extract.

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

Extract data into a provided unsigned buffer.

Parameters
  • buf – Pointer to buffer to which bytes should be extracted.

  • size – Number of bytes to extract.

virtual Extractor &operator>>(uint8_t &v) = 0
virtual Extractor &operator>>(int8_t &v) = 0
virtual Extractor &operator>>(uint16_t &v) = 0
virtual Extractor &operator>>(int16_t &v) = 0
virtual Extractor &operator>>(uint32_t &v) = 0
virtual Extractor &operator>>(int32_t &v) = 0
virtual Extractor &operator>>(uint64_t &v) = 0
virtual Extractor &operator>>(int64_t &v) = 0
virtual Extractor &operator>>(float &v) = 0
virtual Extractor &operator>>(double &v) = 0