1 #ifndef cetlib_PluginFactory_h 2 #define cetlib_PluginFactory_h 25 #include "cetlib_except/exception.h" 47 template <
typename RESULT_TYPE,
typename... ARGS>
50 ARGS&&...
args)
const;
58 template <
typename RESULT_TYPE,
typename... ARGS>
60 -> RESULT_TYPE (*)(ARGS...);
62 template <
typename RESULT_TYPE,
typename... ARGS>
67 template <typename FUNCTION_TYPE>
68 std::enable_if_t<
std::is_function<FUNCTION_TYPE>::
value, FUNCTION_TYPE*>
find(
82 std::
string const& funcname,
104 template <
typename RESULT_TYPE,
typename... ARGS>
108 ARGS&&...
args)
const 110 return (*find<RESULT_TYPE, ARGS...>(libspec, funcname))(
111 std::forward<ARGS>(
args)...);
114 template <
typename FUNCTION_TYPE>
119 FUNCTION_TYPE** symbol{
nullptr};
124 template <
typename RESULT_TYPE,
typename... ARGS>
128 -> RESULT_TYPE (*)(ARGS...)
130 RESULT_TYPE (*symbol)(ARGS...) =
nullptr;
135 template <
typename RESULT_TYPE,
typename... ARGS>
140 -> RESULT_TYPE (*)(ARGS...)
146 template <
typename T>
159 if (symbol ==
nullptr) {
160 throw exception(
"Configuration",
"BadPluginLibrary")
162 <<
" 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
::xsd::cxx::tree::exception< char > exception
static LibraryManager::nothrow_t nothrow
std::string releaseVersion_() const
T getSymbolByLibspec(std::string const &libspec, std::string const &sym_name) const
const XML_Char int const XML_Char * value
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 wrapLibraryManagerException(cet::exception const &e, std::string const &item_type, std::string const &libspec, std::string const &release)
std::string releaseVersionString_