AnalysisLoader.hh

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #ifndef RIVET_AnalysisLoader_HH
00003 #define RIVET_AnalysisLoader_HH
00004 
00005 #include "Rivet/Rivet.hh"
00006 #include <map>
00007 #include <string>
00008 
00009 namespace Rivet {
00010 
00011 
00012   // Forward declarations
00013   class Analysis;
00014   class AnalysisBuilderBase;
00015 
00016 
00017   /// @brief Internal class which loads and registers analyses from plugin libs
00018   class AnalysisLoader {
00019   public:
00020 
00021     /// Get all the available analyses' names.
00022     static vector<string> analysisNames();
00023     static set<string> getAllAnalysisNames();
00024 
00025     /// Get an analysis by name.
00026     /// Warning: a name arg which matches no known analysis will return a null
00027     /// pointer. Check your return values before using them!
00028     static Analysis* getAnalysis(const string& analysisname);
00029 
00030     /// Get all the available analyses.
00031     static vector<Analysis*> getAllAnalyses();
00032 
00033 
00034   private:
00035     /// Allow the analysis builders to call the private _registerBuilder function
00036     friend class AnalysisBuilderBase;
00037 
00038     /// Register a new analysis builder
00039     static void _registerBuilder(const AnalysisBuilderBase* a);
00040 
00041     /// Load the available analyses at runtime.
00042     static void _loadAnalysisPlugins();
00043 
00044     typedef map<string, const AnalysisBuilderBase*> AnalysisBuilderMap;
00045     static AnalysisBuilderMap _ptrs;
00046 
00047   };
00048 
00049 
00050 }
00051 
00052 #endif