ATLAS Offline Software
Classes | Namespaces | Macros
TPCnvFactory.h File Reference

Set up plugin loading of TP converters. More...

#include "Gaudi/PluginService.h"
Include dependency graph for TPCnvFactory.h:

Go to the source code of this file.

Classes

struct  Athena::TPCnvVers
 
struct  Athena::TPCnvType
 

Namespaces

 Athena
 Some weak symbol referencing magic...
 

Macros

#define DO_ATHTPCNV_FACTORY_REGISTER_CNAME(name, serial)   _register_ ## _ ## serial
 
#define DO_ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID(type, id, trans_type, pers_type, is_last_version, cnv_type, signature, serial)
 
#define DO_ATHTPCNV_PLUGINSVC_FACTORY(type, trans_type, pers_type, is_last_version, cnv_type, signature, serial)   DO_ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID(type, ::Gaudi::PluginService::Details::demangle<type>(), trans_type, pers_type, is_last_version, cnv_type, signature, serial)
 
#define ATHTPCNV_PLUGINSVC_FACTORY(type, trans_type, pers_type, is_last_version, signature)   DO_ATHTPCNV_PLUGINSVC_FACTORY(type, trans_type, pers_type, is_last_version, Athena::TPCnvType::Athena, signature, __LINE__)
 
#define ARATPCNV_PLUGINSVC_FACTORY(type, trans_type, pers_type, is_last_version, signature)   DO_ATHTPCNV_PLUGINSVC_FACTORY(type, trans_type, pers_type, is_last_version, Athena::TPCnvType::ARA, signature, __LINE__)
 
#define TRIGTPCNV_PLUGINSVC_FACTORY(type, trans_type, pers_type, is_last_version, signature)   DO_ATHTPCNV_PLUGINSVC_FACTORY(type, trans_type, pers_type, is_last_version, Athena::TPCnvType::Trigger, signature, __LINE__)
 
#define ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID(type, id, trans_type, pers_type, is_last_version, signature)   DO_ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID(type, id, trans_type, pers_type, is_last_version, Athena::TPCnvType::Athena, signature, __LINE__)
 
#define ARATPCNV_PLUGINSVC_FACTORY_WITH_ID(type, id, trans_type, pers_type, is_last_version, signature)   DO_ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID(type, id, trans_type, pers_type, is_last_version, Athena::TPCnvType::ARA, signature, __LINE__)
 
#define TRIGTPCNV_PLUGINSVC_FACTORY_WITH_ID(type, id, trans_type, pers_type, is_last_version, signature)   DO_ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID(type, id, trans_type, pers_type, is_last_version, Athena::TPCnvType::Trigger, signature, __LINE__)
 
#define DECLARE_TPCNV_FACTORY(x, trans_type, pers_type, is_last_version)   ATHTPCNV_PLUGINSVC_FACTORY(x,trans_type,pers_type,is_last_version,ITPCnvBase*())
 
#define DECLARE_ARATPCNV_FACTORY(x, trans_type, pers_type, is_last_version)   ARATPCNV_PLUGINSVC_FACTORY(x,trans_type,pers_type,is_last_version,ITPCnvBase*())
 
#define DECLARE_TRIGTPCNV_FACTORY(x, trans_type, pers_type, is_last_version)   TRIGTPCNV_PLUGINSVC_FACTORY(x,trans_type,pers_type,is_last_version,ITPCnvBase*())
 
#define DECLARE_NAMED_TPCNV_FACTORY(x, n, trans_type, pers_type, is_last_version)   ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID(x,std::string(#n), trans_type,pers_type, is_last_version, ITPCnvBase*())
 
#define DECLARE_NAMED_ARATPCNV_FACTORY(x, n, trans_type, pers_type, is_last_version)   ARATPCNV_PLUGINSVC_FACTORY_WITH_ID(x,std::string(#n), trans_type,pers_type, is_last_version, ITPCnvBase*())
 
#define DECLARE_NAMED_TRIGTPCNV_FACTORY(x, n, trans_type, pers_type, is_last_version)   TRIGTPCNV_PLUGINSVC_FACTORY_WITH_ID(x,std::string(#n), trans_type,pers_type, is_last_version, ITPCnvBase*())
 

Detailed Description

Set up plugin loading of TP converters.

Author
scott snyder, S. Binet The definitions here are used to allow loading the TP converters directly via the Gaudi plugin mechanism.

Usage

In a TPCnv package, create a source file with the same name as the package, add add this to your requirements file:

apply_pattern tpcnv_library

That file should contain a declaration like this for each TP converter:

#include "FooTPCnv/FooCnv_p2.h"
Foo,
Foo_p2,

The first three arguments should be the converter class, the transient class, and the persistent class, respectively. The fourth argument should be Athena::TPCnvVers::Current if this is the most recent version of the converter. You should also declare previous versions of the converter, using Old:

