Revision 537f40e6
Added by David Sorber almost 8 years ago
| software/photo_compress_archiver/PhotoCompressArchiver.hh | ||
|---|---|---|
|
const std::string YELLOW("\033[33m");
|
||
|
const std::string PURPLE("\033[35m");
|
||
|
|
||
|
const std::string version("v0.2.0");
|
||
|
const std::string version("v0.3.0");
|
||
|
|
||
|
const boost::regex JPEG_REGEX("^.+\\.(jpg)|(jpeg)$", boost::regex::icase);
|
||
|
const boost::regex PJG_REGEX("^.+\\.pjg$", boost::regex::icase);
|
||
| ... | ... | |
|
: m_path(path),
|
||
|
m_file_size(0)
|
||
|
{
|
||
|
// Automagically determine the file size
|
||
|
m_file_size = bfs::file_size(path);
|
||
|
};
|
||
|
};
|
||
| ... | ... | |
|
|
||
|
PhotoCompressArchiver(
|
||
|
const std::string& path,
|
||
|
uint32_t num_cores,
|
||
|
uint32_t num_threads,
|
||
|
bool decompress,
|
||
|
bool keep_orig,
|
||
|
bool delete_orig,
|
||
|
boost::regex& filter_regex);
|
||
|
|
||
|
~PhotoCompressArchiver();
|
||
| ... | ... | |
|
private:
|
||
|
|
||
|
const bfs::path m_path; // top level path where to look for input files
|
||
|
uint32_t m_num_cores; // number of cores on the machine
|
||
|
uint32_t m_num_threads; // number of processing threads to use
|
||
|
bool m_decompress; // decompress files instead of compress them
|
||
|
bool m_keep_orig; // keep; don't delete original files
|
||
|
bool m_delete_orig; // delete original files after de/compression
|
||
|
|
||
|
std::mutex m_output_mutex; // output mutex
|
||
|
|
||
| ... | ... | |
|
// input file list (either images or compressed images)
|
||
|
ProtectedAndSynchronizedQueue<WorkUnit*> m_file_list;
|
||
|
|
||
|
// list of any errors
|
||
|
ProtectedAndSynchronizedQueue<WorkUnit*> m_errors;
|
||
|
|
||
|
std::thread* p_finder_thread; // file finder thread
|
||
|
std::vector<std::thread*> m_worker_threads; // worker threads
|
||
|
|
||
Continued improvements to PCA; handle errors better, make number of
processing threads configurable, and reversed the "keep-orig" option to
"delete-orig" which makes more sense.