The CreateCollection class.
More...
#include <CreateCollection.h>
|
std::function< void()> | pulse |
| "Pulse" callback.
|
|
std::function< void(const double &)> | signal_total_bytes |
| "Total bytes" callback.
|
|
std::function< void(const double &progress)> | progress |
| "Progress" callback.
|
|
|
std::filesystem::path | base_path |
| Absolute path to database.
|
|
std::filesystem::path | books_path |
| Absolute path to books directory.
|
|
bool | rar_support = false |
| If true, rar archives will be processed, otherwise - not.
|
|
std::vector< std::tuple< std::filesystem::path, std::string > > | already_hashed |
| Hashed files.
|
|
std::vector< std::filesystem::path > | need_to_parse |
| "Need to parse" vector.
|
|
std::atomic< double > | current_bytes |
| Keeps quantity of bytes have been processed.
|
|
std::atomic< bool > | cancel |
| Stops all operations if true.
|
|
std::function< void()> | stop_all_signal |
| Stop signal for heir classes.
|
|
The CreateCollection class.
This class containes methods for collection database creation.
◆ CreateCollection() [1/2]
CreateCollection::CreateCollection |
( |
const std::shared_ptr< AuxFunc > & | af, |
|
|
const std::filesystem::path & | collection_path, |
|
|
const std::filesystem::path & | books_path, |
|
|
const bool & | rar_support, |
|
|
const int & | num_threads ) |
CreateCollection constructor.
- Parameters
-
af | smart pointer to AuxFunc object. |
collection_path | absolute path to collection base directory (if it doesnt exsist, MLBookProc will create it). |
books_path | absolute path to books directory. |
rar_support | if true, rar archives will be processed, otherwise - not (some rar archives can cause errors). |
num_threads | limit of working threads to be used. |
◆ CreateCollection() [2/2]
CreateCollection::CreateCollection |
( |
const std::shared_ptr< AuxFunc > & | af, |
|
|
const int & | num_threads ) |
|
protected |
CreateCollection constructor.
- Warning
- Do not call this constructor yourself!
This constructor is used by RefreshCollection class.
- Parameters
-
af | smart pointer to AuxFunc object. |
num_threads | limit of working threads to be used. |
◆ closeBaseFile()
void CreateCollection::closeBaseFile |
( |
| ) |
|
|
protected |
Finishes database writing.
- Warning
- Do not call this method yourself!
◆ createCollection()
void CreateCollection::createCollection |
( |
| ) |
|
Starts collection creation.
- Note
- This method can throw MLException in case of errors.
◆ openBaseFile()
void CreateCollection::openBaseFile |
( |
| ) |
|
|
protected |
Opens database file for writing.
- Warning
- Do not call this method yourself!
◆ threadRegulator()
void CreateCollection::threadRegulator |
( |
| ) |
|
|
protected |
Threads regulator.
- Warning
- Do not call this method yourself!
◆ write_file_to_base()
void CreateCollection::write_file_to_base |
( |
const FileParseEntry & | fe | ) |
|
|
protected |
Writes file data to database.
- Warning
- Do not call this method yourself!
- Parameters
-
◆ already_hashed
std::vector<std::tuple<std::filesystem::path, std::string> > CreateCollection::already_hashed |
|
protected |
Hashed files.
This vector is used by RefreshCollection class to indicate files, has been already hashed.
- Warning
- Do not call or set this vector yourself!
◆ base_path
std::filesystem::path CreateCollection::base_path |
|
protected |
Absolute path to database.
- Warning
- Do not call or set this variable yourself!
◆ books_path
std::filesystem::path CreateCollection::books_path |
|
protected |
Absolute path to books directory.
- Warning
- Do not call or set this variable yourself!
◆ current_bytes
std::atomic<double> CreateCollection::current_bytes |
|
protected |
Keeps quantity of bytes have been processed.
- Warning
- Do not call or set this variable yourself!
◆ need_to_parse
std::vector<std::filesystem::path> CreateCollection::need_to_parse |
|
protected |
"Need to parse" vector.
This vector is used to indicate files, needed to be parsed.
- Warning
- Do not call or set this vector yourself!
◆ progress
std::function<void(const double &progress)> CreateCollection::progress |
"Progress" callback.
Emitted after each file processing completion. Indicates total quantity of bytes has been processed. Bind your method to it, if you need such information.
◆ pulse
std::function<void()> CreateCollection::pulse |
"Pulse" callback.
Emitted while preliminary files collecting to show that process is not frozen. Bind your method to it, if you need such information.
◆ rar_support
bool CreateCollection::rar_support = false |
|
protected |
If true, rar archives will be processed, otherwise - not.
- Warning
- Do not call or set this variable yourself!
◆ signal_total_bytes
std::function<void(const double &)> CreateCollection::signal_total_bytes |
"Total bytes" callback.
Emitted after preliminary files collecting completed to indicate total quantity of bytes to be processed. Bind your method to it, if you need such information.