DUECA/DUSIME
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dueca::DataReader< T, S > Class Template Reference

Lightweight class for accessing data in a channel. More...

#include <DataReader.hxx>

Inheritance diagram for dueca::DataReader< T, S >:
Inheritance graph
[legend]
Collaboration diagram for dueca::DataReader< T, S >:
Collaboration graph
[legend]

Public Member Functions

 DataReader (ChannelReadToken &token, const DataTimeSpec &ts)
 Constructor. More...
 
 DataReader (ChannelReadToken &token, const TimeSpec &ts)
 Constructor with TimeSpec. More...
 
 DataReader (ChannelReadToken &token, TimeTickType ts=MAX_TIMETICK)
 Constructor with time tick. More...
 
const T & data ()
 Access to the data. More...
 
const DataTimeSpectimeSpec ()
 Return the time specification of the data.
 
const GlobalIdorigin ()
 Return the origin.
 
 ~DataReader ()
 Destructor. More...
 

Additional Inherited Members

- Protected Member Functions inherited from dueca::DataReaderBase
 DataReaderBase (ChannelReadToken &token, const DataTimeSpec &t_request)
 Constructor.
 
- Protected Attributes inherited from dueca::DataReaderBase
ChannelReadTokentoken
 Reference to the channel access token.
 
DataTimeSpec t_request
 Time span or point requested.
 
DataTimeSpec ts_data
 Time specification as realised.
 
GlobalId data_origin
 Data origin.
 
bool firstaccess
 First access flag.
 

Detailed Description

template<class T, template< class > class S = MatchIntervalStart>
class dueca::DataReader< T, S >

Lightweight class for accessing data in a channel.

The DataReader accesses the data in a channel. These objects should be created on the stack, and when they go out of scope, the access to the channel is released again.

Example:

{
DataReader<MyData> r(r_mydata, ts);
cout << r.data() << endl;
} // out of scope, access to data in channel released again
Lightweight class for accessing data in a channel.
Definition: DataReader.hxx:381

Parameters:

Template Parameters
TClass of the data to be read.
SData time selector.

Typical data time selectors are:

MatchIntervalStart. Data is read that matches the start of the time specification interval. When reading all datapoints (with Channel::ReadAllData, Channel::ReadReservation, or Channel::AdaptEventStream in combination with Channel::Events), older data is also returned.

MatchIntervalStartOrEarlier. If data is not available for the requested time, but older data is available, then that older data is returned.

VirtualJoin. Produces a combined reading of all entries in a channel, typically only selected for event data. Note that it might be necessary for channels with many entries and a higher frequency of data writing, to repeatedly try reading to prevent data buildup in the channel.

Constructor & Destructor Documentation

◆ DataReader() [1/3]

template<class T , template< class > class S = MatchIntervalStart>
dueca::DataReader< T, S >::DataReader ( ChannelReadToken token,
const DataTimeSpec ts 
)
inline

Constructor.

Note that these objects are light-weight, and meant to be constructed (on the stack) and discarded.

Parameters
tokenRead token
tsTime specification. Exact interpretation depends on the S template parameter.

◆ DataReader() [2/3]

template<class T , template< class > class S = MatchIntervalStart>
dueca::DataReader< T, S >::DataReader ( ChannelReadToken token,
const TimeSpec ts 
)
inline

Constructor with TimeSpec.

Parameters
tokenRead token.
tsTime specification. Accessed data point will not be newer than ts.getValidityStart()

◆ DataReader() [3/3]

template<class T , template< class > class S = MatchIntervalStart>
dueca::DataReader< T, S >::DataReader ( ChannelReadToken token,
TimeTickType  ts = MAX_TIMETICK 
)
inline

Constructor with time tick.

Parameters
tokenRead token.
tsTime tick. Accessed data point will not be newer than the tick. Note that the default (not specifying this parameter) simply gives you the latest data in the channel, if JumpToMatchTime is selected for the read token.

◆ ~DataReader()

template<class T , template< class > class S = MatchIntervalStart>
dueca::DataReader< T, S >::~DataReader ( )
inline

Destructor.

Releases the access again with a token.

Member Function Documentation

◆ data()

template<class T , template< class > class S = MatchIntervalStart>
const T & dueca::DataReader< T, S >::data ( )
inline

Access to the data.

Note that the constructors are lazy. The getAccess() call will perform the actual access.


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