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

Detailed Description

Functions

daq::MultiReaderPtr build () const
 Builds and returns a Multi reader object using the currently set values of the Builder. More...
 
MultiReaderBuilderPtr addSignal (const daq::SignalPtr &signal) const
 Adds a signal that will be read by the multi reader. More...
 
MultiReaderBuilderPtr addSignals (const daq::ListPtr< daq::ISignal > &signals) const
 Adds signals that will be read by the multi reader. More...
 
MultiReaderBuilderPtr addInputPort (const daq::InputPortPtr &port) const
 Adds a port that will be read from by the multi reader. More...
 
MultiReaderBuilderPtr addInputPorts (const daq::ListPtr< daq::IInputPort > &ports) const
 Adds ports that will be read from by the multi reader. More...
 
daq::ListPtr< daq::IComponent > getSourceComponents () const
 Gets the list of read components (signals or ports) More...
 
MultiReaderBuilderPtr setValueReadType (daq::SampleType type) const
 Sets the value signal read type. More...
 
daq::SampleType getValueReadType () const
 Gets the value signal read type. More...
 
MultiReaderBuilderPtr setDomainReadType (daq::SampleType type) const
 Sets the domain signal read type. More...
 
daq::SampleType getDomainReadType () const
 Gets the domain signal read type. More...
 
MultiReaderBuilderPtr setReadMode (daq::ReadMode mode) const
 Sets the read mode (Unscaled, Scaled, RawValue) More...
 
daq::ReadMode getReadMode () const
 Gets the read mode (Unscaled, Scaled, RawValue) More...
 
MultiReaderBuilderPtr setReadTimeoutType (daq::ReadTimeoutType type) const
 Sets the read timeout mode. More...
 
daq::ReadTimeoutType getReadTimeoutType () const
 Gets the read timeout mode. More...
 
MultiReaderBuilderPtr setRequiredCommonSampleRate (daq::Int sampleRate) const
 Sets the required common sample rate. More...
 
daq::Int getRequiredCommonSampleRate () const
 Gets the required common sample rate. More...
 
MultiReaderBuilderPtr setStartOnFullUnitOfDomain (daq::Bool enabled) const
 Sets the start on full unit of domain. More...
 
daq::Bool getStartOnFullUnitOfDomain () const
 Gets the start on full unit of domain. More...
 
MultiReaderBuilderPtr setMinReadCount (daq::SizeT minReadCount) const
 Sets the minimal number of samples to read. More...
 
daq::SizeT getMinReadCount () const
 Gets the minimal number of samples to read. More...
 
MultiReaderBuilderPtr setTickOffsetTolerance (const daq::RatioPtr &offsetTolerance) const
 Set maximum distance between signals in fractions of domain unit. More...
 
daq::RatioPtr getTickOffsetTolerance () const
 Get maximum distance between signals in fractions of domain unit. More...
 
MultiReaderBuilderPtr setAllowDifferentSamplingRates (daq::Bool allowDifferentRates) const
 Sets the "AllowDifferentSamplingRates" multi reader parameter. More...
 
daq::Bool getAllowDifferentSamplingRates () const
 Gets the "AllowDifferentSamplingRates" multi reader parameter. More...
 
MultiReaderBuilderPtr setInputPortNotificationMethod (daq::PacketReadyNotification notificationMethod) const
 Sets the notification method of ports created/owned by the multi reader. The default notification method is Unspecified. More...
 
daq::PacketReadyNotification getInputPortNotificationMethod () const
 Gets the notification method of ports created/owned by the multi reader. The default notification method is SameThread. More...
 
MultiReaderBuilderPtr setInputPortNotificationMethods (const daq::ListPtr< daq::PacketReadyNotification > &notificationMethods) const
 Sets the notification methods of ports created/owned by the multi reader. The default notification method is Unspecified. More...
 
daq::ListPtr< daq::PacketReadyNotification > getInputPortNotificationMethods () const
 Gets the notification methods of ports created/owned by the multi reader. The default notification method is Unspecified. More...
 
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

