DUECA/DUSIME
|
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... | |
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.
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.
holder | ID of the requester. |
name_set | NameSet with the name of the channel that you request access for. |
d | Type 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. |
tclass | Transport class for the channel. Current options are Regular and Bulk. |
when_valid | A 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. |
dueca::EventChannelWriteToken< T >::~EventChannelWriteToken | ( | ) |
Destructor.
Returns access to the channel.
|
inline |
Send an event over the channel.
The data you offered is taken over by the event, please don't destroy.
edata | Pointer to the data object to be sent. Will be freed by the channel. |
ts | Time specification for sending the event. |
|
inline |
Send an event over the channel.
The data you offered is taken over by the event, please don't destroy.
edata | Pointer to the data object to be sent. Will be freed by the channel. |
t | Simulation time for sending the event. |
|
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.