X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConfig%2FConfig_ModuleReader.h;h=911e5d813c8afa10b11f37a859812378cccb5202;hb=60e95a5502a6940c6c27ce5d561b3c684b0b0a4f;hp=7083315b1426b42a3bbedfd57e521c2d7081a503;hpb=ec70f37d26f584bdd46983837b01407429f29478;p=modules%2Fshaper.git diff --git a/src/Config/Config_ModuleReader.h b/src/Config/Config_ModuleReader.h index 7083315b1..911e5d813 100644 --- a/src/Config/Config_ModuleReader.h +++ b/src/Config/Config_ModuleReader.h @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + /* * Config_XMLModuleReader.h * @@ -8,37 +10,59 @@ #ifndef CONFIG_MODULEREADER_H_ #define CONFIG_MODULEREADER_H_ -#include +#include #include #include +#include +#include #include - -class Config_ModuleReader: public Config_XMLReader +/*! + * \class Config_ModuleReader + * \brief Class to process plugins.xml - definition of plugins (scripts, libraries). + */ +class Config_ModuleReader : public Config_XMLReader { + enum PluginType { + Binary = 0, + Intrenal = 1, + Python = 2 + }; -public: + public: CONFIG_EXPORT Config_ModuleReader(const char* theEventGenerated = 0); CONFIG_EXPORT virtual ~Config_ModuleReader(); - CONFIG_EXPORT void setAutoImport(bool enabled); - CONFIG_EXPORT const std::map& plugins() const; + CONFIG_EXPORT const std::map& featuresInFiles() const; CONFIG_EXPORT std::string getModuleName(); -protected: + 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); + /// loads the python module with specified name + 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); - void importPlugin(const std::string& thePluginName, - const std::string& thePluginLibrary = ""); + bool hasRequiredModules(xmlNodePtr aNode) const; + std::list importPlugin(const std::string& thePluginLibrary, + const std::string& thePluginFile); + std::string addPlugin(const std::string& aPluginLibrary, + const std::string& aPluginScript, + const std::string& aPluginConf); -private: - bool myIsAutoImport; - std::map myPluginsMap; + private: + std::map myFeaturesInFiles; + static std::map myPluginTypes; + static std::set myDependencyModules; const char* myEventGenerated; - }; #endif /* CONFIG_XMLMODULEREADER_H_ */