DUECA/DUSIME
Public Member Functions | Friends | List of all members
dueca::EventChannelWriteToken< T > Class Template Reference

An EventChannelWriteToken can be used to write data to an event channel. More...

Public Member Functions

 EventChannelWriteToken (const GlobalId &holder, const NameSet &name_set, const ChannelDistribution &d=ChannelDistribution::SOLO_SEND, const Channel::TransportClass tclass=Channel::Regular, GenericCallback *when_valid=NULL)
 Constructor. More...
 
 ~EventChannelWriteToken ()
 Destructor. More...
 
void sendEvent (const T *edata, const DataTimeSpec &ts)
 Send an event over the channel. More...
 
void sendEvent (const T *edata, const TimeTickType &t) __attribute__((deprecated))
 Send an event over the channel. More...
 

Friends

class EventWriter< T >
 
void wrapSendEvent (EventChannelWriteToken< T > &, const T *, const TimeTickType &)
 The "wrapSendEvent" function can be used to send an event with self-allocated event data. More...
 

Detailed Description

template<class T>
class dueca::EventChannelWriteToken< T >

An EventChannelWriteToken can be used to write data to an event channel.

Note that EventChannelWriteToken is supplied for compatibility with older DUECA (<2). For new code you are advised to create ChannelWriteToken objects.

Construct the access token and keep it, to gain access to the channel. Please check with GenericToken::isValid() before writing.

Note that EventChannelWriteToken is obsolete; please use ChannelWriteToken in new code.

Constructor & Destructor Documentation

◆ EventChannelWriteToken()

template<class T >
dueca::EventChannelWriteToken< T >::EventChannelWriteToken ( const GlobalId holder,
const NameSet name_set,
const ChannelDistribution &  d = ChannelDistribution::SOLO_SEND,
const Channel::TransportClass  tclass = Channel::Regular,
GenericCallback when_valid = NULL 
)

Constructor.

Constructs an access token to write the event channel with the specified name.

Parameters
holderID of the requester.
name_setNameSet with the name of the channel that you request access for.
dType of "distribution". SOLO_SEND means that you will be the only sender, NO_OPINION means that you don't want to change the distribution type.
tclassTransport class for the channel. Current options are Regular and Bulk.
when_validA callback object, that is called once, as soon as any consumers of the channel data are reported. The channel can be used before this call, but the data goes off to nowhere, so it has no sense. If you only really want to start when there is someone who needs your data, use this callback. If you don't care, forget about it.

◆ ~EventChannelWriteToken()

Destructor.

Returns access to the channel.

Member Function Documentation

◆ sendEvent() [1/2]

template<class T >
void dueca::EventChannelWriteToken< T >::sendEvent ( const T *  edata,
const DataTimeSpec ts 
)
inline

Send an event over the channel.

The data you offered is taken over by the event, please don't destroy.

Parameters
edataPointer to the data object to be sent. Will be freed by the channel.
tsTime specification for sending the event.

◆ sendEvent() [2/2]

template<class T >
void dueca::EventChannelWriteToken< T >::sendEvent ( const T *  edata,
const TimeTickType &  t 
)
inline

Send an event over the channel.

The data you offered is taken over by the event, please don't destroy.

Parameters
edataPointer to the data object to be sent. Will be freed by the channel.
tSimulation time for sending the event.

Friends And Related Function Documentation

◆ wrapSendEvent

template<class T >
void wrapSendEvent ( EventChannelWriteToken< T > &  t,
const T *  edata,
const TimeTickType &  tick 
)
friend

The "wrapSendEvent" function can be used to send an event with self-allocated event data.

Note that the use of this function should be reserved to people who really know what they are doing, and only if there is a real (performance) need, if you are not one of these, inform yourself well or use a DataWriter, which provides a much safer interface to the channel.


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