AllowedConfigurationMacro.h
Go to the documentation of this file.
1 #ifndef fhiclcpp_types_AllowedConfigurationMacro_h
2 #define fhiclcpp_types_AllowedConfigurationMacro_h
3 
4 // =====================================================================
5 //
6 // Extern allowed-configuration macro
7 //
8 // Use: Fill in
9 //
10 // =====================================================================
11 
12 #include "cetlib/compiler_macros.h"
14 #include "fhiclcpp/types/Name.h"
15 
16 #include <memory>
17 #include <string>
18 #include <type_traits>
19 
20 namespace fhicl::detail {
21 
22  template <class T, class Enable = void>
24  static std::unique_ptr<fhicl::ConfigurationTable>
25  get(std::string const& /*name*/)
26  {
27  return std::unique_ptr<fhicl::ConfigurationTable>{nullptr};
28  }
29  };
30 
31  template <class T>
33  std::void_t<decltype(typename T::Parameters{
34  std::declval<fhicl::Name>()})>> {
35  static std::unique_ptr<fhicl::ConfigurationTable>
36  get(std::string const& name)
37  {
38  return std::make_unique<typename T::Parameters>(fhicl::Name{name});
39  }
40  };
41 }
42 
43 #define FHICL_PROVIDE_ALLOWED_CONFIGURATION(klass) \
44  EXTERN_C_FUNC_DECLARE_START \
45  std::unique_ptr<fhicl::ConfigurationTable> allowed_configuration( \
46  std::string const& name) \
47  { \
48  return fhicl::detail::AllowedConfiguration<klass>::get(name); \
49  } \
50  EXTERN_C_FUNC_DECLARE_END
51 
52 #endif /* fhiclcpp_types_AllowedConfigurationMacro_h */
53 
54 // Local Variables:
55 // mode: c++
56 // End:
static QCString name
Definition: declinfo.cpp:673
std::string string
Definition: nybbler.cc:12
STL namespace.