|
crawlserv++
[under development]
Application for crawling and analyzing textual content of websites.
|
Structure containing all the data needed to keep the status of a thread updated. More...
#include <StatusSetter.hpp>
Properties | |
| std::string | currentStatus |
| The current status, to which the current progress will be added. More... | |
| float | progressAfter |
| The progress to which the thread will be (re-)set when the current task has been finished, in percent. More... | |
Callback Functions | |
| std::function< void(const std::string &)> | callbackSetStatus |
| Callback function to update the status message of the current thread. More... | |
| std::function< void(float)> | callbackSetProgress |
| Callback function to update the progress of the current thread, in percent. More... | |
| std::function< bool()> | callbackIsRunning |
| Callback function to check whether the current thread should still be running. More... | |
Constructor | |
| StatusSetter (const std::string &setCurrentStatus, float setProgressAfter, std::function< void(const std::string &)> callbackToSetStatus, std::function< void(float)> callbackToSetProgress, std::function< bool()> callbackToCheckIsRunning) | |
| Constructor setting the initial status. More... | |
| bool | change (const std::string &statusMessage) |
| Changes the status message and resets the current progress. More... | |
| bool | update (std::size_t done, std::size_t total) const |
| Updates the status with a fractal progress. More... | |
| bool | update (float percentage, bool precise) const |
| Updates the status with a percentage. More... | |
| bool | update (std::size_t done, std::size_t total, bool precise) const |
| Calculates the current percentage and updates the status accordingly. More... | |
| bool | isRunning () const |
| Checks whether the thread is still supposed to run. More... | |
| void | finish () const |
| Re-sets the progress of the thread. More... | |
Structure containing all the data needed to keep the status of a thread updated.
|
inline |
Constructor setting the initial status.
| setCurrentStatus | The current status that will be set on construction and updated on further progress. |
| setProgressAfter | The progress to which the thread should be set after finishing the task, in percent, or 1.F, if the progress should remain at 100% in the end. |
| callbackToSetStatus | The function (or lambda) that will be used to set the status message of the current thread. |
| callbackToSetProgress | The function (or lambda) that will be used to set the progress of the current thread, in percent. |
| callbackToCheckIsRunning | The function (or lambda) that will be used to check whether the thread is still supposed to run. |
References callbackIsRunning, callbackSetProgress, and callbackSetStatus.
|
inline |
Changes the status message and resets the current progress.
| statusMessage | Constant reference to a string containing the new status message. |
References callbackIsRunning, callbackSetProgress, and callbackSetStatus.
Referenced by crawlservpp::Module::Analyzer::Thread::checkCorpusSources(), crawlservpp::Module::Analyzer::Database::checkSources(), crawlservpp::Module::Analyzer::Thread::cleanUpQueries(), crawlservpp::Data::Corpus::clear(), crawlservpp::Data::Corpus::Corpus(), crawlservpp::Data::Corpus::filterArticles(), and crawlservpp::Module::Analyzer::Algo::TopicModelling::resetAlgo().
|
inline |
Re-sets the progress of the thread.
References callbackSetProgress, and callbackSetStatus.
Referenced by crawlservpp::Module::Analyzer::Database::checkSources(), crawlservpp::Data::Corpus::clear(), crawlservpp::Data::Corpus::filterArticles(), crawlservpp::Module::Analyzer::Algo::TopicModelling::resetAlgo(), crawlservpp::Data::Corpus::tokenizeCustom(), crawlservpp::Module::Parser::Database::updateOrAddEntries(), crawlservpp::Module::Extractor::Database::updateOrAddEntries(), and crawlservpp::Module::Extractor::Database::updateOrAddLinked().
|
inline |
Checks whether the thread is still supposed to run.
References callbackIsRunning.
Referenced by crawlservpp::Module::Analyzer::Database::checkSources(), crawlservpp::Module::Analyzer::Thread::cleanUpQueries(), crawlservpp::Data::Corpus::clear(), and crawlservpp::Module::Analyzer::Database::getCorpus().
|
inline |
Updates the status with a fractal progress.
| done | The number of processed units. |
| total | The total number of units to be processed. |
References callbackIsRunning, callbackSetProgress, callbackSetStatus, currentStatus, and crawlservpp::Helper::CommaLocale::locale().
Referenced by crawlservpp::Module::Analyzer::Database::checkSources(), crawlservpp::Data::Corpus::clear(), crawlservpp::Data::Corpus::filterArticles(), crawlservpp::Module::Analyzer::Algo::TopicModelling::resetAlgo(), update(), crawlservpp::Module::Parser::Database::updateOrAddEntries(), crawlservpp::Module::Extractor::Database::updateOrAddEntries(), and crawlservpp::Module::Extractor::Database::updateOrAddLinked().
|
inline |
Updates the status with a percentage.
| percentage | Progress between 0.F (none) and 1.F (done). |
| precise | If set to true, the progress will be added to the status with higher precision. |
References callbackIsRunning, callbackSetProgress, callbackSetStatus, currentStatus, crawlservpp::Struct::percentageFactor, and crawlservpp::Struct::precisionProgress.
|
inline |
Calculates the current percentage and updates the status accordingly.
| done | The number of processed units. |
| total | The total number of units to be processed. |
| precise | If set to true, the progress will be added to the status with higher precision. |
References update().
| std::function<bool()> crawlservpp::Struct::StatusSetter::callbackIsRunning |
Callback function to check whether the current thread should still be running.
Referenced by change(), isRunning(), StatusSetter(), and update().
| std::function<void(float)> crawlservpp::Struct::StatusSetter::callbackSetProgress |
Callback function to update the progress of the current thread, in percent.
Referenced by change(), finish(), StatusSetter(), and update().
| std::function<void(const std::string&)> crawlservpp::Struct::StatusSetter::callbackSetStatus |
Callback function to update the status message of the current thread.
Referenced by change(), finish(), StatusSetter(), and update().
| std::string crawlservpp::Struct::StatusSetter::currentStatus |
The current status, to which the current progress will be added.
Referenced by update().
| float crawlservpp::Struct::StatusSetter::progressAfter |
The progress to which the thread will be (re-)set when the current task has been finished, in percent.
Set to a value between 0.F (none) to 1.F (done).