Gaudi Framework, version v23r5
Home
Generated: Wed Nov 28 2012
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
GaudiKernel
GaudiKernel
CnvFactory.h
Go to the documentation of this file.
1
// $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiKernel/GaudiKernel/CnvFactory.h,v 1.12 2006/12/06 17:18:03 mato Exp $
2
#ifndef GAUDIKERNEL_CNVFACTORY_H
3
#define GAUDIKERNEL_CNVFACTORY_H
4
5
#include "
GaudiKernel/Kernel.h
"
6
#include "Reflex/PluginService.h"
7
#include "
GaudiKernel/ClassID.h
"
8
#include "RVersion.h"
9
10
11
// The following is needed to be backward compatible with the old factories of Gaudi. Otherwise the components
12
// having the constructor/destructor protected will not be working
13
14
class
IConverter
;
15
class
ISvcLocator
;
16
17
template
<
typename
T>
class
CnvFactory
{
18
public
:
19
static
IConverter
*
create
(
ISvcLocator
*svcloc) {
20
return
new
T(svcloc );
21
}
22
};
23
24
namespace
{
25
template
<
typename
P >
class
Factory
<P,
IConverter
*(
ISvcLocator
*)> {
26
public
:
27
#if ROOT_VERSION_CODE < ROOT_VERSION(5,21,6)
28
static
void
* Func(
void
*,
const
std::vector<void*>
& arg,
void
*) {
29
return
CnvFactory<P>::create
((
ISvcLocator
*)(arg[0]));
30
}
31
#else
32
static
void
Func(
void
*retaddr,
void
*,
const
std::vector<void*>
& arg,
void
*) {
33
*(
IConverter
**) retaddr =
CnvFactory<P>::create
((
ISvcLocator
*)(arg[0]));
34
}
35
#endif
36
};
37
}
38
39
// Identified class for converters
40
41
class
GAUDI_API
ConverterID
{
42
public
:
43
ConverterID
(
long
stype,
CLID
clid ) : m_stype(stype), m_clid(clid) {}
44
~ConverterID
() {}
45
bool
operator ==
(
const
ConverterID
&
id
)
const
{
return
m_stype ==
id
.m_stype && m_clid ==
id
.m_clid; }
46
private
:
47
friend
std::ostream
&
operator <<
(
std::ostream
&,
const
ConverterID
&);
48
long
m_stype
;
49
CLID
m_clid
;
50
};
51
52
inline
std::ostream
&
operator <<
(
std::ostream
&
s
,
const
ConverterID
&
id
) {
53
s <<
"CNV_"
<<
id
.m_stype <<
"_"
<<
id
.m_clid;
54
return
s
;
55
}
56
57
#define DECLARE_GENERIC_CONVERTER(x)
/* dummy */
58
#define DECLARE_NAMESPACE_GENERIC_CONVERTER(n,x)
/* dummy */
59
#define DECLARE_CONVERTER(x)
/*dummy*/
60
#define DECLARE_NAMESPACE_CONVERTER(n,x)
/*dummy */
61
62
// Macros to declare component factories
63
#define DECLARE_CONVERTER_FACTORY(x) \
64
PLUGINSVC_FACTORY_WITH_ID(x,ConverterID(x::storageType(),x::classID()),IConverter*(ISvcLocator*))
65
66
// Macros to declare component factories in a C++ namespace
67
#define DECLARE_NAMESPACE_CONVERTER_FACTORY(n,x) \
68
using n::x; PLUGINSVC_FACTORY_WITH_ID(x,ConverterID(x::storageType(),x::classID()),IConverter*(ISvcLocator*))
69
70
#endif // GAUDIKERNEL_CNVFACTORY_H
Generated at Wed Nov 28 2012 12:17:12 for Gaudi Framework, version v23r5 by
Doxygen
version 1.8.2 written by
Dimitri van Heesch
, © 1997-2004