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

This is a facilitator for writing multi-stream data. More...

#include <DataWriter.hxx>

Inheritance diagram for dueca::DataWriter< T >:
Inheritance graph
[legend]
Collaboration diagram for dueca::DataWriter< T >:
Collaboration graph
[legend]

Public Member Functions

 DataWriter (ChannelWriteToken &token, const TimeSpec &ts)
 Constructor.
 
 DataWriter (ChannelWriteToken &token, const DataTimeSpec &ts)
 Constructor.
 
 DataWriter (ChannelWriteToken &token, const TimeTickType ts=SimTime::getTimeTick())
 Constructor with tick.
 
template<typename N1 >
 DataWriter (ChannelWriteToken &token, const TimeSpec &ts, N1 n1)
 Constructor.
 
template<typename N1 >
 DataWriter (ChannelWriteToken &token, const DataTimeSpec &ts, N1 n1)
 Constructor.
 
template<typename N1 >
 DataWriter (ChannelWriteToken &token, const TimeTickType &ts, N1 n1)
 Constructor.
 
template<typename N1 , typename N2 >
 DataWriter (ChannelWriteToken &token, const TimeSpec &ts, N1 n1, N2 n2)
 Constructor.
 
template<typename N1 , typename N2 >
 DataWriter (ChannelWriteToken &token, const DataTimeSpec &ts, N1 n1, N2 n2)
 Constructor.
 
template<typename N1 , typename N2 >
 DataWriter (ChannelWriteToken &token, const TimeTickType &ts, N1 n1, N2 n2)
 Constructor.
 
template<typename N1 , typename N2 , typename N3 >
 DataWriter (ChannelWriteToken &token, const TimeSpec &ts, N1 n1, N2 n2, N3 n3)
 Constructor.
 
template<typename N1 , typename N2 , typename N3 >
 DataWriter (ChannelWriteToken &token, const DataTimeSpec &ts, N1 n1, N2 n2, N3 n3)
 Constructor.
 
template<typename N1 , typename N2 , typename N3 >
 DataWriter (ChannelWriteToken &token, const TimeTickType &ts, N1 n1, N2 n2, N3 n3)
 Constructor.
 
Tdata ()
 Access the data in the channel, returns a reference to the data.
 
 ~DataWriter ()
 Destructor.
 

Additional Inherited Members

- Protected Member Functions inherited from dueca::DataWriterBase
 DataWriterBase (ChannelWriteToken &token, const DataTimeSpec &ts)
 Constructor.
 
void releaseAccess (void *data_ptr)
 Releasing the read access means that the data will be made accessible for reading.
 
void baseCheckAccess (uint32_t magic)
 Verify the magic number and validity for access.
 
- Protected Attributes inherited from dueca::DataWriterBase
ChannelWriteTokentoken
 Access to the channel.
 
DataTimeSpec ts
 Time specification to be used.
 

Detailed Description

template<class T>
class dueca::DataWriter< T >

This is a facilitator for writing multi-stream data.

By creating a "DataWriter", the access token is used to gain access to the data in the channel. When at the end of scope the DataWriter is destroyed, the access is released again, and the actual data is sent.

An example, suppose you have created a ChannelWriteToken for a channel with MyData objects:

// it is good practice to start with an opening braket. This
// starts a new variable scope
{
// create the writer
// put the proper data in
w.data().a = some_value;
// etc. Note that you get cryptic error messages if you forget
// that data() is a function, and type "w.data.a"
} // <-- This closing bracket ends the "scope", in which
// DataWriter<MyData> w was created. That means that at this
// point the destructor is called. The destructor actually sends
// the data over the channel.
const T & data()
Access to the data.
Definition DataReader.hxx:456
DataTimeSpec ts
Time specification to be used.
Definition DataWriter.hxx:32
This is a "light weight object" that enables you to read the latest set of data on a StreamChannelEnd...
Definition StreamReaderLatest.hxx:43

The DataWriter template, which will create an object for your modification, but always starts from clean, blank objects. Note that you should provide a proper definition of what is default when you write the .dco file defining your data type.

If you rather update an object you had previously sent, you can use the DataUpdater template. Note that the DataUpdater does not work for initialisation of array sizes.

Constructor & Destructor Documentation

◆ DataWriter() [1/12]

template<class T >
dueca::DataWriter< T >::DataWriter ( ChannelWriteToken & token,
const TimeSpec & ts )
inline

Constructor.

Gains access to the channel for which the token was made.

Parameters
tokenWrite access token.
tsTime specification. The specification is used, to define the new data validity span, or only the start time is used if the token has been opened with Channel::Events for time aspect.

◆ DataWriter() [2/12]

template<class T >
dueca::DataWriter< T >::DataWriter ( ChannelWriteToken & token,
const DataTimeSpec & ts )
inline

Constructor.

Gains access to the channel for which the token was made.

Parameters
tokenWrite access token.
tsTime specification.

◆ DataWriter() [3/12]

