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

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

#include <MultiStreamWriter.hxx>

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

Public Member Functions

 MultiStreamWriter (MultiStreamWriteToken< T > &token, const TimeSpec &ts)
 Constructor.
 
 ~MultiStreamWriter ()
 Destructor.
 
bool ok ()
 Check that the stream writing is OK.
 
- Public Member Functions inherited from dueca::DataWriter< T >
 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::MultiStreamWriter< T >

This is a facilitator for writing multi-stream data.

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

An example, suppose you have created a MultiStreamChannelWriteToken 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
// MultiStreamWriter<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

MultiStream channels work differently from Event and Stream channels, in that the data written there is persistent. The next time you create a MultiStreamWriter on a channel, the data you had written before is present (and readable) in the Writer. If you want, you can limit yourself to only writing the changes.

Constructor & Destructor Documentation

◆ MultiStreamWriter()

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

Constructor.

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

Parameters
tokenRead access token.
tsTime specification.

◆ ~MultiStreamWriter()

template<class T >
dueca::MultiStreamWriter< T >::~MultiStreamWriter ( )
inline

Destructor.

Releases the access again with a token.

Member Function Documentation

◆ ok()

template<class T >
bool dueca::MultiStreamWriter< T >::ok ( )
inline

Check that the stream writing is OK.

Only applicable in code without exceptions.


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