DUECA/DUSIME
|
Access token for writing an entry in a MultiStreamChannel. More...
#include <MultiStreamWriteToken.hxx>
Public Member Functions | |
MultiStreamWriteToken (const GlobalId &holder, const NameSet &name_set, TimeTickType span, Channel::TransportClass tclass=Channel::Regular, Channel::TransportClass bclass=Channel::Regular, GenericCallback *when_valid=NULL) | |
Constructor. | |
~MultiStreamWriteToken () | |
Destructor. | |
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 GlobalId & | getTokenHolder () const |
Return the ID of the owner. | |
const GlobalId & | getChannelId () const |
Return the ID of the channel. | |
const NameSet & | getName () 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< MFT > | getMetaFunctor (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 | MultiStreamWriter< T > |
Additional Inherited Members | |
Protected Types inherited from dueca::TriggerPuller | |
typedef list< TargetData > | targetlist_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 | |
void * | getAccess (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 DataSetConverter * | converter |
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_MANAGERS > | activitylevels |
Index of activitymanager levels. | |
std::string | name |
Name, for debugging purposes. | |
Access token for writing an entry in a MultiStreamChannel.
A MultiStreamChannel is a stream channel version that contains the Entries of multiple similar entities. You may compare this with the HLA-style publish-subscribe mechanism, (still?) without the inheritance and data management.
This class builds forth on the GenericChannel class. It adds the functionality needed for reading and writing data on a channel with multiple "entries" or "personalities" in it. For example it may be used to transmit entity-to-entity data from all aircraft in a simulation.
To get read or write access to the channel, components need to create a MultiStreamReadToken or a MultiStreamWriteToken. The local copy of the channel (this class) is then created if it did not previously exist. Each MultiStreamWriteToken creates an entry in the channel, and this entry will be replicated on any channel ends on other nodes. With the destruction of the MultiStreamWriteToken the entry disappears again.
Updating of the entries held by a module is done by producing a MultiStreamWriter on the MultiStreamWriteToken. Reading is done by producing a MultiStreamReader on the MultiStreamReadToken, providing also an id of the entry. The read token has methods to select the first entry in the channel, and to walk through the entries until the last entry is read.
dueca::MultiStreamWriteToken< T >::MultiStreamWriteToken | ( | const GlobalId & | holder, |
const NameSet & | name_set, | ||
TimeTickType | span, | ||
Channel::TransportClass | tclass = Channel::Regular, | ||
Channel::TransportClass | bclass = Channel::Regular, | ||
GenericCallback * | when_valid = NULL ) |
Constructor.
Constructs an access token to write the stream channel with the specified name.
holder | ID of the requester. |
name_set | NameSet with the name of the channel that you request access for. |
span | Time span, in integer ticks, that the data should be kept. |
tclass | Transport class (priority) for sending the control data and differences/changes. |
bclass | Transport class (priority) for sending the initial value of the entry. Consider using Bulk here if you expect to write large and largely static entries. |
when_valid | Method called when the token becomes valid. |
Destructor.
The existence of the channel may continue, it is really destroyed when you were the last user.