DynExp
Highly flexible laboratory automation for dynamically changing experiments.
DynExpInstr::DataStreamBase Class Referenceabstract

Base class for all data streams compatible with the data stream instrument's data class DataStreamInstrumentData. More...

+ Inheritance diagram for DynExpInstr::DataStreamBase:

Public Types

using BasicSampleListType = std::vector< BasicSample >
 Type of a list containing data stream samples of type BasicSample. More...
 

Public Member Functions

virtual ~DataStreamBase ()=default
 
bool CanRead () const
 Determines whether the stream contains at least one sample which can be read (i.e. GetStreamSizeRead() returns a value greater than 0). More...
 
void Clear ()
 Removes all samples from the stream's buffer. More...
 
void WriteBasicSample (const BasicSample &Sample)
 Writes a single basic sample to the stream. More...
 
BasicSample ReadBasicSample ()
 Reads a single basic sample from the stream. More...
 
void WriteBasicSamples (const BasicSampleListType &Samples)
 Writes a list of basic sample to the stream. More...
 
BasicSampleListType ReadBasicSamples (size_t Count)
 Reads a list of basic sample from the stream. More...
 

Override

Override by derived classes.

virtual bool IsBasicSampleConvertible () const noexcept
 Determines whether the data stream holds samples which are compatible to BasicSample. More...
 
virtual bool IsBasicSampleTimeUsed () const noexcept
 Determines whether the data stream holds basic samples (IsBasicSampleConvertible() returns true) which contain information in their BasicSample::Time fields. More...
 
virtual void SeekBeg (std::ios_base::openmode Which=std::ios_base::in|std::ios_base::out)=0
 Moves the read/write pointer to the first sample in the stream. More...
 
virtual void SeekEnd (std::ios_base::openmode Which=std::ios_base::in|std::ios_base::out)=0
 Moves the read pointer to the last sample in the stream and/or moves the write pointer after the last written sample in the stream. More...
 
virtual bool SeekEqual (std::ios_base::openmode Which=std::ios_base::in|std::ios_base::out)=0
 Moves the read/write pointer to the respective other one. More...
 
virtual size_t GetStreamSizeRead () const noexcept=0
 Determines the stream's read buffer size in samples. More...
 
virtual size_t GetStreamSizeWrite () const noexcept=0
 Determines the stream's write buffer size in samples. More...
 
virtual size_t GetNumSamplesWritten () const noexcept=0
 Determines the number of samples which have been written to the stream in total. Before overflowing, this function should keep continuing to return the largest possible value. More...
 
virtual void SetStreamSize (size_t BufferSizeInSamples)=0
 Sets the stream size in samples. More...
 
virtual void WriteBasicSampleChild (const BasicSample &Sample)
 Writes a single basic sample to the stream. More...
 
virtual BasicSample ReadBasicSampleChild ()
 Reads a single basic sample from the stream. More...
 
virtual void ClearChild ()=0
 Removes all samples from the stream's buffer. More...
 

Detailed Description

Base class for all data streams compatible with the data stream instrument's data class DataStreamInstrumentData.

Definition at line 115 of file DataStreamInstrument.h.

Member Typedef Documentation

◆ BasicSampleListType

Type of a list containing data stream samples of type BasicSample.

Definition at line 121 of file DataStreamInstrument.h.

Constructor & Destructor Documentation

◆ ~DataStreamBase()

virtual DynExpInstr::DataStreamBase::~DataStreamBase ( )
virtualdefault

Member Function Documentation

◆ CanRead()

bool DynExpInstr::DataStreamBase::CanRead ( ) const
inline

Determines whether the stream contains at least one sample which can be read (i.e. GetStreamSizeRead() returns a value greater than 0).

Returns
Returns true if there is a sample to read, false otherwise.

Definition at line 201 of file DataStreamInstrument.h.

◆ Clear()

void DynExpInstr::DataStreamBase::Clear ( )
inline

Removes all samples from the stream's buffer.

Definition at line 206 of file DataStreamInstrument.h.

◆ ClearChild()

virtual void DynExpInstr::DataStreamBase::ClearChild ( )
privatepure virtual

Removes all samples from the stream's buffer.

Implemented in DynExpInstr::CircularDataStream< SampleT, >, and DynExpInstr::CircularDataStream< BasicSample >.

◆ GetNumSamplesWritten()

virtual size_t DynExpInstr::DataStreamBase::GetNumSamplesWritten ( ) const
pure virtualnoexcept

Determines the number of samples which have been written to the stream in total. Before overflowing, this function should keep continuing to return the largest possible value.

Returns
Total number of samples written to the stream

Implemented in DynExpInstr::CircularDataStream< SampleT, >, and DynExpInstr::CircularDataStream< BasicSample >.

◆ GetStreamSizeRead()

virtual size_t DynExpInstr::DataStreamBase::GetStreamSizeRead ( ) const
pure virtualnoexcept

Determines the stream's read buffer size in samples.

Returns
Read buffer size in samples

Implemented in DynExpInstr::CircularDataStream< SampleT, >, and DynExpInstr::CircularDataStream< BasicSample >.

◆ GetStreamSizeWrite()

virtual size_t DynExpInstr::DataStreamBase::GetStreamSizeWrite ( ) const
pure virtualnoexcept

Determines the stream's write buffer size in samples.

Returns
Write buffer size in samples

Implemented in DynExpInstr::CircularDataStream< SampleT, >, and DynExpInstr::CircularDataStream< BasicSample >.

◆ IsBasicSampleConvertible()

virtual bool DynExpInstr::DataStreamBase::IsBasicSampleConvertible ( ) const
inlinevirtualnoexcept

Determines whether the data stream holds samples which are compatible to BasicSample.

Returns
Return true if the derived data stream's samples can be converted to BasicSample instances, false otherwise.

Reimplemented in DynExpInstr::NumericSampleStream< SampleT, >, and DynExpInstr::BasicSampleStream.

Definition at line 135 of file DataStreamInstrument.h.

◆ IsBasicSampleTimeUsed()

virtual bool DynExpInstr::DataStreamBase::IsBasicSampleTimeUsed ( ) const
inlinevirtualnoexcept

Determines whether the data stream holds basic samples (IsBasicSampleConvertible() returns true) which contain information in their BasicSample::Time fields.

Returns
Return true if the derived data stream's basic samples use the BasicSample::Time variable, false otherwise.

Reimplemented in DynExpInstr::BasicSampleStream.

Definition at line 144 of file DataStreamInstrument.h.

◆ ReadBasicSample()

BasicSample DynExpInstr::DataStreamBase::ReadBasicSample ( )
inline

Reads a single basic sample from the stream.

Returns
Read sample

Definition at line 218 of file DataStreamInstrument.h.

◆ ReadBasicSampleChild()

BasicSample DynExpInstr::DataStreamBase::ReadBasicSampleChild ( )
privatevirtual

Reads a single basic sample from the stream.

Returns
Read sample
Exceptions
Util::NotImplementedExceptionis thrown by the default implementation, which does not do anything more.

Reimplemented in DynExpInstr::NumericSampleStream< SampleT, >, and DynExpInstr::BasicSampleStream.

Definition at line 41 of file DataStreamInstrument.cpp.

◆ ReadBasicSamples()

DataStreamBase::BasicSampleListType DynExpInstr::DataStreamBase::ReadBasicSamples ( size_t  Count)

Reads a list of basic sample from the stream.

Returns
Read samples

Definition at line 23 of file DataStreamInstrument.cpp.

◆ SeekBeg()

virtual void DynExpInstr::DataStreamBase::SeekBeg ( std::ios_base::openmode  Which = std::ios_base::in|std::ios_base::out)
pure virtual

Moves the read/write pointer to the first sample in the stream.

Parameters
WhichCombination of flags std::ios_base::in (read) and std::ios_base::out (write) specifying the pointers to move.

Implemented in DynExpInstr::CircularDataStream< SampleT, >, and DynExpInstr::CircularDataStream< BasicSample >.

◆ SeekEnd()

virtual void DynExpInstr::DataStreamBase::SeekEnd ( std::ios_base::openmode  Which = std::ios_base::in|std::ios_base::out)
pure virtual

Moves the read pointer to the last sample in the stream and/or moves the write pointer after the last written sample in the stream.

Parameters
WhichCombination of flags std::ios_base::in (read) and std::ios_base::out (write) specifying the pointers to move.

Implemented in DynExpInstr::CircularDataStream< SampleT, >, and DynExpInstr::CircularDataStream< BasicSample >.

◆ SeekEqual()

virtual bool DynExpInstr::DataStreamBase::SeekEqual ( std::ios_base::openmode  Which = std::ios_base::in|std::ios_base::out)
pure virtual

Moves the read/write pointer to the respective other one.

Parameters
WhichCombination of flags std::ios_base::in (read) and std::ios_base::out (write) specifying the pointers to move.
Returns
Return true in case of success, false otherwise.

Implemented in DynExpInstr::CircularDataStream< SampleT, >, and DynExpInstr::CircularDataStream< BasicSample >.

◆ SetStreamSize()

virtual void DynExpInstr::DataStreamBase::SetStreamSize ( size_t  BufferSizeInSamples)
pure virtual

Sets the stream size in samples.

Parameters
BufferSizeInSamplesNew stream size in samples

Implemented in DynExpInstr::CircularDataStream< SampleT, >, and DynExpInstr::CircularDataStream< BasicSample >.

◆ WriteBasicSample()

void DynExpInstr::DataStreamBase::WriteBasicSample ( const BasicSample Sample)
inline

Writes a single basic sample to the stream.

Parameters
SampleSample to write

Definition at line 212 of file DataStreamInstrument.h.

◆ WriteBasicSampleChild()

void DynExpInstr::DataStreamBase::WriteBasicSampleChild ( const BasicSample Sample)
privatevirtual

Writes a single basic sample to the stream.

Parameters
SampleSample to write
Exceptions
Util::NotImplementedExceptionis thrown by the default implementation, which does not do anything more.

Reimplemented in DynExpInstr::NumericSampleStream< SampleT, >, and DynExpInstr::BasicSampleStream.

Definition at line 36 of file DataStreamInstrument.cpp.

◆ WriteBasicSamples()

void DynExpInstr::DataStreamBase::WriteBasicSamples ( const BasicSampleListType Samples)

Writes a list of basic sample to the stream.

Parameters
SamplesList of samples to write

Definition at line 17 of file DataStreamInstrument.cpp.


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