#include "FooTPCnv/FooCnv_p1.h"
Foo,
Foo_p1,

Sometimes you need to use a different converter class for AthenaROOTAccess. In that case, also use DECLARE_ARATPCNV_FACTORY:

#include "FooTPCnv/FooARACnv_p2.h"
Foo,
Foo_p2,

There is a separate macro DECLARE_TRIGTPCNV_FACTORY to allow declaring separate converters to use for the trigger.

Finally, in some cases you may need to use a different name for the plugin than the C++ class name. This is generally the case if the converter class is actually a typedef. In that case, use DECLARE_NAMED_TPCNV_FACTORY:

#include "FooTPCnv/BarCnv_p2.h"
// BarCnv_p2 is actually a typedef.
BarCnv_p2,
Bar,
Bar_p2,

There is also a DECLARE_NAMED_ARATPCNV_FACTORY.

Implementation

The implementation is very simple. Let the converter, transient, and persistent types be C, T, and P, respectively. We always make plugin entries for C and _PERS_P. If the converter is current, we also make an entry for _TRANS_T. If the converter is for ARA, we add _ARA t the front of the pers and trans names; and similarly _TRIG for trigger-specific conversions.

Thus, to find the correct converter for a transient class, we look up _TRANS_T; and for a persistent class we look up _PERS_P. For ARA, we first try the look up with _ARA in front of those names. To get the transient class name corresponding to a persistent class, we create an instance of the converter and use the transientTInfo interface. No registry is needed beyond the existing Gaudi plugin registry.

One limitation: if you have multiple transient classes that use the same persistent class, you'll get warnings from the plugin service.

Definition in file TPCnvFactory.h.

Macro Definition Documentation

◆ ARATPCNV_PLUGINSVC_FACTORY

#define ARATPCNV_PLUGINSVC_FACTORY (   type,
  trans_type,
  pers_type,
  is_last_version,
  signature 
)    DO_ATHTPCNV_PLUGINSVC_FACTORY(type, trans_type, pers_type, is_last_version, Athena::TPCnvType::ARA, signature, __LINE__)

Definition at line 168 of file TPCnvFactory.h.

◆ ARATPCNV_PLUGINSVC_FACTORY_WITH_ID

#define ARATPCNV_PLUGINSVC_FACTORY_WITH_ID (   type,
  id,
  trans_type,
  pers_type,
  is_last_version,
  signature 
)    DO_ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID(type, id, trans_type, pers_type, is_last_version, Athena::TPCnvType::ARA, signature, __LINE__)

Definition at line 175 of file TPCnvFactory.h.

◆ ATHTPCNV_PLUGINSVC_FACTORY

#define ATHTPCNV_PLUGINSVC_FACTORY (   type,
  trans_type,
  pers_type,
  is_last_version,
  signature 
)    DO_ATHTPCNV_PLUGINSVC_FACTORY(type, trans_type, pers_type, is_last_version, Athena::TPCnvType::Athena, signature, __LINE__)

Definition at line 166 of file TPCnvFactory.h.

◆ ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID

#define ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID (   type,
  id,
  trans_type,
  pers_type,
  is_last_version,
  signature 
)    DO_ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID(type, id, trans_type, pers_type, is_last_version, Athena::TPCnvType::Athena, signature, __LINE__)

Definition at line 173 of file TPCnvFactory.h.

◆ DECLARE_ARATPCNV_FACTORY

#define DECLARE_ARATPCNV_FACTORY (   x,
  trans_type,
  pers_type,
  is_last_version 
)    ARATPCNV_PLUGINSVC_FACTORY(x,trans_type,pers_type,is_last_version,ITPCnvBase*())

Definition at line 189 of file TPCnvFactory.h.

◆ DECLARE_NAMED_ARATPCNV_FACTORY

