Salome HOME
FIx for issue #360 : make switching on/off checking of transactions in Session -...
[modules/shaper.git] / src / Config / Config_ModuleReader.h
index c32eb37d96f566b537068a45f614dbef66e513e9..911e5d813c8afa10b11f37a859812378cccb5202 100644 (file)
 
 #include <map>
 #include <list>
+#include <set>
 #include <string>
 
+/*!
+ * \class Config_ModuleReader
+ * \brief Class to process plugins.xml - definition of plugins (scripts, libraries).
+ */
 class Config_ModuleReader : public Config_XMLReader
 {
   enum PluginType {
@@ -24,11 +29,6 @@ class Config_ModuleReader : public Config_XMLReader
     Intrenal = 1,
     Python = 2
   };
-  enum PluginPlatform {
-    All = 0,
-    OpenParts = 1,
-    Salome = 2
-  };
 
  public:
   CONFIG_EXPORT Config_ModuleReader(const char* theEventGenerated = 0);
@@ -38,17 +38,20 @@ class Config_ModuleReader : public Config_XMLReader
 
   CONFIG_EXPORT std::string getModuleName();
 
-  CONFIG_EXPORT static void loadPlugin(const std::string thePluginName);
+  CONFIG_EXPORT static void loadPlugin(const std::string& thePluginName);
   /// loads the library with specific name, appends "lib*.dll" or "*.so" depending on the platform
-  CONFIG_EXPORT static void loadLibrary(const std::string theLibName);
+  CONFIG_EXPORT static void loadLibrary(const std::string& theLibName);
   /// loads the python module with specified name
-  CONFIG_EXPORT static void loadScript(const std::string theFileName);
+  CONFIG_EXPORT static void loadScript(const std::string& theFileName);
+  // extends set of modules, which will be used for dependency 
+  // checking (if there is no required module in the set, a plugin will not be loaded)
+  CONFIG_EXPORT static void addDependencyModule(const std::string& theModuleName);
 
  protected:
   void processNode(xmlNodePtr aNode);
   bool processChildren(xmlNodePtr aNode);
 
-  bool isAvaliableOnThisPlatform(const std::string& thePluginPlatform);
+  bool hasRequiredModules(xmlNodePtr aNode) const;
   std::list<std::string> importPlugin(const std::string& thePluginLibrary,
                                       const std::string& thePluginFile);
   std::string addPlugin(const std::string& aPluginLibrary,
@@ -58,9 +61,8 @@ class Config_ModuleReader : public Config_XMLReader
  private:
   std::map<std::string, std::string> myFeaturesInFiles;
   static std::map<std::string, PluginType> myPluginTypes;
+  static std::set<std::string> myDependencyModules;
   const char* myEventGenerated;
-  bool myHaveSalome;
-
 };
 
 #endif /* CONFIG_XMLMODULEREADER_H_ */