Mantid
|
A class to allow the asynchronous finding of files. More...
#include <FindFilesWorker.h>
Public Slots | |
void | disconnectWorker () |
Signals | |
void | finished (const FindFilesSearchResults &) |
Signal emitted after the search is finished, regardless of whether any file was found. More... | |
Public Member Functions | |
FindFilesWorker (FindFilesSearchParameters parameters) | |
Constructor. More... | |
Protected Member Functions | |
virtual void | run () override |
Override parent class run(). More... | |
Private Member Functions | |
FindFilesSearchResults | createFindFilesSearchResult (const std::string &error, const std::vector< std::string > &filenames, const std::string &valueForProperty) |
Helper method to create a search result object. More... | |
void | finishSearching (const FindFilesSearchResults &result) |
Emit search result if required. More... | |
std::pair< std::vector< std::string >, std::string > | getFilesFromAlgorithm () |
Use the specified algorithm and property to find files instead of using the FileFinder. More... | |
Private Attributes | |
FindFilesSearchParameters | m_parameters |
Struct to hold the parameters of the search. More... | |
A class to allow the asynchronous finding of files.
Definition at line 60 of file FindFilesWorker.h.
FindFilesWorker::FindFilesWorker | ( | FindFilesSearchParameters | parameters | ) |
Constructor.
parameters | :: a struct representing the parameters of the file search |
Definition at line 31 of file FindFilesWorker.cpp.
|
private |
Helper method to create a search result object.
Create a struct containing the results of the search.
This will contain a string with an error (empty string if no error occured), a vector of filenames, and a value to display on the property of an algorithm
error | :: A user friendly error message or the empty string |
filenames | :: a vector of paths to files found by the search |
valueForProperty | :: a message to display on the algorithm's property |
Definition at line 180 of file FindFilesWorker.cpp.
References error, MantidQt::API::FindFilesSearchResults::error, MantidQt::API::FindFilesSearchResults::filenames, and MantidQt::API::FindFilesSearchResults::valueForProperty.
Referenced by run().
|
slot |
Definition at line 190 of file FindFilesWorker.cpp.
|
signal |
Signal emitted after the search is finished, regardless of whether any file was found.
Referenced by finishSearching().
|
private |
Emit search result if required.
Finish searching by emitting the results.
result | :: the result to return to the main thread. |
Definition at line 160 of file FindFilesWorker.cpp.
References finished().
Referenced by run().
|
private |
Use the specified algorithm and property to find files instead of using the FileFinder.
Create a list of files from the given algorithm property.
Definition at line 125 of file FindFilesWorker.cpp.
References MantidQt::API::FindFilesSearchParameters::algorithmName, MantidQt::API::FindFilesSearchParameters::algorithmProperty, Mantid::Kernel::VectorHelper::flattenVector(), Mantid::Kernel::SingletonHolder< T >::Instance(), m_parameters, MantidQt::API::FindFilesSearchParameters::searchText, and Mantid::Kernel::Property::value().
Referenced by run().
|
overrideprotectedvirtual |
Override parent class run().
Called when the thread is ran via start().
Tries to find the files, and populates the error and filenames member variables with the result of the search.
At present, there are two possible use cases:
Reimplemented in MantidQt::API::FakeFindFilesThread.
Definition at line 48 of file FindFilesWorker.cpp.
References MantidQt::API::FindFilesSearchParameters::algorithmName, MantidQt::API::FindFilesSearchParameters::algorithmProperty, createFindFilesSearchResult(), error, MantidQt::API::FindFilesSearchParameters::extensions, Mantid::API::FileFinderImpl::findRuns(), finishSearching(), getFilesFromAlgorithm(), Mantid::API::FileFinderImpl::getFullPath(), Mantid::Kernel::SingletonHolder< T >::Instance(), MantidQt::API::FindFilesSearchParameters::isForRunFiles, MantidQt::API::FindFilesSearchParameters::isOptional, m_parameters, and MantidQt::API::FindFilesSearchParameters::searchText.
|
private |
Struct to hold the parameters of the search.
Definition at line 91 of file FindFilesWorker.h.
Referenced by getFilesFromAlgorithm(), and run().