library: libCore #include "TPluginManager.h"

# TPluginManager

class description - source file - inheritance tree (.pdf)

## class TPluginManager : public TObject

| Inheritance Chart:
`TObject`
| <- | `TPluginManager` |

        public:

                          TPluginManager()
                          TPluginManager(const TPluginManager&)
                          ~TPluginManager()
                     void AddHandler(const char* base, const char* regexp, const char* className, const char* pluginName, const char* ctor = "0")
           static TClass* Class()
          TPluginHandler* FindHandler(const char* base, const char* uri = "0")
          virtual TClass* IsA() const
                     void LoadHandlersFromEnv(TEnv* env)
          TPluginManager& operator=(const TPluginManager&)
             virtual void Print(Option_t* opt = "") const
                     void RemoveHandler(const char* base, const char* regexp = "0")
             virtual void ShowMembers(TMemberInspector& insp, char* parent)
             virtual void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)

### Data Members

        private:

          TList* fHandlers  list of plugin handlers

## Class Description

     TPluginManager

     This class implements a plugin library manager. It keeps track of
     a list of plugin handlers. A plugin handler knows which plugin
     library to load to get a specific class that is used to extend the
     functionality of a specific base class and how to create an object
     of this class. For example, to extend the base class TFile to be
     able to read RFIO files one needs to load the plugin library
     libRFIO.so which defines the TRFIOFile class. This loading should
     be triggered when a given URI contains a regular expression defined
     by the handler. Handlers can be defined for example as resources
     in the .rootrc file, e.g.:

       Plugin.TFile:       ^rfio:   TRFIOFile    RFIO   "<constructor>"
       Plugin.TSQLServer:  ^mysql:  TMySQLServer MySQL  "<constructor>"
       +Plugin.TSQLServer: ^pgsql:  TPgSQLServer PgSQL  "<constructor>"
       Plugin.TVirtualFitter: *     TFitter      Minuit "TFitter(Int_t)"

     Where the + in front of Plugin.TSQLServer says that it extends the
     existing definition of TSQLServer, usefull when there is more than
     one plugin that can extend the same base class. The "<constructor>"
     should be the constructor or a static method that generates an
     instance of the specified class. Global methods should start with
     "::" in their name, like "::CreateFitter()".
     Instead of being a shared library a plugin can also be a CINT
     script, so instead of libDialog.so one can have Dialog.C.
     The * is a placeholder in case there is no need for a URI to
     differentiate between different plugins for the same base class.
     For the default plugins see $ROOTSYS/etc/system.rootrc.

     Plugin handlers can also be registered at run time, e.g.:

       gROOT->GetPluginManager()->AddHandler("TSQLServer", "^sapdb:",
                                             "TSapDBServer", "SapDB",
                 "TSapDBServer(const char*,const char*, const char*)");

     A list of currently defined handlers can be printed using:

       gROOT->GetPluginManager()->Print(); // use option="a" to see ctors

     The use of the plugin library manager removes all textual references
     to hard-coded class and library names and the resulting dependencies
     in the base classes. The plugin manager is used to extend a.o.
     TFile, TSQLServer, TGrid, etc. functionality.

~TPluginManager()

     Clean up the plugin manager.

void LoadHandlersFromEnv(TEnv *env)

     Load plugin handlers specified in config file, like:
        Plugin.TFile:       ^rfio:    TRFIOFile      RFIO  "TRFIOFile(...)"
        Plugin.TSQLServer:  ^mysql:   TMySQLServer   MySQL "TMySQLServer(...)"
        +Plugin.TSQLServer: ^pgsql:   TPgSQLServer   PgSQL "TPgSQLServer(...)"
     The + allows the extension of an already defined resource (see TEnv).

void AddHandler(const char *base, const char *regexp, const char *className, const char *pluginName, const char *ctor)

     Add plugin handler to the list of handlers. If there is already a
     handler defined for the same base and regexp it will be replaced.

void RemoveHandler(const char *base, const char *regexp)

     Remove handler for the specified base class and the specified
     regexp. If regexp=0 remove all handlers for the specified base.

TPluginHandler* FindHandler(const char *base, const char *uri)

     Returns the handler if there exists a handler for the specified URI.
     The uri can be 0 in which case the first matching plugin handler
     will be returned. Returns 0 in case handler is not found.

void Print(Option_t *opt) const

     Print list of registered plugin handlers. If option is "a" print
     also the ctor's that will be used.

### Inline Functions

             TPluginManager TPluginManager()
                    TClass* Class()
                    TClass* IsA() const
                       void ShowMembers(TMemberInspector& insp, char* parent)
                       void Streamer(TBuffer& b)
                       void StreamerNVirtual(TBuffer& b)
             TPluginManager TPluginManager(const TPluginManager&)
            TPluginManager& operator=(const TPluginManager&)

Author: Fons Rademakers 26/1/2002
Last update: root/base:$Name: $:$Id: TPluginManager.cxx,v 1.26 2005/06/22 20:18:10 brun Exp $
Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. *