OpenMS  2.7.0
Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
TVToolDiscovery Class Reference

Scans for tools/utils and generates a param for each asynchronously. More...

#include <OpenMS/VISUAL/TVToolDiscovery.h>

Collaboration diagram for TVToolDiscovery:
[legend]

Public Member Functions

 TVToolDiscovery ()
 
 TVToolDiscovery (const TVToolDiscovery &)=delete
 
TVToolDiscoveryoperator= (const TVToolDiscovery &)=delete
 
 ~TVToolDiscovery ()
 
void loadParams ()
 Start creating params for each tool/util asynchronously. More...
 
void waitForParams ()
 Wait for all future params to finish evaluating. More...
 
const std::map< std::string, Param > & getToolParams ()
 Returns a hash map containing a param for each tool/util. More...
 

Static Private Member Functions

static Param getParamFromIni_ (const std::string &tool_name)
 Returns param for a given tool/util. This function is thread-safe. More...
 

Private Attributes

std::map< std::string, std::future< Param > > param_futures_
 Contains a param future for each tool/util name. More...
 
std::map< std::string, Paramparams_
 Contains a mapping of each tool/util name to its param. More...
 

Detailed Description

Scans for tools/utils and generates a param for each asynchronously.

All tools and utils listed in the ToolHandler class are considered.

scanner.loadParams();
// Do something else before explicitly waiting for the threads to finish
...
// Wait when convenient. Keeps the GUI responsive while waiting
scanner.waitForParams();
// Access the params. If no special timing for waiting or loading is needed this function can be safely called directly.
scanner.getToolParams();
TVToolDiscovery()
Definition: TVToolDiscovery.h:64

Constructor & Destructor Documentation

◆ TVToolDiscovery() [1/2]

TVToolDiscovery ( )
inline

◆ TVToolDiscovery() [2/2]

TVToolDiscovery ( const TVToolDiscovery )
delete

◆ ~TVToolDiscovery()

~TVToolDiscovery ( )
inline

Member Function Documentation

◆ getParamFromIni_()

static Param getParamFromIni_ ( const std::string &  tool_name)
staticprivate

Returns param for a given tool/util. This function is thread-safe.

◆ getToolParams()

const std::map<std::string, Param>& getToolParams ( )

Returns a hash map containing a param for each tool/util.

Note that it is possible that not all param futures have been finished (or loaded) yet if this function is called. In that case, the function starts param parsing (loadParam()) and waits for completion (waitForParams()) before returning the result.

Referenced by TOPPViewBase::addToolParamsToIni_().

◆ loadParams()

void loadParams ( )

Start creating params for each tool/util asynchronously.

Referenced by TOPPViewBase::loadPreferences().

◆ operator=()

TVToolDiscovery& operator= ( const TVToolDiscovery )
delete

◆ waitForParams()

void waitForParams ( )

Wait for all future params to finish evaluating.

While waiting the GUI remains responsive. After waiting it is safe to access the params without further waiting.

Referenced by TOPPViewBase::addToolParamsToIni_().

Member Data Documentation

◆ param_futures_

std::map<std::string, std::future<Param> > param_futures_
private

Contains a param future for each tool/util name.

◆ params_

std::map<std::string, Param> params_
private

Contains a mapping of each tool/util name to its param.