DUECA/DUSIME
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
dueca::DataClassRegistry Class Reference

Global registry for information about Dueca Communication Object (DCO) types. More...

#include <DataClassRegistry.hxx>

Public Types

typedef DataClassRegistry_entry_type entry_type
 type of a single entry in the map – external
 

Public Member Functions

const CommObjectDataTablegetTable (const std::string &classname)
 Access the table with communication objects.
 
DataClassRegistry_entry_type getEntry (const std::string &classname)
 Return a quick-access entry index given a classname.
 
map_type::mapped_type getEntryShared (const std::string &classname)
 Return a quick-access entry index given a classname.
 
const CommObjectMemberAccessBasePtrgetMemberAccessor (DataClassRegistry_entry_type ix, const std::string &membername)
 Get an accessor to data member with name membername.
 
bool isRegistered (const std::string &classname)
 Check whether a class is registered.
 
const CommObjectMemberAccessBasePtrgetMemberAccessor (DataClassRegistry_entry_type ix, unsigned idx)
 get an accessor to data member index idx.
 
const chargetMemberName (DataClassRegistry_entry_type ix, unsigned idx) const
 Retrieve the name of a member, given a dataclass entry.
 
const unsigned getMemberIndex (DataClassRegistry_entry_type ix, const std::string &name)
 Retrieve the offset number of a member, given the dataclass entry and member name.
 
size_t getNumMembers (DataClassRegistry_entry_type ix) const
 Return the number of members in a class.
 
uint32_t getMagic (DataClassRegistry_entry_type ix) const
 Get the magic number.
 
const chargetEntryClassname (DataClassRegistry_entry_type ix) const
 Get the classname of a specific entry type.
 
const std::string & getParent (const std::string &classname)
 Get the parent class for the data type given in the classname.
 
bool isCompatible (const std::string &tryclass, const std::string &classname)
 See whether a class is a parent of (compatible with reading) another class.
 
const DataSetConvertergetConverter (const std::string &classname) const
 Get a pointer to the dataset converter for this data type.
 
std::weak_ptr< DCOMetaFunctorgetMetaFunctor (const std::string &classname, const std::string &fname) const
 Get a metafunctor, searched by name.
 

Static Public Member Functions

static DataClassRegistrysingle ()
 Singleton access.
 

Friends

class DataClassRegistrar
 Only the DataClassRegistrar can supply new DCO types.
 

Detailed Description

Global registry for information about Dueca Communication Object (DCO) types.

Note that most of the interfaces of this class are being used internally by DUECA. For some external projects it may be useful to inspect DCO classes.

Member Function Documentation

◆ getEntry()

DataClassRegistry_entry_type dueca::DataClassRegistry::getEntry ( const std::string & classname)

Return a quick-access entry index given a classname.

This returns a plain C++ pointer.

Parameters
classnamename of the data class
Returns
An index to the entry

◆ getEntryShared()

map_type::mapped_type dueca::DataClassRegistry::getEntryShared ( const std::string & classname)

Return a quick-access entry index given a classname.

Contrary to the above call, this returns a shared pointer.

Parameters
classnamename of the data class
Returns
An index to the entry

◆ getMemberAccessor() [1/2]

const CommObjectMemberAccessBasePtr & dueca::DataClassRegistry::getMemberAccessor ( DataClassRegistry_entry_type ix,
const std::string & membername )

Get an accessor to data member with name membername.

If the member name is not available in the present class, parent classes are tested.

Parameters
ixindex previously returned by getEntry call
membernamename of the data member
Returns
A pointer to the member accessor, which in turn can be used to access the data.

◆ getMemberAccessor() [2/2]

const CommObjectMemberAccessBasePtr & dueca::DataClassRegistry::getMemberAccessor ( DataClassRegistry_entry_type ix,
unsigned idx )

get an accessor to data member index idx.

Note that data members indices count from the parents

Parameters
ixindex returned by the getEntry call
idxnumber of the data member
Returns
A pointer to the member accessor, which in turn can be used to access the data.

◆ getMemberName()

const char * dueca::DataClassRegistry::getMemberName ( DataClassRegistry_entry_type ix,
unsigned idx ) const

Retrieve the name of a member, given a dataclass entry.

Parameters
ixindex returned by the getEntry call
idxnumber of the data member

◆ getMemberIndex()

const unsigned dueca::DataClassRegistry::getMemberIndex ( DataClassRegistry_entry_type ix,
const std::string & name )

Retrieve the offset number of a member, given the dataclass entry and member name.

Parameters
ixindex of the class, returned by getEntry call
namename of the data member

◆ getNumMembers()

size_t dueca::DataClassRegistry::getNumMembers ( DataClassRegistry_entry_type ix) const

Return the number of members in a class.

Parameters
ixindex of the class, returned by getEntry call

◆ getMagic()

uint32_t dueca::DataClassRegistry::getMagic ( DataClassRegistry_entry_type ix) const

Get the magic number.

The magic number is hashed for each data class. It is used as a check on consistency, when communicating with other DUECA processes.

Parameters
ixindex of the class, returned by getEntry call

◆ getEntryClassname()

const char * dueca::DataClassRegistry::getEntryClassname ( DataClassRegistry_entry_type ix) const

Get the classname of a specific entry type.

Parameters
ixindex of the class, returned by getEntry call

◆ getParent()

const std::string & dueca::DataClassRegistry::getParent ( const std::string & classname)

Get the parent class for the data type given in the classname.

Parameters
classnamechild class name
Returns
name of the parent class, or '' if no parent available.

◆ isCompatible()

bool dueca::DataClassRegistry::isCompatible ( const std::string & tryclass,
const std::string & classname )

See whether a class is a parent of (compatible with reading) another class.

Parameters
tryclassClass you want to access/read with
classnameClass given.

◆ getConverter()

const DataSetConverter * dueca::DataClassRegistry::getConverter ( const std::string & classname) const

Get a pointer to the dataset converter for this data type.

Parameters
classnamedata type class name
Returns
a pointer to the converter

◆ getMetaFunctor()

std::weak_ptr< DCOMetaFunctor > dueca::DataClassRegistry::getMetaFunctor ( const std::string & classname,
const std::string & fname ) const

Get a metafunctor, searched by name.

Functors are used to implement specific services on dataclasses. They typically need to contain state information (like, "to which file do I write"), and are thus client-specific. This returns the metafunctor, which is only type-specific, and can be asked to return functors. The returned functors can be used in combination with a channel read or write token.

Parameters
classnamedata class name
fnamefunctor name
Returns
weak reference to base functor.

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