Salome HOME
Switch Wireframe/Shading with closing of context
[modules/shaper.git] / src / Config / Config_ModuleReader.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 /*
4  * Config_XMLModuleReader.h
5  *
6  *  Created on: Mar 20, 2014
7  *      Author: sbh
8  */
9
10 #ifndef CONFIG_MODULEREADER_H_
11 #define CONFIG_MODULEREADER_H_
12
13 #include <Config_def.h>
14 #include <Config_XMLReader.h>
15
16 #include <map>
17 #include <list>
18 #include <string>
19
20 class Config_ModuleReader : public Config_XMLReader
21 {
22   enum PluginType {
23     Binary = 0,
24     Intrenal = 1,
25     Python = 2
26   };
27   enum PluginPlatform {
28     All = 0,
29     OpenParts = 1,
30     Salome = 2
31   };
32
33  public:
34   CONFIG_EXPORT Config_ModuleReader(const char* theEventGenerated = 0);
35   CONFIG_EXPORT virtual ~Config_ModuleReader();
36
37   CONFIG_EXPORT const std::map<std::string, std::string>& featuresInFiles() const;
38
39   CONFIG_EXPORT std::string getModuleName();
40
41   CONFIG_EXPORT static void loadPlugin(const std::string thePluginName);
42   /// loads the library with specific name, appends "lib*.dll" or "*.so" depending on the platform
43   CONFIG_EXPORT static void loadLibrary(const std::string theLibName);
44   /// loads the python module with specified name
45   CONFIG_EXPORT static void loadScript(const std::string theFileName);
46
47  protected:
48   void processNode(xmlNodePtr aNode);
49   bool processChildren(xmlNodePtr aNode);
50
51   bool isAvaliableOnThisPlatform(const std::string& thePluginPlatform);
52   std::list<std::string> importPlugin(const std::string& thePluginLibrary,
53                                       const std::string& thePluginFile);
54   std::string addPlugin(const std::string& aPluginLibrary,
55                         const std::string& aPluginScript,
56                         const std::string& aPluginConf);
57
58  private:
59   std::map<std::string, std::string> myFeaturesInFiles;
60   static std::map<std::string, PluginType> myPluginTypes;
61   const char* myEventGenerated;
62   bool myHaveSalome;
63
64 };
65
66 #endif /* CONFIG_XMLMODULEREADER_H_ */