template<class T >
dueca::DataWriter< T >::DataWriter ( ChannelWriteToken & token,
const TimeTickType ts = SimTime::getTimeTick() )
inline

Constructor with tick.

Gains access to the channel for which the token was made.

Note that this does not make sense with stream data, only for event data!

Parameters
tokenWrite access token.
tsTime tick/moment.

◆ DataWriter() [4/12]

template<class T >
template<typename N1 >
dueca::DataWriter< T >::DataWriter ( ChannelWriteToken & token,
const TimeSpec & ts,
N1 n1 )
inline

Constructor.

Gains access to the channel for which the token was made, for initializing objects with one parameter, e.g. a variable-sized array.

Parameters
tokenWrite access token.
tsTime specification.
n1First parameter passed to the constructor of the written object

◆ DataWriter() [5/12]

template<class T >
template<typename N1 >
dueca::DataWriter< T >::DataWriter ( ChannelWriteToken & token,
const DataTimeSpec & ts,
N1 n1 )
inline

Constructor.

Gains access to the channel for which the token was made, for initializing objects with one parameter, e.g. a variable-sized array.

Parameters
tokenWrite access token.
tsTime specification.
n1First parameter passed to the constructor of the written object

◆ DataWriter() [6/12]

template<class T >
template<typename N1 >
dueca::DataWriter< T >::DataWriter ( ChannelWriteToken & token,
const TimeTickType & ts,
N1 n1 )
inline

Constructor.

Gains access to the channel for which the token was made, for initializing objects with one parameter, e.g. a variable-sized array.

Note that using only a tick does not make sense with stream data, only use for event data!

Parameters
tokenWrite access token.
tsTime tick/moment.
n1First parameter passed to the constructor of the written object

◆ DataWriter() [7/12]

template<class T >
template<typename N1 , typename N2 >
dueca::DataWriter< T >::DataWriter ( ChannelWriteToken & token,
const TimeSpec & ts,
N1 n1,
N2 n2 )
inline

Constructor.

Gains access to the channel for which the token was made, for initializing objects with two parameters.

Parameters
tokenWrite access token.
tsTime specification.
n1First parameter passed to the constructor of the written object
n2Second parameter passed to the constructor of the written object

◆ DataWriter() [8/12]

template<class T >
template<typename N1 , typename N2 >
dueca::DataWriter< T >::DataWriter ( ChannelWriteToken & token,
const DataTimeSpec & ts,
N1 n1,
N2 n2 )
inline

Constructor.

Gains access to the channel for which the token was made, for initializing objects with two parameters.

Parameters
tokenWrite access token.
tsTime specification.
n1First parameter passed to the constructor of the written object
n2Second parameter passed to the constructor of the written object

◆ DataWriter() [9/12]

template<class T >
template<typename N1 , typename N2 >
dueca::DataWriter< T >::DataWriter ( ChannelWriteToken & token,
const TimeTickType & ts,
N1 n1,
N2 n2 )
inline

Constructor.

Gains access to the channel for which the token was made, for initializing objects with two parameters.

Note that using only a tick does not make sense with stream data, only use for event data!

Parameters
tokenWrite access token.
tsTime tick/moment.
n1First parameter passed to the constructor of the written object
n2Second parameter passed to the constructor of the written object

◆ DataWriter() [10/12]

template<class T >
template<typename N1 , typename N2 , typename N3 >
dueca::DataWriter< T >::DataWriter ( ChannelWriteToken & token,
const TimeSpec & ts,
N1 n1,
N2 n2,
N3 n3 )
inline

Constructor.

Gains access to the channel for which the token was made, for initializing objects with three parameters

Parameters
tokenWrite access token.
tsTime specification.
n1First parameter passed to the constructor of the written object
n2Second parameter passed to the constructor of the written object
n3Third parameter passed to the constructor of the written object

◆ DataWriter() [11/12]

template<class T >
template<typename N1 , typename N2 , typename N3 >
dueca::DataWriter< T >::DataWriter ( ChannelWriteToken & token,
const DataTimeSpec & ts,
N1 n1,
N2 n2,
N3 n3 )
inline

Constructor.

Gains access to the channel for which the token was made, for initializing objects with three parameters

Parameters
tokenWrite access token.
tsTime specification.
n1First parameter passed to the constructor of the written object
n2Second parameter passed to the constructor of the written object
n3Third parameter passed to the constructor of the written object

◆ DataWriter() [12/12]

template<class T >
template<typename N1 , typename N2 , typename N3 >
dueca::DataWriter< T >::DataWriter ( ChannelWriteToken & token,
const TimeTickType & ts,
N1 n1,
N2 n2,
N3 n3 )
inline

Constructor.

Gains access to the channel for which the token was made, for initializing objects with three parameters

Note that using only a tick does not make sense with stream data, only use for event data!

Parameters
tokenWrite access token.
tsTime tick/moment.
n1First parameter passed to the constructor of the written object
n2Second parameter passed to the constructor of the written object
n3Third parameter passed to the constructor of the written object

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