OpenMS
TVToolDiscovery.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: David Voigt $
6 // $Authors: David Voigt $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
12 
13 #include <future>
14 #include <map>
17 
18 namespace OpenMS
19 {
36  class OPENMS_GUI_DLLAPI TVToolDiscovery
37  {
38  public:
40  plugin_path_() {};
41 
42  TVToolDiscovery(const TVToolDiscovery&) = delete;
43 
45 
46  ~TVToolDiscovery() = default;
47 
50 
58 
66  const Param& getToolParams();
67 
74 
76  const std::vector<std::string>& getPlugins();
77 
84  [[maybe_unused]] bool setPluginPath(const String& path, bool create=false);
85 
87  void setVerbose(int verbosity_level);
88 
90  const std::string getPluginPath();
91 
93  std::string findPluginExecutable(const std::string& name);
94 
95  private:
99  static Param getParamFromIni_(const String& tool_path, bool plugins=false);
100 
105 
108 
110  std::string plugin_path_;
111 
113  std::vector<std::future<Param>> tool_param_futures_;
114  std::vector<std::future<Param>> plugin_param_futures_;
115 
118 
121 
123  std::vector<std::string> plugins_;
124 
126  int verbosity_level_ = 0;
127  };
128 }
Management and storage of parameters / INI files.
Definition: Param.h:44
A more convenient string class.
Definition: String.h:34
Scans for tools and generates a param for each asynchronously.
Definition: TVToolDiscovery.h:37
void waitForToolParams()
Wait for all future params to finish evaluating.
static Param getParamFromIni_(const String &tool_path, bool plugins=false)
const Param & getToolParams()
Returns a Param object containing the params for each tool/util.
Param plugin_params_
Contains all the params of the plugins.
Definition: TVToolDiscovery.h:120
void setVerbose(int verbosity_level)
set the verbosity level of the tool discovery for debug purposes
std::vector< std::future< Param > > tool_param_futures_
The futures for asyncronous loading of the tools and plugins.
Definition: TVToolDiscovery.h:113
const Param & getPluginParams()
Returns a param containing the params for each plugin.
const std::string getPluginPath()
Returns the current set path to search plugins in.
std::vector< std::future< Param > > plugin_param_futures_
Definition: TVToolDiscovery.h:114
bool setPluginPath(const String &path, bool create=false)
Sets the path that will be searched for Plugins.
TVToolDiscovery & operator=(const TVToolDiscovery &)=delete
const StringList getPlugins_()
Returns a list of executables that are found at the plugin path.
TVToolDiscovery()
Definition: TVToolDiscovery.h:39
TVToolDiscovery(const TVToolDiscovery &)=delete
std::string findPluginExecutable(const std::string &name)
Returns the path to the plugin executable or an empty string if the plugin name is unknown.
std::vector< std::string > plugins_
The names of all loaded plugins, this is used to add the plugins to the list in the ToolsDialog.
Definition: TVToolDiscovery.h:123
const std::vector< std::string > & getPlugins()
Returns the list of read plugin names as saved in the ini.
std::string plugin_path_
The filepath to search pugins in.
Definition: TVToolDiscovery.h:110
Param tool_params_
Contains all the params of the tools/utils.
Definition: TVToolDiscovery.h:117
void loadToolParams()
Start creating params for each tool/util asynchronously.
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:44
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19