Revision ebc2733a
Added by David Sorber almost 8 years ago
| software/photo_compress_archiver/PhotoCompressArchiver.hh | ||
|---|---|---|
|
const std::string RED("\033[31m");
|
||
|
const std::string YELLOW("\033[33m");
|
||
|
const std::string PURPLE("\033[35m");
|
||
|
const std::string UP_ONE = "\033[1A";
|
||
|
const std::string DOWN_ONE = "\033[1B";
|
||
|
|
||
|
const std::string version("v0.3.5");
|
||
|
|
||
| ... | ... | |
|
const std::string JPG_EXTENSION(".jpg");
|
||
|
const std::string PJG_EXTENSION(".pjg");
|
||
|
|
||
|
const uint32_t PROGRESS_BAR_WIDTH = 80;
|
||
|
|
||
|
class WorkUnit
|
||
|
{
|
||
|
public:
|
||
| ... | ... | |
|
uint32_t num_threads,
|
||
|
bool decompress,
|
||
|
bool delete_orig,
|
||
|
bool verbose,
|
||
|
boost::regex& filter_regex);
|
||
|
|
||
|
~PhotoCompressArchiver();
|
||
| ... | ... | |
|
* m_files_processed and m_num_input_files instance variables.
|
||
|
*/
|
||
|
double get_global_percent_done();
|
||
|
|
||
|
/**
|
||
|
* Asynchronously terminate processing.
|
||
|
*/
|
||
|
void terminate();
|
||
|
|
||
|
private:
|
||
|
|
||
| ... | ... | |
|
uint32_t m_num_threads; // number of processing threads to use
|
||
|
bool m_decompress; // decompress files instead of compress them
|
||
|
bool m_delete_orig; // delete original files after de/compression
|
||
|
bool m_verbose ; // verbose processing output
|
||
|
|
||
|
std::mutex m_output_mutex; // output mutex
|
||
|
|
||
|
bool m_terminate_flag; // terminate flag
|
||
|
|
||
|
std::atomic<uint32_t> m_files_processed; // number of input files processed
|
||
|
uint32_t m_num_input_files; // total number of input files found
|
||
|
uint64_t m_total_uncompressed_size; // total uncompressed size of all images
|
||
|
uint64_t m_total_compressed_size; // total compressed size of all images
|
||
|
uint64_t m_running_compressed_size; // running compressed size (for status)
|
||
|
|
||
|
// input file list (either images or compressed images)
|
||
|
ProtectedAndSynchronizedQueue<WorkUnit*> m_file_list;
|
||
Adding non-verbose mode with "running" status information and progress
bar. Also added terminate function in preparation of adding proper
SIGINT handling.