gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
PluginManager.h
Go to the documentation of this file.
1 // Gmsh - Copyright (C) 1997-2022 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5 
6 #ifndef PLUGIN_MANAGER_H
7 #define PLUGIN_MANAGER_H
8 
9 #include <map>
10 #include <string>
11 
12 class GMSH_Plugin;
13 class GMSH_SolverPlugin;
14 
16 private:
19  std::map<std::string, GMSH_Plugin *> allPlugins;
20 
21 public:
22  virtual ~PluginManager();
23 
24  // register all the plugins that are in $(GMSHPLUGINSHOME). (Note
25  // that loading a .so is not what is usually called a 'plugin': we
26  // should call the plugins 'modules'... A plugin is an executable,
27  // but that can only be executed from inside another program.)
29  static PluginManager *instance();
30 
31  // Dynamically add a plugin pluginName.so in dirName
32  void addPlugin(const std::string &fileName);
33 
34  // Uninstall a given plugin
35  void uninstallPlugin(const std::string &pluginName) {}
36 
37  // Set an option to a value in plugin named pluginName
38  void setPluginOption(const std::string &pluginName, const std::string &option,
39  double value);
40  void setPluginOption(const std::string &pluginName, const std::string &option,
41  const std::string &value);
42 
43  // Iterator on plugins
44  std::map<std::string, GMSH_Plugin *>::iterator begin()
45  {
46  return allPlugins.begin();
47  }
48  std::map<std::string, GMSH_Plugin *>::iterator end()
49  {
50  return allPlugins.end();
51  }
52 
53  // Find a plugin named pluginName
54  GMSH_Plugin *find(const std::string &pluginName);
55 
56  // Get The ONLY Solver Plugin
58 
59  // Perform an action on the plugin. Default action are Run and
60  // Save. Other plugins may perform other actions.
61  int action(const std::string &pluginName, const std::string &action,
62  void *data);
63 };
64 
65 #endif
PluginManager::setPluginOption
void setPluginOption(const std::string &pluginName, const std::string &option, double value)
Definition: PluginManager.cpp:152
PluginManager::action
int action(const std::string &pluginName, const std::string &action, void *data)
Definition: PluginManager.cpp:119
PluginManager::_instance
static PluginManager * _instance
Definition: PluginManager.h:18
PluginManager::PluginManager
PluginManager()
Definition: PluginManager.h:17
GMSH_Plugin
Definition: Plugin.h:26
PluginManager::instance
static PluginManager * instance()
Definition: PluginManager.cpp:169
PluginManager::~PluginManager
virtual ~PluginManager()
Definition: PluginManager.cpp:92
PluginManager::end
std::map< std::string, GMSH_Plugin * >::iterator end()
Definition: PluginManager.h:48
PluginManager::uninstallPlugin
void uninstallPlugin(const std::string &pluginName)
Definition: PluginManager.h:35
PluginManager::allPlugins
std::map< std::string, GMSH_Plugin * > allPlugins
Definition: PluginManager.h:19
PluginManager::addPlugin
void addPlugin(const std::string &fileName)
Definition: PluginManager.cpp:319
PluginManager
Definition: PluginManager.h:15
PluginManager::begin
std::map< std::string, GMSH_Plugin * >::iterator begin()
Definition: PluginManager.h:44
PluginManager::find
GMSH_Plugin * find(const std::string &pluginName)
Definition: PluginManager.cpp:99
GMSH_SolverPlugin
Definition: Plugin.h:119
PluginManager::findSolverPlugin
GMSH_SolverPlugin * findSolverPlugin()
Definition: PluginManager.cpp:106
PluginManager::registerDefaultPlugins
void registerDefaultPlugins()
Definition: PluginManager.cpp:175