◆ addInputPort()

MultiReaderBuilderPtr addInputPort ( const daq::InputPortPtr &  port) const
inline

Adds a port that will be read from by the multi reader.

Parameters
portThe port that will be read by the multi reader

◆ addInputPorts()

MultiReaderBuilderPtr addInputPorts ( const daq::ListPtr< daq::IInputPort > &  ports) const
inline

Adds ports that will be read from by the multi reader.

Parameters
portsThe ports that will be read by the multi reader

◆ addSignal()

MultiReaderBuilderPtr addSignal ( const daq::SignalPtr &  signal) const
inline

Adds a signal that will be read by the multi reader.

Parameters
signalThe signal that will be read by the multi reader

◆ addSignals()

MultiReaderBuilderPtr addSignals ( const daq::ListPtr< daq::ISignal > &  signals) const
inline

Adds signals that will be read by the multi reader.

Parameters
signalsThe signals that will be read by the multi reader

◆ build()

daq::MultiReaderPtr build ( ) const
inline

Builds and returns a Multi reader object using the currently set values of the Builder.

Returns
The built Multi reader.

◆ getAllowDifferentSamplingRates()

daq::Bool getAllowDifferentSamplingRates ( ) const
inline

Gets the "AllowDifferentSamplingRates" multi reader parameter.

Returns
If set to false, the multi reader will only accept signals with the same sampling rate.

◆ 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.

◆ getDomainReadType()

daq::SampleType getDomainReadType ( ) const
inline

Gets the domain signal read type.

Returns
The domain signal read type

◆ getInputPortNotificationMethod()

daq::PacketReadyNotification getInputPortNotificationMethod ( ) const
inline

Gets the notification method of ports created/owned by the multi reader. The default notification method is SameThread.

Returns
The notification method to be used.

If "Unspecified", the reader keeps the mode of the input port. When building with signals, "Unspecified" is an invalid configuration.

◆ getInputPortNotificationMethods()

daq::ListPtr<daq::PacketReadyNotification> getInputPortNotificationMethods ( ) const
inline

Gets the notification methods of ports created/owned by the multi reader. The default notification method is Unspecified.

Returns
The notification methods to be used.

The list of methods corresponds to the list of reader components (signals, input ports). Both the size and order of both must match if configured. If a method is set to "Unspecified", the reader keeps the mode of the input port. When building with signals, "Unspecified" is an invalid configuration.

◆ 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.

◆ getMinReadCount()

daq::SizeT getMinReadCount ( ) const
inline

Gets the minimal number of samples to read.

Returns
The minimal number of samples to read.

If set, the reader will return 0 for getAvailableCount if less than minReadCount samples are available. It will also never read less than minReadCount samples. The default value is 1.

◆ 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.

◆ getReadMode()

daq::ReadMode getReadMode ( ) const
inline

Gets the read mode (Unscaled, Scaled, RawValue)

Returns
The read mode

◆ getReadTimeoutType()

daq::ReadTimeoutType getReadTimeoutType ( ) const
inline

Gets the read timeout mode.

Returns
The timeout mode. * if "Any" returns immediately if there is available data otherwise time-out is exceeded. * if "All" waiting until timeout and returns available data if existing. otherwise time-out is exceeded.

◆ getRequiredCommonSampleRate()

daq::Int getRequiredCommonSampleRate ( ) const
inline

Gets the required common sample rate.

Returns
The required common sample rate

◆ getSourceComponents()

daq::ListPtr<daq::IComponent> getSourceComponents ( ) const
inline

Gets the list of read components (signals or ports)

Returns
The list of read components

◆ getStartOnFullUnitOfDomain()

daq::Bool getStartOnFullUnitOfDomain ( ) const
inline

Gets the start on full unit of domain.

Returns
enable/disable start on full unit of domain

◆ getTickOffsetTolerance()

daq::RatioPtr getTickOffsetTolerance ( ) const
inline

