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