DUECA/DUSIME
Loading...
Searching...
No Matches
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...

#include <EventAccessToken.hxx>

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

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.
 
 ~EventChannelWriteToken ()
 Destructor.
 
void sendEvent (const T *edata, const DataTimeSpec &ts)
 Send an event over the channel.
 
void sendEvent (const T *edata, const TimeTickType &t) __attribute__((deprecated))
 Send an event over the channel.
 
- Public Member Functions inherited from dueca::ChannelWriteToken
 ChannelWriteToken (const GlobalId &owner, const NameSet &channelname, const std::string &dataclassname, const std::string &entrylabel=std::string(), Channel::EntryTimeAspect time_aspect=Channel::Continuous, Channel::EntryArity arity=Channel::OnlyOneEntry, Channel::PackingMode packmode=Channel::OnlyFullPacking, Channel::TransportClass tclass=Channel::Regular, const UCallbackOrActivity &when_valid=UCallbackOrActivity(), unsigned nreservations=0)
 Constructor, creates a token to write data in the channel, and if needed it creates the associated channel end.
 
 ~ChannelWriteToken ()
 Destructor.
 
void decodeAndWriteData (AmorphReStore &s, const DataTimeSpec &ts)
 Write channel data from a storage object.
 
bool isValid ()
 Check the validity of the token.
 
entryid_type getEntryId () const
 Get the entry number.
 
ChannelEntryInfo getChannelEntryInfo () const
 Retrieve creation/entry information.
 
bool applyFunctor (DCOFunctor *fnct, const DataTimeSpec &time)
 Apply a given functor to write channel data.
 
void reWrite (const DataTimeSpec &time)
 Simply re-write the current (or default) data for a new time.
 
const std::string & getDataClassName () const
 Return the data class.
 
- Public Member Functions inherited from dueca::GenericToken
const GlobalIdgetTokenHolder () const
 Return the ID of the owner.
 
const GlobalIdgetChannelId () const
 Return the ID of the channel.
 
const NameSetgetName () const
 Return the local name specified for the token.
 
const std::string & getDataClassName () const
 Return the data class name.
 
uint32_t getDataClassMagic () const
 Access the data class magic.
 
virtual ~GenericToken ()
 Destructor.
 
 GenericToken (const GlobalId &holder, const NameSet &name, const std::string &dataclassname)
 Constructor.
 
template<class MFT >
std::weak_ptr< MFTgetMetaFunctor (const std::string &fname) const
 Obtain a specific metafunctor for interaction with channel data.
 
- Public Member Functions inherited from dueca::TriggerPuller
const std::string & getTriggerName () const
 Find a name.
 

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.
 

Additional Inherited Members

- Protected Types inherited from dueca::TriggerPuller
typedef list< TargetDatatargetlist_type
 Combination of a target, someone to pull if requested, and the index that target needs to identify this puller.
 
- Protected Member Functions inherited from dueca::ChannelWriteToken
voidgetAccess (uint32_t magic)
 Return a void pointer to a new data location.
 
void checkAccess (uint32_t magic)
 Check whether magic is good, and token is valid.
 
void releaseAccess (const void *data_ptr, const DataTimeSpec &ts)
 Return the read access given previously, creating the effective write,.
 
void discardAccess (const void *data_ptr)
 Discard the read access, abandoning an attempted write.
 
- Protected Member Functions inherited from dueca::GenericToken
void checkChannelEndPresent () const
 Check preconditions.
 
- Protected Member Functions inherited from dueca::TriggerPuller
void pull (const DataTimeSpec &ts)
 activate and notify the targets
 
 TriggerPuller (const std::string &name=std::string())
 Constructor.
 
virtual ~TriggerPuller ()
 Destructor.
 
virtual void addTarget (const boost::intrusive_ptr< TriggerTarget > &target, unsigned id)
 Add a target to this puller, only called by TriggerTarget's setTrigger.
 
virtual void removeTarget (const TriggerTarget *target)
 Remove a target from the puller, only called by destructor.
 
virtual void setTriggerName ()
 Update the name, used by ConditionAnd and ConditionOr.
 
- Protected Attributes inherited from dueca::GenericToken
std::string dataclassname
 name of the data type
 
const DataSetConverterconverter
 Converter for the data.
 
uint32_t magic_number
 magic number for the data class name claimed here
 
UnifiedChannel * channel
 pointer to the channel
 
- Protected Attributes inherited from dueca::TriggerPuller
targetlist_type targets
 List of targets and indices.
 
std::bitset< MAX_MANAGERSactivitylevels
 Index of activitymanager levels.
 
std::string name
 Name, for debugging purposes.
 

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 Symbol 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: