Skip to content
Snippets Groups Projects
  • Fons Rademakers's avatar
    29468b90
    Updated TPluginManager. Plugin handlers can now be specified wia macros · 29468b90
    Fons Rademakers authored
    in a list of plugin directories. These new features are implemented via
    two new methods described below. These changes are fully backward compatible
    and plugin descriptions in rootrc files still work. However, using the new
    macros we only load in program memory the handlers for the needed plugins,
    instead of the almost 100 handlers of all plugins. For example after starting
    root.exe, only these handlers are loaded:
    
    root [0] gPluginMgr->Print()
    =====================================================================
    Base                 Regexp        Class              Plugin
    =====================================================================
    TSystem              ^rfio:        TRFIOSystem        RFIO
    TSystem              ^castor:      TRFIOSystem        RFIO
    TSystem              ^dcache:      TDCacheSystem      DCache
    TSystem              ^dcap:        TDCacheSystem      DCache
    TSystem              ^alien:       TAlienSystem       RAliEn
    TSystem              ^root:        TXNetSystem        Netx
    =====================================================================
    6 plugin handlers registered
    [*] plugin not available
    =====================================================================
    
    For more see below:
    
    
    void TPluginManager::LoadHandlersFromPluginDirs(const char *base)
    
    Load plugin handlers specified via macros in a list of plugin
    directories. The $ROOTSYS/etc/plugins is the default top plugin directory
    specified in $ROOTSYS/etc/system.rootrc. The macros must have names
    like <BaseClass>/PX0_<PluginClass>.C, e.g.:
       TFile/P10_TRFIOFile.C, TSQLServer/P20_TMySQLServer.C, etc.
    to allow easy sorting and grouping. Macros not beginning with 'P' and
    ending with ".C" are ignored. If base is specified only plugin macros for
    that base class are loaded. The macros typically should look like:
    
       void P10_TDCacheFile()
       {
           gPluginMgr->AddHandler("TFile", "^dcache", "TDCacheFile",
              "DCache", "TDCacheFile(const char*,Option_t*,const char*,Int_t)");
       }
    
    In general these macros should not cause side effects, by changing global
    ROOT state via, e.g. gSystem calls, etc. However, in specific cases
    this might be useful, e.g. adding a library search path, adding a specific
    dependency, check on some OS or ROOT capability or downloading
    of the plugin.
    
    
    Int_t TPluginManager::WritePluginMacros(const char *dir, const char *plugin)
    
    Write in the specified directory the plugin macros. If plugin is specified
    and if it is a base class all macros for that base will be written. If it
    is a plugin class name, only that one macro will be written. If plugin
    is 0 all macros are written. Returns -1 if dir does not exist, 0 otherwise.
    This method allows the regeneration of the entire tree of plugin macros
    in case we ever decide to change something in the macros.
    
    
    git-svn-id: http://root.cern.ch/svn/root/trunk@19373 27541ba8-7e3a-0410-8455-c3a389f83636
    29468b90
    History
    Updated TPluginManager. Plugin handlers can now be specified wia macros
    Fons Rademakers authored
    in a list of plugin directories. These new features are implemented via
    two new methods described below. These changes are fully backward compatible
    and plugin descriptions in rootrc files still work. However, using the new
    macros we only load in program memory the handlers for the needed plugins,
    instead of the almost 100 handlers of all plugins. For example after starting
    root.exe, only these handlers are loaded:
    
    root [0] gPluginMgr->Print()
    =====================================================================
    Base                 Regexp        Class              Plugin
    =====================================================================
    TSystem              ^rfio:        TRFIOSystem        RFIO
    TSystem              ^castor:      TRFIOSystem        RFIO
    TSystem              ^dcache:      TDCacheSystem      DCache
    TSystem              ^dcap:        TDCacheSystem      DCache
    TSystem              ^alien:       TAlienSystem       RAliEn
    TSystem              ^root:        TXNetSystem        Netx
    =====================================================================
    6 plugin handlers registered
    [*] plugin not available
    =====================================================================
    
    For more see below:
    
    
    void TPluginManager::LoadHandlersFromPluginDirs(const char *base)
    
    Load plugin handlers specified via macros in a list of plugin
    directories. The $ROOTSYS/etc/plugins is the default top plugin directory
    specified in $ROOTSYS/etc/system.rootrc. The macros must have names
    like <BaseClass>/PX0_<PluginClass>.C, e.g.:
       TFile/P10_TRFIOFile.C, TSQLServer/P20_TMySQLServer.C, etc.
    to allow easy sorting and grouping. Macros not beginning with 'P' and
    ending with ".C" are ignored. If base is specified only plugin macros for
    that base class are loaded. The macros typically should look like:
    
       void P10_TDCacheFile()
       {
           gPluginMgr->AddHandler("TFile", "^dcache", "TDCacheFile",
              "DCache", "TDCacheFile(const char*,Option_t*,const char*,Int_t)");
       }
    
    In general these macros should not cause side effects, by changing global
    ROOT state via, e.g. gSystem calls, etc. However, in specific cases
    this might be useful, e.g. adding a library search path, adding a specific
    dependency, check on some OS or ROOT capability or downloading
    of the plugin.
    
    
    Int_t TPluginManager::WritePluginMacros(const char *dir, const char *plugin)
    
    Write in the specified directory the plugin macros. If plugin is specified
    and if it is a base class all macros for that base will be written. If it
    is a plugin class name, only that one macro will be written. If plugin
    is 0 all macros are written. Returns -1 if dir does not exist, 0 otherwise.
    This method allows the regeneration of the entire tree of plugin macros
    in case we ever decide to change something in the macros.
    
    
    git-svn-id: http://root.cern.ch/svn/root/trunk@19373 27541ba8-7e3a-0410-8455-c3a389f83636