File: percent_progress.h

package info (click to toggle)
kmc 3.2.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,716 kB
  • sloc: cpp: 38,308; python: 664; makefile: 216; perl: 179; sh: 34
file content (49 lines) | stat: -rw-r--r-- 1,259 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
  This file is a part of KMC software distributed under GNU GPL 3 licence.
  The homepage of the KMC project is http://sun.aei.polsl.pl/kmc
  
  Authors: Marek Kokot
  
  Version: 3.2.4
  Date   : 2024-02-09
*/

#ifndef _PERCENT_PROGRESS_H
#define _PERCENT_PROGRESS_H

#include "defs.h"
#include <vector>
#include <string>
//************************************************************************************************************
// CPercentProgress - class to display progress of reading inputs
//************************************************************************************************************
class CPercentProgress
{
	bool ignore_rest = false;
	bool hide_progress = false;
	struct CDisplayItem
	{
		std::string name;
		uint64 cur_val = 0;
		uint64 max_val;
		uint32 cur_percent = 0;

		uint32 to_next_update;
		uint32 to_next_update_pattern;
	public:
		CDisplayItem(const std::string name, uint64 max_val);
	};
	std::vector<CDisplayItem> items;
	void display();
public:
	uint32 RegisterItem(const std::string& name, uint64 max_value);
	uint32 RegisterItem(uint64 max_value);
	void UpdateItem(uint32 id);
	void Complete(uint32 id);
	void UpdateItem(uint32 id, uint32 offset);
	void Hide(){ hide_progress = true; }
};

#endif

// ***** EOF