1 #ifndef cetlib_PluginFactory_h 2 #define cetlib_PluginFactory_h 25 #include "cetlib_except/exception.h" 29 #include <type_traits> 48 template <
typename RESULT_TYPE,
typename... ARGS>
51 ARGS&&...
args)
const;
59 template <
typename RESULT_TYPE,
typename... ARGS>
61 -> RESULT_TYPE (*)(ARGS...);
63 template <
typename RESULT_TYPE,
typename... ARGS>
68 template <typename FUNCTION_TYPE>
69 std::enable_if_t<
std::is_function_v<FUNCTION_TYPE>, FUNCTION_TYPE*>
find(
83 std::
string const& funcname,
105 template <
typename RESULT_TYPE,
typename... ARGS>
109 ARGS&&...
args)
const 111 return (*find<RESULT_TYPE, ARGS...>(libspec, funcname))(
112 std::forward<ARGS>(
args)...);
115 template <
typename FUNCTION_TYPE>
116 inline std::enable_if_t<std::is_function_v<FUNCTION_TYPE>, FUNCTION_TYPE*>
120 FUNCTION_TYPE** symbol{
nullptr};
125 template <
typename RESULT_TYPE,
typename... ARGS>
129 -> RESULT_TYPE (*)(ARGS...)
131 RESULT_TYPE (*symbol)(ARGS...) =
nullptr;
136 template <
typename RESULT_TYPE,
typename... ARGS>
141 -> RESULT_TYPE (*)(ARGS...)
147 template <
typename T>
160 if (symbol ==
nullptr) {
161 throw exception(
"Configuration",
"BadPluginLibrary")
163 <<
" has internal symbol definition problems: consult an expert.";
RESULT_TYPE call(std::string const &libspec, std::string const &funcname, ARGS &&...args) const
std::function< std::string()> releaseVersionFunc_
void resolveSymbolOrThrow_(std::string const &libspec, std::string const &funcname, T &symbol) const
static LibraryManager::nothrow_t nothrow
std::string releaseVersion_() const
T getSymbolByLibspec(std::string const &libspec, std::string const &sym_name) const
void setDiagReleaseVersion(std::string const &rv)
auto find(std::string const &funcname, std::string const &libspec) const -> RESULT_TYPE(*)(ARGS...)
PluginFactory(cet::search_path const &search_path, std::string const &suffix="plugin")
void function(int client, int *resource, int parblock, int *test, int p)
void wrapLibraryManagerException(cet::exception const &e, std::string const &item_type, std::string const &libspec, std::string const &release)
std::string releaseVersionString_
cet::coded_exception< error, detail::translate > exception