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 class AnalysisLoader { 00018 public: 00019 00020 /// Get all the available analyses' names. 00021 static vector<string> analysisNames(); 00022 static set<string> getAllAnalysisNames(); 00023 00024 /// Get an analysis by name. 00025 /// Warning: a name arg which matches no known analysis will return a null 00026 /// pointer. Check your return values before using them! 00027 static Analysis* getAnalysis(const string& analysisname); 00028 00029 /// Get all the available analyses. 00030 static vector<Analysis*> getAllAnalyses(); 00031 00032 00033 private: 00034 /// Allow the analysis builders to call the private _registerBuilder function 00035 friend class AnalysisBuilderBase; 00036 00037 /// Register a new analysis builder 00038 static void _registerBuilder(const AnalysisBuilderBase* a); 00039 00040 /// Load the available analyses at runtime. 00041 static void _loadAnalysisPlugins(); 00042 00043 typedef map<string, const AnalysisBuilderBase*> AnalysisBuilderMap; 00044 static AnalysisBuilderMap _ptrs; 00045 00046 }; 00047 00048 00049 } 00050 00051 #endif