Plugin Management Fons Rademakers 1182022 1 ROOT Plugin

  • Slides: 8
Download presentation
Plugin Management Fons Rademakers 1/18/2022 1

Plugin Management Fons Rademakers 1/18/2022 1

ROOT Plugin Manager n Plugin is simple shared library n n No special tokens,

ROOT Plugin Manager n Plugin is simple shared library n n No special tokens, functions, etc. Plugin is registered in [system]. rootrc (i. e. plugin cache) Plugin. TFile: ^rfio: TRFIOFile RFIO “TRFIOFile(const char*, Option_t*, const char*, Int_t)” n n Plugin factory via CINT call of ctor as described in rootrc (need dictionary of class). Class location and plugin dependencies recorded in [system]. rootmap Library. TMinuit: 1/18/2022 lib. Minuit. so lib. Graf. so lib. Hist. so lib. Matrix. so 2

Using a ROOT Plugin n In the code the RFIO file plugin is loaded

Using a ROOT Plugin n In the code the RFIO file plugin is loaded an TRFIOFile object is created using: // name = “rfio: /cern. ch/user/r/rdm/bla. root” TPlugin. Handler *h = g. ROOT->Get. Plugin. Manager()->Find. Handler(“TFile”, name); if (h && h->Load. Plugin() != -1) file = (TFile*) h->Exec. Plugin(4, name, option, ftitle, compress); 1/18/2022 3

Missing Features n ROOT plugins are not self describing n n The rootrc description

Missing Features n ROOT plugins are not self describing n n The rootrc description cannot be obtained or recovered from plugin Therefore must be maintained by hand 1/18/2022 4

SEAL Plugin Manager n Plugin is a shared library with special entry points describing

SEAL Plugin Manager n Plugin is a shared library with special entry points describing the plugin DEFINE_SEAL_MODULE(); DEFINE_SEAL_PLUGIN(Some. Factory, My. Object, “My. Object Registration Name”); n Plugins support callbacks for different actions: query, attach and detach DEFINE_MODULE_ATTACH_ACTION((&foo)); n Support capability plugins, just loading these plugins is enough, not used to create objects 1/18/2022 5

SEAL Plugin Factory n User has to define and implement factory class Some. Factory

SEAL Plugin Factory n User has to define and implement factory class Some. Factory : public seal: : Plugin. Factory<Some. Object *(int, double)> { Some. Factory(); static Some. Factory s_instance; public: static Some. Factory *get(); }; Some. Factory: : Some. Factory() : seal: : Plugin. Factory<Some. Object *(int, double)>(“Factory Label”) {} Some. Factory *Some. Factory: : get() { return &s_instance; } 1/18/2022 6

Using a SEAL Plugin n In the code a SEAL plugin is used like:

Using a SEAL Plugin n In the code a SEAL plugin is used like: seal: : Plugin. Manager: : get()->initialise(); P = Some. Factory: : get()->create(“My. Object Registration Name”); n At program startup the SEAL_PLUGINS defined list of directories are scanned for new plugins, new plugins are loaded and added to the cache n On the fly cache management potentially expensive 1/18/2022 7

Best of Both Worlds n n n Make ROOT plugins self describing Add external

Best of Both Worlds n n n Make ROOT plugins self describing Add external cache management, like “ldconfig” Generate factory method via simple script n n Call factory via interpreter but do not require dictionary for full plugin class, only for simple factory method Automatic dependency generation (rootmap) is still difficult, very machine dependent (depends on name mangling schemes) 1/18/2022 8