Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 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 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_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_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,

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,

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 _TRIG, we add _TRIG to the front of the pers and trans names.

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 TRIG, we first try the look up with _TRIG 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

◆ 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 150 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 155 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 172 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 175 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 166 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 169 of file TPCnvFactory.h.

◆ DO_ATHTPCNV_FACTORY_REGISTER_CNAME

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

Definition at line 118 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 145 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::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 127 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 152 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 157 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:1169
Athena::TPCnvType::Trigger
@ Trigger
Definition: TPCnvFactory.h:111
DECLARE_NAMED_TPCNV_FACTORY
#define DECLARE_NAMED_TPCNV_FACTORY(x, n, trans_type, pers_type, is_last_version)
Definition: TPCnvFactory.h:171
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
Athena::TPCnvVers::Old
@ Old
Definition: TPCnvFactory.h:102
DECLARE_TPCNV_FACTORY
#define DECLARE_TPCNV_FACTORY(x, trans_type, pers_type, is_last_version)
Definition: TPCnvFactory.h:165
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
DO_ATHTPCNV_FACTORY_REGISTER_CNAME
#define DO_ATHTPCNV_FACTORY_REGISTER_CNAME(name, serial)
Definition: TPCnvFactory.h:117
Athena::TPCnvVers::Current
@ Current
Definition: TPCnvFactory.h:103
Bar
Definition: FooBar.h:27