Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
cet::PluginFactory Class Reference

#include "/cvmfs/nova.opensciencegrid.org/externals/cetlib/v3_06_01/source/cetlib/PluginFactory.h"

Inheritance diagram for cet::PluginFactory:
cet::BasicPluginFactory

Public Member Functions

 PluginFactory (cet::search_path const &search_path, std::string const &suffix="plugin")
 
void setDiagReleaseVersion (std::string const &rv)
 
void setDiagReleaseVersion (std::function< std::string()> rvf)
 
template<typename RESULT_TYPE , typename... ARGS>
RESULT_TYPE call (std::string const &libspec, std::string const &funcname, ARGS &&...args) const
 
template<typename RESULT_TYPE , typename... ARGS>
auto find (std::string const &funcname, std::string const &libspec) const -> RESULT_TYPE(*)(ARGS...)
 
template<typename RESULT_TYPE , typename... ARGS>
auto find (std::string const &funcname, std::string const &libspec, LibraryManager::nothrow_t) const -> RESULT_TYPE(*)(ARGS...)
 
template<typename FUNCTION_TYPE >
std::enable_if_t< std::is_function< FUNCTION_TYPE >::value, FUNCTION_TYPE * > find (std::string const &funcname, std::string const &libspec) const
 
virtual ~PluginFactory ()=default
 

Static Public Attributes

static LibraryManager::nothrow_t nothrow
 

Private Member Functions

 PluginFactory (PluginFactory const &)=delete
 
PluginFactoryoperator= (PluginFactory const &)=delete
 
template<typename T >
void resolveSymbolOrThrow_ (std::string const &libspec, std::string const &funcname, T &symbol) const
 
std::string releaseVersion_ () const
 

Private Attributes

LibraryManager lm_
 
std::string releaseVersionString_ {}
 
std::function< std::string()> releaseVersionFunc_ {}
 

Detailed Description

Definition at line 34 of file PluginFactory.h.

Constructor & Destructor Documentation

cet::PluginFactory::PluginFactory ( cet::search_path const &  search_path,
std::string const &  suffix = "plugin" 
)
explicit
virtual cet::PluginFactory::~PluginFactory ( )
virtualdefault
cet::PluginFactory::PluginFactory ( PluginFactory const &  )
privatedelete

Member Function Documentation

template<typename RESULT_TYPE , typename... ARGS>
RESULT_TYPE cet::PluginFactory::call ( std::string const &  libspec,
std::string const &  funcname,
ARGS &&...  args 
) const
inline

Definition at line 106 of file PluginFactory.h.

References make_syst_table_plots::args.

109 {
110  return (*find<RESULT_TYPE, ARGS...>(libspec, funcname))(
111  std::forward<ARGS>(args)...);
112 }
template<typename RESULT_TYPE , typename... ARGS>
auto cet::PluginFactory::find ( std::string const &  funcname,
std::string const &  libspec 
) const -> RESULT_TYPE (*)(ARGS...)
inline

Definition at line 126 of file PluginFactory.h.

References resolveSymbolOrThrow_().

129 {
130  RESULT_TYPE (*symbol)(ARGS...) = nullptr;
131  resolveSymbolOrThrow_(libspec, funcname, symbol);
132  return symbol;
133 }
void resolveSymbolOrThrow_(std::string const &libspec, std::string const &funcname, T &symbol) const
template<typename RESULT_TYPE , typename... ARGS>
auto cet::PluginFactory::find ( std::string const &  funcname,
std::string const &  libspec,
LibraryManager::nothrow_t  nothrow 
) const -> RESULT_TYPE (*)(ARGS...)
inline

Definition at line 137 of file PluginFactory.h.

References cet::LibraryManager::getSymbolByLibspec(), lm_, and nothrow.

141 {
142  return lm_.getSymbolByLibspec<RESULT_TYPE (*)(ARGS...)>(
143  libspec, funcname, nothrow);
144 }
static LibraryManager::nothrow_t nothrow
Definition: PluginFactory.h:53
LibraryManager lm_
Definition: PluginFactory.h:87
T getSymbolByLibspec(std::string const &libspec, std::string const &sym_name) const
template<typename FUNCTION_TYPE >
std::enable_if_t< std::is_function< FUNCTION_TYPE >::value, FUNCTION_TYPE * > cet::PluginFactory::find ( std::string const &  funcname,
std::string const &  libspec 
) const
inline

Definition at line 116 of file PluginFactory.h.

References resolveSymbolOrThrow_().

118 {
119  FUNCTION_TYPE** symbol{nullptr};
120  resolveSymbolOrThrow_(libspec, funcname, symbol);
121  return *symbol;
122 }
void resolveSymbolOrThrow_(std::string const &libspec, std::string const &funcname, T &symbol) const
PluginFactory& cet::PluginFactory::operator= ( PluginFactory const &  )
privatedelete
std::string cet::PluginFactory::releaseVersion_ ( ) const
private

Referenced by resolveSymbolOrThrow_().

template<typename T >
void cet::PluginFactory::resolveSymbolOrThrow_ ( std::string const &  libspec,
std::string const &  funcname,
T symbol 
) const
private

Definition at line 148 of file PluginFactory.h.

References e, cet::LibraryManager::getSymbolByLibspec(), lm_, releaseVersion_(), and cet::detail::wrapLibraryManagerException().

Referenced by find().

151 {
152  try {
153  lm_.getSymbolByLibspec(libspec, funcname, symbol);
154  }
155  catch (exception const& e) {
157  e, "Plugin", libspec, releaseVersion_());
158  }
159  if (symbol == nullptr) {
160  throw exception("Configuration", "BadPluginLibrary")
161  << "Plugin " << libspec << " with version " << releaseVersion_()
162  << " has internal symbol definition problems: consult an expert.";
163  }
164 }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
std::string releaseVersion_() const
LibraryManager lm_
Definition: PluginFactory.h:87
T getSymbolByLibspec(std::string const &libspec, std::string const &sym_name) const
Float_t e
Definition: plot.C:35
void wrapLibraryManagerException(cet::exception const &e, std::string const &item_type, std::string const &libspec, std::string const &release)
void cet::PluginFactory::setDiagReleaseVersion ( std::string const &  rv)
inline

Definition at line 99 of file PluginFactory.h.

References releaseVersionString_.

100 {
102 }
std::string releaseVersionString_
Definition: PluginFactory.h:88
void cet::PluginFactory::setDiagReleaseVersion ( std::function< std::string()>  rvf)
inline

Definition at line 93 of file PluginFactory.h.

References releaseVersionFunc_.

94 {
95  releaseVersionFunc_ = rvf;
96 }
std::function< std::string()> releaseVersionFunc_
Definition: PluginFactory.h:89

Member Data Documentation

LibraryManager cet::PluginFactory::lm_
private

Definition at line 87 of file PluginFactory.h.

Referenced by find(), and resolveSymbolOrThrow_().

LibraryManager::nothrow_t cet::PluginFactory::nothrow
static

Definition at line 53 of file PluginFactory.h.

Referenced by find().

std::function<std::string()> cet::PluginFactory::releaseVersionFunc_ {}
private

Definition at line 89 of file PluginFactory.h.

Referenced by setDiagReleaseVersion().

std::string cet::PluginFactory::releaseVersionString_ {}
private

Definition at line 88 of file PluginFactory.h.

Referenced by setDiagReleaseVersion().


The documentation for this class was generated from the following file: