PluginTypeDeducer.h
Go to the documentation of this file.
1 #ifndef cetlib_PluginTypeDeducer_h
2 #define cetlib_PluginTypeDeducer_h
3 
4 ////////////////////////////////////////////////////////////////////////
5 // PluginTypeDeducer
6 //
7 // An aid to managing multiple plugin types. See
8 // cetlib/BasicPluginFactory.h for background.
9 //
10 // Specialize this class for your own plugin type and make sure it is
11 // seen before being required. A reasonable place would be the in the
12 // header file of the plugin type's base class (assuming there is one),
13 // immediately below the forward declaration of the base class name.
14 //
15 // Define a macro DEFINE_BASIC_PLUGINTYPE_FUNC(base) to produce a
16 // pluginType() function for a plugin library which should be findable
17 // by BasicPluginFactory::pluginType(const std::string & libspec).
18 //
19 // PluginTypeDeducer<> is used rather than a sinple string literal to
20 // allow for the ability for users of the plugin factory to compare the
21 // answer with a known value to verify the type of the plugin found.
22 ////////////////////////////////////////////////////////////////////////
23 
24 #include "cetlib/compiler_macros.h"
25 
26 #include <string>
27 
28 namespace cet {
29  // PluginTypeDeducer.
30  template <typename T>
32 }
33 
34 #define DEFINE_BASIC_PLUGINTYPE_FUNC(base) \
35  EXTERN_C_FUNC_DECLARE_START \
36  std::string pluginType() { return cet::PluginTypeDeducer<base>::value; } \
37  EXTERN_C_FUNC_DECLARE_END
38 
39 template <typename T>
41  static std::string const value;
42 };
43 
44 template <typename T>
46 
47 #endif /* cetlib_PluginTypeDeducer_h */
48 
49 // Local Variables:
50 // mode: c++
51 // End:
static std::string const value
enum BeamMode string