#define DECLARE_NAMED_ARATPCNV_FACTORY (   x,
  n,
  trans_type,
  pers_type,
  is_last_version 
)    ARATPCNV_PLUGINSVC_FACTORY_WITH_ID(x,std::string(#n), trans_type,pers_type, is_last_version, ITPCnvBase*())

Definition at line 198 of file TPCnvFactory.h.

◆ DECLARE_NAMED_TPCNV_FACTORY

#define DECLARE_NAMED_TPCNV_FACTORY (   x,
  n,
  trans_type,
  pers_type,
  is_last_version 
)    ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID(x,std::string(#n), trans_type,pers_type, is_last_version, ITPCnvBase*())

Definition at line 195 of file TPCnvFactory.h.

◆ DECLARE_NAMED_TRIGTPCNV_FACTORY

#define DECLARE_NAMED_TRIGTPCNV_FACTORY (   x,
  n,
  trans_type,
  pers_type,
  is_last_version 
)    TRIGTPCNV_PLUGINSVC_FACTORY_WITH_ID(x,std::string(#n), trans_type,pers_type, is_last_version, ITPCnvBase*())

Definition at line 201 of file TPCnvFactory.h.

◆ DECLARE_TPCNV_FACTORY

#define DECLARE_TPCNV_FACTORY (   x,
  trans_type,
  pers_type,
  is_last_version 
)    ATHTPCNV_PLUGINSVC_FACTORY(x,trans_type,pers_type,is_last_version,ITPCnvBase*())

Definition at line 186 of file TPCnvFactory.h.

◆ DECLARE_TRIGTPCNV_FACTORY

#define DECLARE_TRIGTPCNV_FACTORY (   x,
  trans_type,
  pers_type,
  is_last_version 
)    TRIGTPCNV_PLUGINSVC_FACTORY(x,trans_type,pers_type,is_last_version,ITPCnvBase*())

Definition at line 192 of file TPCnvFactory.h.

◆ DO_ATHTPCNV_FACTORY_REGISTER_CNAME

#define DO_ATHTPCNV_FACTORY_REGISTER_CNAME (   name,
  serial 
)    _register_ ## _ ## serial

Definition at line 132 of file TPCnvFactory.h.

◆ DO_ATHTPCNV_PLUGINSVC_FACTORY

#define DO_ATHTPCNV_PLUGINSVC_FACTORY (   type,
  trans_type,
  pers_type,
  is_last_version,
  cnv_type,
  signature,
  serial 
)    DO_ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID(type, ::Gaudi::PluginService::Details::demangle<type>(), trans_type, pers_type, is_last_version, cnv_type, signature, serial)

Definition at line 161 of file TPCnvFactory.h.

◆ DO_ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID

#define DO_ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID (   type,
  id,
  trans_type,
  pers_type,
  is_last_version,
  cnv_type,
  signature,
  serial 
)
Value:
namespace { \
DO_ATHTPCNV_FACTORY_REGISTER_CNAME( type, serial )() \
{ \
using ::Gaudi::PluginService::DeclareFactory; \
std::string prefix; \
if (cnv_type == Athena::TPCnvType::ARA) \
prefix = "_ARA"; \
else if (cnv_type == Athena::TPCnvType::Trigger) \
prefix = "_TRIG"; \
DeclareFactory<type> normal{}; \
if (is_last_version == Athena::TPCnvVers::Current) \
DeclareFactory<type> transient{prefix + "_TRANS_" + #trans_type}; \
DeclareFactory<type> persistent{prefix + "_PERS_" + #pers_type}; \
} \
}

Definition at line 141 of file TPCnvFactory.h.

◆ TRIGTPCNV_PLUGINSVC_FACTORY

#define TRIGTPCNV_PLUGINSVC_FACTORY (   type,
  trans_type,
  pers_type,
  is_last_version,
  signature 
)    DO_ATHTPCNV_PLUGINSVC_FACTORY(type, trans_type, pers_type, is_last_version, Athena::TPCnvType::Trigger, signature, __LINE__)

Definition at line 170 of file TPCnvFactory.h.

◆ TRIGTPCNV_PLUGINSVC_FACTORY_WITH_ID

#define TRIGTPCNV_PLUGINSVC_FACTORY_WITH_ID (   type,
  id,
  trans_type,
  pers_type,
  is_last_version,
  signature 
)    DO_ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID(type, id, trans_type, pers_type, is_last_version, Athena::TPCnvType::Trigger, signature, __LINE__)

Definition at line 177 of file TPCnvFactory.h.

Foo
Definition: FooBar.h:9
TPCnvFactory.h
Set up plugin loading of TP converters.
python.TriggerEDMRun3.persistent
def persistent(transient)
Definition: TriggerEDMRun3.py:1171
Athena::TPCnvType::Trigger
@ Trigger
Definition: TPCnvFactory.h:125
Athena::TPCnvType::ARA
@ ARA
Definition: TPCnvFactory.h:124
Athena::TPCnvVers::Old
@ Old
Definition: TPCnvFactory.h:116
DECLARE_TPCNV_FACTORY
#define DECLARE_TPCNV_FACTORY(x, trans_type, pers_type, is_last_version)
Definition: TPCnvFactory.h:185
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
DO_ATHTPCNV_FACTORY_REGISTER_CNAME
#define DO_ATHTPCNV_FACTORY_REGISTER_CNAME(name, serial)
Definition: TPCnvFactory.h:131
Athena::TPCnvVers::Current
@ Current
Definition: TPCnvFactory.h:117
Bar
Definition: FooBar.h:27
DECLARE_NAMED_ARATPCNV_FACTORY
#define DECLARE_NAMED_ARATPCNV_FACTORY(x, n, trans_type, pers_type, is_last_version)
Definition: TPCnvFactory.h:197
DECLARE_ARATPCNV_FACTORY
#define DECLARE_ARATPCNV_FACTORY(x, trans_type, pers_type, is_last_version)
Definition: TPCnvFactory.h:188
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78