Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
TPCnvFactory.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 
3 /*
4  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 
91 #ifndef ATHENAKERNEL_TPCNVFACTORY_H
92 #define ATHENAKERNEL_TPCNVFACTORY_H 1
93 
94 #include "Gaudi/PluginService.h"
95 
96 // Forward declaration
97 class ITPCnvBase;
98 
99 namespace Athena {
100  struct TPCnvVers {
101  enum Value {
102  Old = 0,
103  Current = 1
104  };
105  };
106 
107  struct TPCnvType {
108  enum Value {
109  Athena = 0,
110  // ARA = 1, // not supported anymore
111  Trigger = 2
112  };
113  };
114 }
115 
116 
117 #define DO_ATHTPCNV_FACTORY_REGISTER_CNAME(name, serial) \
118  _register_ ## _ ## serial
119 
120 
121 #ifdef __COVERITY__
122 // Disable this in coverity --- otherwise, coverity warns about
123 // 'same value on both sides' in the if statements.
124 #define DO_ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID(type, id, trans_type, pers_type, is_last_version, cnv_type, signature, serial)
125 #else
126 #define DO_ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID(type, id, trans_type, pers_type, is_last_version, cnv_type, signature, serial) \
127  namespace { \
128  struct DO_ATHTPCNV_FACTORY_REGISTER_CNAME( type, serial ) { \
129  DO_ATHTPCNV_FACTORY_REGISTER_CNAME( type, serial )() \
130  { \
131  using ::Gaudi::PluginService::DeclareFactory; \
132  std::string prefix; \
133  if (cnv_type == Athena::TPCnvType::Trigger) \
134  prefix = "_TRIG"; \
135  DeclareFactory<type> normal{}; \
136  if (is_last_version == Athena::TPCnvVers::Current) \
137  DeclareFactory<type> transient{prefix + "_TRANS_" + #trans_type}; \
138  DeclareFactory<type> persistent{prefix + "_PERS_" + #pers_type}; \
139  } \
140  } DO_ATHTPCNV_FACTORY_REGISTER_CNAME(s_ ## type, serial); \
141  }
142 #endif
143 
144 #define DO_ATHTPCNV_PLUGINSVC_FACTORY(type, trans_type, pers_type, is_last_version, cnv_type, signature, serial) \
145  DO_ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID(type, ::Gaudi::PluginService::Details::demangle<type>(), trans_type, pers_type, is_last_version, cnv_type, signature, serial)
146 
147 
148 
149 #define ATHTPCNV_PLUGINSVC_FACTORY(type, trans_type, pers_type, is_last_version, signature) \
150  DO_ATHTPCNV_PLUGINSVC_FACTORY(type, trans_type, pers_type, is_last_version, Athena::TPCnvType::Athena, signature, __LINE__)
151 #define TRIGTPCNV_PLUGINSVC_FACTORY(type, trans_type, pers_type, is_last_version, signature) \
152  DO_ATHTPCNV_PLUGINSVC_FACTORY(type, trans_type, pers_type, is_last_version, Athena::TPCnvType::Trigger, signature, __LINE__)
153 
154 #define ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID(type, id, trans_type, pers_type, is_last_version, signature) \
155  DO_ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID(type, id, trans_type, pers_type, is_last_version, Athena::TPCnvType::Athena, signature, __LINE__)
156 #define TRIGTPCNV_PLUGINSVC_FACTORY_WITH_ID(type, id, trans_type, pers_type, is_last_version, signature) \
157  DO_ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID(type, id, trans_type, pers_type, is_last_version, Athena::TPCnvType::Trigger, signature, __LINE__)
158 
159 
160 
161 //********************************************************************
162 // Macros that users should use.
163 //
164 
165 #define DECLARE_TPCNV_FACTORY(x,trans_type,pers_type,is_last_version) \
166  ATHTPCNV_PLUGINSVC_FACTORY(x,trans_type,pers_type,is_last_version,ITPCnvBase*())
167 
168 #define DECLARE_TRIGTPCNV_FACTORY(x,trans_type,pers_type,is_last_version) \
169  TRIGTPCNV_PLUGINSVC_FACTORY(x,trans_type,pers_type,is_last_version,ITPCnvBase*())
170 
171 #define DECLARE_NAMED_TPCNV_FACTORY(x,n,trans_type,pers_type,is_last_version) \
172  ATHTPCNV_PLUGINSVC_FACTORY_WITH_ID(x,std::string(#n), trans_type,pers_type, is_last_version, ITPCnvBase*())
173 
174 #define DECLARE_NAMED_TRIGTPCNV_FACTORY(x,n,trans_type,pers_type,is_last_version) \
175  TRIGTPCNV_PLUGINSVC_FACTORY_WITH_ID(x,std::string(#n), trans_type,pers_type, is_last_version, ITPCnvBase*())
176 
177 
178 
179 #endif //> !ATHENAKERNEL_TPCNVFACTORY_H
Athena::TPCnvType::Trigger
@ Trigger
Definition: TPCnvFactory.h:111
Value
tag-value pair class.
Definition: Value.h:39
Athena::TPCnvVers::Old
@ Old
Definition: TPCnvFactory.h:102
Athena
Some weak symbol referencing magic...
Definition: AthLegacySequence.h:21
Athena::TPCnvType
Definition: TPCnvFactory.h:107
Athena::TPCnvVers::Current
@ Current
Definition: TPCnvFactory.h:103
Athena::TPCnvVers
Definition: TPCnvFactory.h:100
ITPCnvBase
Definition: ITPCnvBase.h:24