Get maximum distance between signals in fractions of domain unit.

Parameters
offsetTolerance[out]Ratio that define offset tolerance as a fraction of domain unit.

◆ 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.

◆ getValueReadType()

daq::SampleType getValueReadType ( ) const
inline

Gets the value signal read type.

Returns
The value signal read type

◆ 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.

◆ setAllowDifferentSamplingRates()

MultiReaderBuilderPtr setAllowDifferentSamplingRates ( daq::Bool  allowDifferentRates) const
inline

Sets the "AllowDifferentSamplingRates" multi reader parameter.

Parameters
allowDifferentRatesIf set to false, the multi reader will only accept signals with the same sampling rate.

◆ setDomainReadType()

MultiReaderBuilderPtr setDomainReadType ( daq::SampleType  type) const
inline

Sets the domain signal read type.

Parameters
typeThe domain signal read type

◆ setInputPortNotificationMethod()

MultiReaderBuilderPtr setInputPortNotificationMethod ( daq::PacketReadyNotification  notificationMethod) const
inline

Sets the notification method of ports created/owned by the multi reader. The default notification method is Unspecified.

Parameters
notificationMethodThe notification method to be used.

If "Unspecified", the reader keeps the mode of the input port. When building with signals, "Unspecified" is an invalid configuration.

◆ setInputPortNotificationMethods()

MultiReaderBuilderPtr setInputPortNotificationMethods ( const daq::ListPtr< daq::PacketReadyNotification > &  notificationMethods) const
inline

Sets the notification methods of ports created/owned by the multi reader. The default notification method is Unspecified.

Parameters
notificationMethodsThe notification methods to be used.

The list of methods corresponds to the list of reader components (signals, input ports). Both the size and order of both must match if configured. If a method is set to "Unspecified", the reader keeps the mode of the input port. When building with signals, "Unspecified" is an invalid configuration.

◆ setMinReadCount()

MultiReaderBuilderPtr setMinReadCount ( daq::SizeT  minReadCount) const
inline

Sets the minimal number of samples to read.

Parameters
minReadCountThe minimal number of samples to read.

If set, the reader will return 0 for getAvailableCount if less than minReadCount samples are available. It will also never read less than minReadCount samples. The default value is 1.

◆ setReadMode()

MultiReaderBuilderPtr setReadMode ( daq::ReadMode  mode) const
inline

Sets the read mode (Unscaled, Scaled, RawValue)

Parameters
modeThe read mode

◆ setReadTimeoutType()

MultiReaderBuilderPtr setReadTimeoutType ( daq::ReadTimeoutType  type) const
inline

Sets the read timeout mode.

Parameters
typeThe timeout mode. if "Any" returns immediately if there is available data otherwise time-out is exceeded. if "All" waiting until timeout and returns available data if existing. otherwise time-out is exceeded.

NOTE: THIS IS CURRENTLY IGNORED AND IS ALWAYS SET TO ReadTimeoutType::All

◆ setRequiredCommonSampleRate()

MultiReaderBuilderPtr setRequiredCommonSampleRate ( daq::Int  sampleRate) const
inline

Sets the required common sample rate.

Parameters
sampleRateThe required common sample rate

◆ setStartOnFullUnitOfDomain()

MultiReaderBuilderPtr setStartOnFullUnitOfDomain ( daq::Bool  enabled) const
inline

Sets the start on full unit of domain.

Parameters
enabledenable/disable start on full unit of domain

◆ setTickOffsetTolerance()

MultiReaderBuilderPtr setTickOffsetTolerance ( const daq::RatioPtr &  offsetTolerance) const
inline

Set maximum distance between signals in fractions of domain unit.

Parameters
offsetToleranceRatio that define offset tolerance as a fraction of domain unit.

◆ setValueReadType()

MultiReaderBuilderPtr setValueReadType ( daq::SampleType  type) const
inline

Sets the value signal read type.

Parameters
typeThe value signal read type

◆ 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.