DUECA/DUSIME
Loading...
Searching...
No Matches
dueca::AssociateObject< Host > Class Template Reference

Proxy identity for helper classes associated with an object derived from dueca::NamedObject. More...

#include <AssociateObject.hxx>

Inheritance diagram for dueca::AssociateObject< Host >:
Collaboration diagram for dueca::AssociateObject< Host >:

Public Member Functions

 AssociateObject (const Host &host)
 Constructor.
 ~AssociateObject ()
 Destructor.
ObjectType getObjectType () const final
 Object type for DUECA's sanity.
Public Member Functions inherited from dueca::NamedObject
const std::string getEntity () const
 Returns the "entity" part of the name.
const std::string getClass () const
 Returns the "class" part of the name.
const std::string getPart () const
 Returns the sub-entity or "part" part of the name.
const NameSetgetNameSet () const
 This returns the complete name set.
const GlobalIdgetId () const
 This returns the id.

Static Public Attributes

static const char *const classname
 Class name constant, should be equal to the host object's classname, used for reporting errors and warnings.

Additional Inherited Members

Protected Member Functions inherited from dueca::NamedObject
 NamedObject (const GlobalId &id)
 Reserve for AssociateObject.
 NamedObject (const NameSet &ns)
 Normal constructor, protected, because it has no use to create a NamedObject by itself.
virtual ~NamedObject ()
 Destructor.

Detailed Description

template<class Host>
class dueca::AssociateObject< Host >

Proxy identity for helper classes associated with an object derived from dueca::NamedObject.

In DUECA, objects that can use DUECA services (accessing channels, creating and using activities) need to have a name and a GlobalId, commonly by deriving from NamedObject. In addition, the convenience macros for checking channels and the like normally use the dueca::getclassname<>() templated function to access the "classname" member defined in modules.

This template class enables helper classes/objects that don't have their own GlobalId to assume the GlobalId and name of their "owner", and sets the proper class name.

Use this to delegate capabilities in a manner like (note, incomplete code!):

MyModule: public Module
{
// defining a helper reading a channel
struct MyHelper: public AssociateObject<MyModule>
{
MyHelper(const MyModule& m);
};
// e.g. a list of helpers
typedef std::list<MyHelper> helperlist_t;
};
AssociateObject(const Host &host)
Constructor.
Definition AssociateObject.hxx:79
Access token used to read data from a UnifiedChannel.
Definition ChannelReadToken.hxx:204
Base class for user-created self contained objects in DUECA.
Definition Module.hxx:80

In your c++ file, ensure that the helpers have the proper "classname":

template<>
MyModule::classname;
static const char *const classname
Class name constant, should be equal to the host object's classname, used for reporting errors and wa...
Definition AssociateObject.hxx:72

The MyHelper struct will now be able to open channels, create activities, etc. Its name and id are equal to that of the host class.

Constructor & Destructor Documentation

◆ AssociateObject()

template<class Host>
dueca::AssociateObject< Host >::AssociateObject ( const Host & host)
inline

Constructor.

Parameters
hostHost class for name and ID.

Member Function Documentation

◆ getObjectType()

template<class Host>
ObjectType dueca::AssociateObject< Host >::getObjectType ( ) const
inlinefinalvirtual

Object type for DUECA's sanity.

Implements dueca::NamedObject.


The documentation for this class was generated from the following files:
  • /home/abuild/rpmbuild/BUILD/dueca-4.3.0-build/dueca-4.3.0/dueca/NamedObject.hxx
  • /home/abuild/rpmbuild/BUILD/dueca-4.3.0-build/dueca-4.3.0/dueca/AssociateObject.hxx