PLCnext API Documentation 25.0.2.69
Public Member Functions | Static Public Member Functions | List of all members
Arp::Base::Commons::Io::Stream Class Referenceabstract

This abstract class shall be the base class of all stream implementations. More...

#include <Stream.hpp>

Inheritance diagram for Arp::Base::Commons::Io::Stream:
Inheritance graph

Public Member Functions

 Stream (bool canRead=false, bool canWrite=false, bool canSeek=false)
 This constructor is used to constructs a base stream instance. More...
 
 Stream (const Stream &arg)
 Default copy constructor. More...
 
 Stream (Stream &&arg) noexcept
 Default move constructor. More...
 
Streamoperator= (const Stream &arg)
 Default copy-assignment operator. More...
 
Streamoperator= (Stream &&arg) noexcept
 Default move-assignment operator. More...
 
virtual ~Stream (void)
 Default destructor.
 
virtual bool CanRead (void)
 Determines if the derived stream can read. More...
 
virtual bool CanWrite (void)
 Determines if the derived stream can write. More...
 
virtual bool CanSeek (void)
 Determines if the derived stream can seek. More...
 
virtual void SetPosition (size_t value)
 Sets the position of the stream, if it can seek. More...
 
virtual size_t GetPosition (void)
 Gets the position of the stream, if it can seek. More...
 
virtual size_t Seek (size_t offset, SeekOrigin origin)=0
 
virtual size_t Read (byte *pBuffer, size_t bufferSize, size_t bufferOffset, size_t count)=0
 
virtual void Write (const byte *pBuffer, size_t bufferSize, size_t bufferOffset, size_t count)=0
 
virtual void Flush (void)=0
 
virtual byte ReadByte (void)
 Reads a single byte from the stream. More...
 
virtual void WriteByte (byte value)
 Writes a single byte to the stream. More...
 
virtual void WriteTo (Stream &other)
 Writes the data this stream to another stream entirely. More...
 
virtual void ReadFrom (Stream &other)
 Reads the entire data from another stream into this stream. More...
 

Static Public Member Functions

static StreamGetEmpty (void)
 Gets an empty stream. More...
 

Detailed Description

This abstract class shall be the base class of all stream implementations.

Derive from this class to implement a special stream, e.g. FileStream, MemoryStream or SocketStream.

Constructor & Destructor Documentation

◆ Stream() [1/3]

Arp::Base::Commons::Io::Stream::Stream ( bool  canRead = false,
bool  canWrite = false,
bool  canSeek = false 
)

This constructor is used to constructs a base stream instance.

Parameters
canReadSpecifies if the derived stream can read.
canWriteSpecifies if the derived stream can write.
canSeekSpecifies if the derived stream can seek.

◆ Stream() [2/3]

Arp::Base::Commons::Io::Stream::Stream ( const Stream arg)
default

Default copy constructor.

Parameters
argThe argument to copy.

◆ Stream() [3/3]

Arp::Base::Commons::Io::Stream::Stream ( Stream &&  arg)
defaultnoexcept

Default move constructor.

Parameters
argThe argument to move.

Member Function Documentation

◆ CanRead()

bool Arp::Base::Commons::Io::Stream::CanRead ( void  )
virtual

Determines if the derived stream can read.

Returns
true if the derived stream can read, otherwise false.

Reimplemented in Arp::Base::Commons::Io::NullStream, and Arp::System::Commons::Io::NullStream.

◆ CanSeek()

bool Arp::Base::Commons::Io::Stream::CanSeek ( void  )
virtual

Determines if the derived stream can seek.

Returns
true if the derived stream can seek, otherwise false.

Reimplemented in Arp::Base::Commons::Io::NullStream, and Arp::System::Commons::Io::NullStream.

◆ CanWrite()

bool Arp::Base::Commons::Io::Stream::CanWrite ( void  )
virtual

Determines if the derived stream can write.

Returns
true if the derived stream can write, otherwise false.

Reimplemented in Arp::Base::Commons::Io::NullStream, and Arp::System::Commons::Io::NullStream.

◆ Flush()

virtual void Arp::Base::Commons::Io::Stream::Flush ( void  )
pure virtual

◆ GetEmpty()

Stream & Arp::Base::Commons::Io::Stream::GetEmpty ( void  )
static

Gets an empty stream.

Returns
An empty stream of type NullStream.

◆ GetPosition()

size_t Arp::Base::Commons::Io::Stream::GetPosition ( void  )
virtual

Gets the position of the stream, if it can seek.

Parameters
valueThe current position of the stream.
Exceptions
NotSupportedExceptionIf this stream cannot seek.

Reimplemented in Arp::Base::Commons::Io::NullStream, Arp::System::Commons::Io::NullStream, Arp::System::Commons::Io::FileStream, and Arp::System::Commons::Io::MemoryStream.

◆ operator=() [1/2]

Stream & Arp::Base::Commons::Io::Stream::operator= ( const Stream arg)
default

Default copy-assignment operator.

Parameters
argThe argument to copy.
Returns
This instance.

◆ operator=() [2/2]

Stream & Arp::Base::Commons::Io::Stream::operator= ( Stream &&  arg)
defaultnoexcept

Default move-assignment operator.

Parameters
argThe argument to move.
Returns
This instance.

◆ Read()

virtual size_t Arp::Base::Commons::Io::Stream::Read ( byte *  pBuffer,
size_t  bufferSize,
size_t  bufferOffset,
size_t  count 
)
pure virtual

◆ ReadByte()

byte Arp::System::Commons::Io::Stream::ReadByte ( void  )
virtual

Reads a single byte from the stream.

Returns
The read byte.
Exceptions
EndOfStreamExceptionIf this stream is at its end.

Reimplemented in Arp::Base::Commons::Io::NullStream, and Arp::System::Commons::Io::NullStream.

◆ ReadFrom()

void Arp::Base::Commons::Io::Stream::ReadFrom ( Stream other)
virtual

Reads the entire data from another stream into this stream.

Parameters
otherThe other stream to read the entire data from.

Reimplemented in Arp::Base::Commons::Io::NullStream.

◆ Seek()

virtual size_t Arp::Base::Commons::Io::Stream::Seek ( size_t  offset,
SeekOrigin  origin 
)
pure virtual

◆ SetPosition()

void Arp::Base::Commons::Io::Stream::SetPosition ( size_t  value)
virtual

Sets the position of the stream, if it can seek.

Parameters
valueThe new position of the stream.
Exceptions
NotSupportedExceptionIf this stream cannot seek.

Reimplemented in Arp::System::Commons::Io::NullStream, Arp::System::Commons::Io::FileStream, Arp::Base::Commons::Io::NullStream, and Arp::System::Commons::Io::MemoryStream.

◆ Write()

virtual void Arp::Base::Commons::Io::Stream::Write ( const byte *  pBuffer,
size_t  bufferSize,
size_t  bufferOffset,
size_t  count 
)
pure virtual

◆ WriteByte()

void Arp::System::Commons::Io::Stream::WriteByte ( byte  value)
virtual

Writes a single byte to the stream.

Parameters
valueThe byte to write.

Reimplemented in Arp::Base::Commons::Io::NullStream, and Arp::System::Commons::Io::NullStream.

◆ WriteTo()

void Arp::System::Commons::Io::Stream::WriteTo ( Stream other)
virtual

Writes the data this stream to another stream entirely.

Parameters
otherThe other stream to write this stream data to.

Reimplemented in Arp::Base::Commons::Io::NullStream.


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