DUECA/DUSIME
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
dueca::GenericToken Class Referenceabstract

The accessToken objects are used in conjunction with the channel system. More...

#include <GenericToken.hxx>

Inheritance diagram for dueca::GenericToken:
Inheritance graph
[legend]
Collaboration diagram for dueca::GenericToken:
Collaboration graph
[legend]

Public Member Functions

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.
 
virtual bool isValid ()=0
 Returns true if the token is valid (and can thus be used).
 
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.
 

Protected Member Functions

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

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.
 

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.
 

Detailed Description

The accessToken objects are used in conjunction with the channel system.

When a component requests access to a channel, an accessToken is created and returned to the component.

For the component, the accessToken acts as a key. Using the accessToken on the channel, access to the data on the channel can be got.

For the channel, the accessToken acts as an identifier. It contains the sequence number of the component, as used in the channel object, and a GlobalId of the component. These are used for accounting purposes

Constructor & Destructor Documentation

◆ GenericToken()

dueca::GenericToken::GenericToken ( const GlobalId & holder,
const NameSet & name,
const std::string & dataclassname )

Constructor.

Creates an access point to a channel.

Parameters
holderIdentification of the creating client
nameName of the channel to connect to
dataclassnameType of data to be written/read.

Member Function Documentation

◆ isValid()

virtual bool dueca::GenericToken::isValid ( )
pure virtual

Returns true if the token is valid (and can thus be used).

Note that tokens have to be checked before use.

Returns
true if the token is ready for use, false otherwise.

Implemented in dueca::ChannelReadToken, and dueca::ChannelWriteToken.

◆ getMetaFunctor()

template<class MFT >
std::weak_ptr< MFT > dueca::GenericToken::getMetaFunctor ( const std::string & fname) const
inline

Obtain a specific metafunctor for interaction with channel data.

Interaction with channel data – e.g., reading – can be done in several ways. The "normal" mode is having access to the data class and using a DataReader. If you don't have, or don't want to, program code that uses a specific data class, typically for generic modules, you can use functors. The functionality for the functor must be coded for the DCO object, examples are stuff like "convert this DCO object into JSON". Look up the description in dueca::DCOMetaFunctor for more details. This call returns a weak reference to a meta-functor that can be used to create functors. A created functor can then be used wih the applyFunctor call. The "right" functor, for the specific data type accessed by this read token, is automatically selected.

Parameters
fnameFunctor type name
Exceptions
UndefinedFunctorIf there is no metafunctor of the specified type
FunctorTypeMismatchIf the metafunctor cannot be cast to the requested type
Returns
Reference to a metafunctor

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