Gaudi Framework, version v23r5

Home   Generated: Wed Nov 28 2012
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ToolFactory.h
Go to the documentation of this file.
1 // $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiKernel/GaudiKernel/ToolFactory.h,v 1.9 2007/01/23 09:13:07 mato Exp $
2 #ifndef GAUDI_KERNEL_TOOLFACTORY_H
3 #define GAUDI_KERNEL_TOOLFACTORY_H
4 
5 #include "Reflex/PluginService.h"
6 #include "RVersion.h"
7 
8 // The following is needed to be backward compatible with the old factories of Gaudi. Otherwise the components
9 // having the constructor/destructor protected will not be working
10 
11 class IAlgTool;
12 class IInterface;
13 
14 template <typename T> class ToolFactory {
15  public:
16  static IAlgTool* create(const std::string& type, const std::string& name, IInterface *parent) {
17  return new T(type, name, parent );
18  }
19 };
20 
21 namespace {
22  template < typename P > class Factory<P, IAlgTool*(std::string, std::string, const IInterface*)> {
23  public:
24 #if ROOT_VERSION_CODE < ROOT_VERSION(5,21,6)
25  static void* Func( void*, const std::vector<void*>& arg, void*) {
26  return ToolFactory<P>::create(*(std::string*)(arg[0]), *(std::string*)(arg[1]), (IInterface*)(arg[2]));
27  }
28 #else
29  static void Func( void *retaddr, void*, const std::vector<void*>& arg, void*) {
30  *(IAlgTool**) retaddr = ToolFactory<P>::create(*(std::string*)(arg[0]), *(std::string*)(arg[1]), (IInterface*)(arg[2]));
31  }
32 #endif
33  };
34 }
35 
36 // Macros to declare components
37 #define DECLARE_ALGTOOL(x) /*dummy*/
38 #define DECLARE_NAMESPACE_ALGTOOL(n,x) /*dummy*/
39 #define DECLARE_TOOL(x) /*dummy*/
40 #define DECLARE_NAMESPACE_TOOL(n,x) /*dummy*/
41 
42 // Macros to declare component factories
43 #define DECLARE_TOOL_FACTORY(x) PLUGINSVC_FACTORY(x,IAlgTool*(std::string, std::string, const IInterface*))
44 #define DECLARE_NAMESPACE_TOOL_FACTORY(n,x) using n::x; PLUGINSVC_FACTORY(x,IAlgTool*(std::string, std::string, const IInterface*))
45 
46 #endif // GAUDI_KERNEL_TOOLFACTORY_H

Generated at Wed Nov 28 2012 12:17:15 for Gaudi Framework, version v23r5 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004