atlas
Public Member Functions | List of all members
atlas::io::Stream Class Reference

Handle to a shared eckit::DataHandle. More...

#include <Stream.h>

Inheritance diagram for atlas::io::Stream:
Inheritance graph
[legend]

Public Member Functions

 Stream ()=default
 Default constructor. More...
 
 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 &)
 Constructor referencing datahandle, no ownership is taken. More...
 
 Stream (const Stream &)
 Assignment constructor sharing datahandle with other Stream.
 
eckit::DataHandle & datahandle ()
 Access internal eckit::DataHandle.
 
std::uint64_t seek (std::uint64_t offset)
 Move position to given offset.
 
std::uint64_t position ()
 Return offset of current position.
 
std::uint64_t write (const void *data, size_t length)
 Write data of given length (bytes) More...
 
std::uint64_t read (void *data, size_t length)
 Read data of given length (bytes) More...
 
 operator bool () const
 Return true if pointer is valid;.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Stream() [1/2]

atlas::io::Stream::Stream ( )
default

Default constructor.

Postcondition
Stream is not usable but can be assigned to become valid

◆ Stream() [2/2]

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

Constructor referencing datahandle, no ownership is taken.

Note
The usability depends on the usable lifetime of the referenced datahandle

Member Function Documentation

◆ read()

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

Read data of given length (bytes)

Returns
number of bytes read
Postcondition
The position is increased with number of bytes read

◆ write()

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

Write data of given length (bytes)

Returns
number of bytes written
Postcondition
The position is increased with number of bytes written

The documentation for this class was generated from the following files: