openDAQ
Open data acquisition platform
Multi reader
+ Collaboration diagram for Multi reader:

Detailed Description

Classes

struct  IMultiReader
 Reads multiple Signals at once. More...
 
struct  IMultiReaderBuilder
 Builder component of Multi reader objects. Contains setter methods to configure the Multi reader parameters and a build method that builds the Unit object. More...
 
class  MultiReaderBuilderPtr
 Builder component of Multi reader objects. Contains setter methods to configure the Multi reader parameters and a build method that builds the Unit object. More...
 
class  MultiReaderPtr
 Reads multiple Signals at once. More...
 

Functions

daq::MultiReaderStatusPtr read (void *samples, daq::SizeT *count, daq::SizeT timeoutMs=0) const
 Copies at maximum the next count unread samples to the values buffer. The amount actually read is returned through the count parameter. More...
 
daq::MultiReaderStatusPtr readWithDomain (void *samples, void *domain, daq::SizeT *count, daq::SizeT timeoutMs=0) const
 Copies at maximum the next count unread samples and clock-stamps to the samples and domain buffers. The amount actually read is returned through the count parameter. More...
 
daq::MultiReaderStatusPtr skipSamples (daq::SizeT *count) const
 Skips the specified amount of samples. More...
 
daq::RatioPtr getTickResolution () const
 Gets the resolution the reader aligned all the signals to. This is the highest resolution (lowest value) of all the signals to not loose the precision. More...
 
daq::StringPtr getOrigin () const
 Gets the origin the reader aligned all the signals to. This is usually the earliest (lowest value) from all the signals. More...
 
void getOffset (void *domainStart) const
 Gets the domain value (offset) from the aligned origin at the point the reader starts to provide synchronized samples. More...
 
daq::Bool getIsSynchronized () const
 Gets the synchronization status of the reader. More...
 
daq::Int getCommonSampleRate () const
 Gets the common sample rate in case input signal have different rates. The value of common sample rate is such that sample rate of any individual signal can be represented as commonSampleRate / Div, where Div is an integer. Unless the required common sample rate is specified in the MultiReader constructor, common sample rate is lowest common multiple of individual signal's sample rates. The number of samples to be read is specified in common sample rate. More...
 
void setActive (daq::Bool isActive) const
 Sets active or inactive MultiReader state. In inactive state MultiReader will receive only event packets. More...
 
daq::Bool getActive () const
 Gets active or inactive MultiReader state. In inactive state MultiReader will receive only event packets.
 

Function Documentation

◆ getCommonSampleRate()

daq::Int getCommonSampleRate ( ) const
inline

Gets the common sample rate in case input signal have different rates. The value of common sample rate is such that sample rate of any individual signal can be represented as commonSampleRate / Div, where Div is an integer. Unless the required common sample rate is specified in the MultiReader constructor, common sample rate is lowest common multiple of individual signal's sample rates. The number of samples to be read is specified in common sample rate.

Returns
The domain point at which the reader managed to synchronize all the signals.

◆ getIsSynchronized()

daq::Bool getIsSynchronized ( ) const
inline

Gets the synchronization status of the reader.

Returns
True if reader is synchronized, False otherwise.

Reader will try to synchronize the data from the signals when getAvailableCount or any of the read methods is called.

◆ getOffset()

void getOffset ( void *  domainStart) const
inline

Gets the domain value (offset) from the aligned origin at the point the reader starts to provide synchronized samples.

Parameters
domainStartThe domain point at which the reader managed to synchronize all the signals.
Returns
OPENDAQ_SUCCESS if the reader is synchronized, OPENDAQ_IGNORED if the reader is not synchronized.

◆ getOrigin()

daq::StringPtr getOrigin ( ) const
inline

Gets the origin the reader aligned all the signals to. This is usually the earliest (lowest value) from all the signals.

Returns
The origin all signals are aligned to.

◆ getTickResolution()

daq::RatioPtr getTickResolution ( ) const
inline

Gets the resolution the reader aligned all the signals to. This is the highest resolution (lowest value) of all the signals to not loose the precision.

Returns
The aligned resolution used for all read signals.

◆ read()

daq::MultiReaderStatusPtr read ( void *  samples,
daq::SizeT *  count,
daq::SizeT  timeoutMs = 0 
) const
inline

Copies at maximum the next count unread samples to the values buffer. The amount actually read is returned through the count parameter.

Parameters
[in]samplesThe buffer that the samples will be copied to. The buffer must be a contiguous memory big enough to receive count amount of samples. This should be a jagged array (array of pointers to arrays) where the size is equal to the Signal count and each Signal buffer is at least count size long. E.g: reading the next 5 samples of 3 signals samples | ˇ 0 1 2 3 4 5 <– count [0] = [0, 0, 0, 0, 0, 0] [1] = [0, 0, 0, 0, 0, 0] [2] = [0, 0, 0, 0, 0, 0]
[in,out]countThe maximum amount of samples to be read expressed in commonSampleRate. If the count is less than available the parameter value is set to the actual amount and only the available samples are returned. The rest of the buffer is not modified or cleared. In case of different sample rates, the number of read samples may be different for each individual signal.
timeoutMsThe maximum amount of time in milliseconds to wait for the requested amount of samples before returning.
[out]statusRepresents the status of the reader.

◆ readWithDomain()

daq::MultiReaderStatusPtr readWithDomain ( void *  samples,
void *  domain,
daq::SizeT *  count,
daq::SizeT  timeoutMs = 0 
) const
inline

Copies at maximum the next count unread samples and clock-stamps to the samples and domain buffers. The amount actually read is returned through the count parameter.

Parameters
[in]samplesThe buffer that the samples will be copied to. The buffer must be a contiguous memory big enough to receive count amount of samples. This should be a jagged array (array of pointers to arrays) where the size is equal to the Signal count and each Signal buffer is at least count size long. E.g: reading the next 5 samples of 3 signals samples | ˇ 0 1 2 3 4 5 <– count [0] = [0, 0, 0, 0, 0, 0] [1] = [0, 0, 0, 0, 0, 0] [2] = [0, 0, 0, 0, 0, 0]
[in]domainThe buffer that the domain values will be copied to. The buffer must be a contiguous memory big enough to receive count amount of clock-stamps. This should be a jagged array (array of pointers to arrays) where the size is equal to the Signal count and each Signal buffer is at least count size long. E.g: reading the next 5 samples of 3 signals domain | ˇ 0 1 2 3 4 5 <– count [0] = [0, 0, 0, 0, 0, 0] [1] = [0, 0, 0, 0, 0, 0] [2] = [0, 0, 0, 0, 0, 0]
[in,out]countThe maximum amount of samples to be read expressed in commonSampleRate. If the count is less than available the parameter value is set to the actual amount and only the available samples are returned. The rest of the buffer is not modified or cleared. In case of different sample rates, the number of read samples may be different for each individual signal.
timeoutMsThe maximum amount of time in milliseconds to wait for the requested amount of samples before returning.
[out]statusRepresents the status of the reader.

◆ setActive()

void setActive ( daq::Bool  isActive) const
inline

Sets active or inactive MultiReader state. In inactive state MultiReader will receive only event packets.

Parameters
isActiveSet true for the active state.

◆ skipSamples()

daq::MultiReaderStatusPtr skipSamples ( daq::SizeT *  count) const
inline

Skips the specified amount of samples.

Parameters
[in,out]countThe maximum amount of samples to be skipped. If the count is less than available the parameter value is set to the actual amount and only the available samples are skipped. The rest of the buffer is not modified or cleared.
[out]statusRepresents the status of the reader.