atlas::io::Stream class

Handle to a shared eckit::DataHandle.

Note, a Stream is not intended to be opened and closed within atlas::io context The derived classes InputFileStream and OutputFileStream automatically open and close on construction an destruction.

Derived classes

class FileStream

Constructors, destructors, conversion operators

Stream() defaulted
Stream(eckit::DataHandle*)
Constructor taking ownership of datahandle.
Stream(std::shared_ptr<eckit::DataHandle>)
Constructor to share datahandle with a shared_ptr.
Stream(eckit::DataHandle&)
Stream(const Stream&)
Assignment constructor sharing datahandle with other Stream.
operator bool() const
Return true if pointer is valid;.

Public functions

auto datahandle() -> eckit::DataHandle&
Access internal eckit::DataHandle.
auto seek(std::uint64_t offset) -> std::uint64_t
Move position to given offset.
auto position() -> std::uint64_t
Return offset of current position.
auto write(const void* data, size_t length) -> std::uint64_t
auto read(void* data, size_t length) -> std::uint64_t

Function documentation

atlas::io::Stream::Stream() defaulted

Default constructor

atlas::io::Stream::Stream(eckit::DataHandle&)

Constructor referencing datahandle, no ownership is taken

std::uint64_t atlas::io::Stream::write(const void* data, size_t length)

Returns number of bytes written

Write data of given length (bytes)

std::uint64_t atlas::io::Stream::read(void* data, size_t length)

Returns number of bytes read

Read data of given length (bytes)