12#ifndef ROOT_TPluginManager
13#define ROOT_TPluginManager
129 const char *className,
const char *pluginName,
130 const char *ctor,
const char *origin);
150 template <
typename T0>
156 template <
typename T0,
typename... T>
165 template <
typename... T>
168 constexpr auto nargs =
sizeof...(T);
169 auto name =
typeid(std::tuple<T...>).
name();
174 if (!CheckExactMatch<T...>(0, params...))
182 constexpr auto nargs =
sizeof...(params);
188 if (ExactArgMatch<T...>(params...)) {
189 const void *args[nargs] = {¶ms...};
234 if ((
gDebug > 1) && (nargs != 0)) {
235 Warning(
"ExecPlugin",
"Announced number of args different from the real number of argument passed %d vs 0",
245 if ((
gDebug > 1) && (nargs != (
int)
sizeof...(params))) {
246 Warning(
"ExecPlugin",
"Announced number of args different from the real number of argument passed %d vs %lu",
247 nargs, (
unsigned long)
sizeof...(params) );
275 void AddHandler(
const char *base,
const char *regexp,
276 const char *className,
const char *pluginName,
277 const char *ctor =
nullptr,
const char *origin =
nullptr);
278 void RemoveHandler(
const char *base,
const char *regexp =
nullptr);
#define ClassDefOverride(name, id)
R__EXTERN TVirtualMutex * gInterpreterMutex
R__EXTERN TPluginManager * gPluginMgr
#define R__LOCKGUARD(mutex)
The TEnv class reads config files, by default named .rootrc.
Global functions class (global functions are obtained from CINT).
THashTable implements a hash table to store TObject's.
Method or function calling interface.
void Execute(const char *, const char *, int *=nullptr) override
Execute method on this object with the given parameter string, e.g.
void SetParams(const T &... params)
Mother of all ROOT objects.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
bool CheckExactMatch(int iarg, const T0 &, const T &... params)
bool CheckNameMatch(int iarg, const std::type_info &ti)
Return true if the name of the iarg-th argument's type match type_name
const char * GetClass() const
Int_t CheckPlugin() const
Check if the plugin library for this handler exits.
Longptr_t ExecPlugin(int nargs)
TFunction * fMethod
ctor method call environment
const char * GetOrigin() const
std::atomic< Int_t > AtomicInt_t
void Print(Option_t *opt="") const override
Print info about the plugin handler.
Bool_t CanHandle(const char *base, const char *uri)
Check if regular expression appears in the URI, if so return kTRUE.
TPluginHandler(const TPluginHandler &)=delete
const char * GetRegexp() const
const char * GetBase() const
~TPluginHandler()
Cleanup plugin handler object.
Bool_t CheckForExecPlugin(Int_t nargs)
Check that we can properly run ExecPlugin.
Longptr_t ExecPlugin(int nargs, const T &... params)
const char * GetPlugin() const
Bool_t fIsMacro
if 1 fCallEnv is ok, -1 fCallEnv is not ok, 0 fCallEnv not setup yet.
void SetupCallEnv()
Setup ctor or static method call environment.
void LoadPluginImpl()
Load the plugin library for this handler.
bool ExactArgMatch(const T &... params)
bool CheckExactMatch(int iarg, const T0 &)
Longptr_t ExecPluginImpl()
Longptr_t ExecPluginImpl(const T &... params)
TPluginHandler & operator=(const TPluginHandler &)=delete
std::vector< std::string > fArgTupleTypeInfo
ctor method or global function
const char * GetCtor() const
Int_t LoadPlugin()
Load the plugin library for this handler.
std::once_flag fLoadStatusFlag
This class implements a plugin library manager.
Int_t WritePluginMacros(const char *dir, const char *plugin=nullptr) const
Write in the specified directory the plugin macros.
void AddHandler(const char *base, const char *regexp, const char *className, const char *pluginName, const char *ctor=nullptr, const char *origin=nullptr)
Add plugin handler to the list of handlers.
void Print(Option_t *opt="") const override
Print list of registered plugin handlers.
~TPluginManager()
Clean up the plugin manager.
void RemoveHandler(const char *base, const char *regexp=nullptr)
Remove handler for the specified base class and the specified regexp.
TPluginManager(const TPluginManager &)=delete
true if we are running LoadHandlersFromPluginDirs
void LoadHandlersFromEnv(TEnv *env)
Load plugin handlers specified in config file, like:
Bool_t fReadingDirs
table of base classes already checked or loaded
TPluginManager & operator=(const TPluginManager &)=delete
THashTable * fBasesLoaded
void LoadHandlerMacros(const char *path)
Load all plugin macros from the specified path/base directory.
Int_t WritePluginRecords(const char *envFile, const char *plugin=nullptr) const
Write in the specified environment config file the plugin records.
TPluginHandler * FindHandler(const char *base, const char *uri=nullptr)
Returns the handler if there exists a handler for the specified URI.
TPluginManager()
Constructor.
void LoadHandlersFromPluginDirs(const char *base=nullptr)
Load plugin handlers specified via macros in a list of plugin directories.