-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathBarcodeStatisticsRecorder.h
More file actions
124 lines (106 loc) · 3.27 KB
/
BarcodeStatisticsRecorder.h
File metadata and controls
124 lines (106 loc) · 3.27 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#pragma once
#include "stdafx.h"
#include <string>
#include <list>
#include<vector>
using namespace std;
#if defined(_WIN64) || defined(_WIN32)
#define strcasecmp stricmp
#define separator "\\"
#else
#define separator "/"
#endif
class CBarcodeStatisticsRecorder
{
public:
CBarcodeStatisticsRecorder();
~CBarcodeStatisticsRecorder();
typedef enum _emResultState {
STATE_INVALID,
STATE_OK,
STATE_FAILED,
}RESULT_STATE;
typedef struct _tagCodeValue {
string strTextMessage;
string strCodeFormat;
string strHexMessage;
}BCODE_VALUE;
typedef struct _tagDecodeResult {
string strFileName;
string strErrorMessage;
list<BCODE_VALUE> listCodes;
double dDecodeTime; //ms
RESULT_STATE state;
}DecodeResultInfo, *PDecodeResultInfo;
typedef struct _tagStatisticsResult
{
int nTotalFiles;
int nSuccessDecodeFiles;
double dSuccessRate;
double dTotalDecodeTimes;
double dAvgDecodeTimes;//for each code or file?
int nTotalCodes;
}DecodeStatisticsResult, *PDecodeStatisticsResult;
typedef struct _tagRunningTaceInfo
{
string SCAN_DIRECTORY;// DOCUMENT_PATH;
string CURRENT_FILE_PATH;
string CURRENT_FILE_STATUE;
string BCODE_READER;
string OUTPUT_FILE_PATH;
size_t CURRENT_POS_SIZE;
string LAST_FILE_PATH;
size_t LAST_POS_SIZE;
size_t TOTAL_IMAGE_COUNT;
size_t IMAGES_WITH_BARCODES_RECOGNIZED;
size_t TIME_COST_OF_ALL_IMAGES;
size_t TIME_COST_OF_IMAGES_WITH_BARCODES_RECOGNIZED;
size_t TOTAL_BARCODE_COUNT;
size_t RESUMED_TIMES;
string DECODE_SETTING_FILE;
_tagRunningTaceInfo() {
CURRENT_POS_SIZE = 0;
LAST_POS_SIZE = 0;
TOTAL_IMAGE_COUNT = 0;
IMAGES_WITH_BARCODES_RECOGNIZED = 0;
TIME_COST_OF_ALL_IMAGES = 0;
TIME_COST_OF_IMAGES_WITH_BARCODES_RECOGNIZED = 0;
TOTAL_BARCODE_COUNT = 0;
RESUMED_TIMES = 0;
DECODE_SETTING_FILE = "";
OUTPUT_FILE_PATH = "";
CURRENT_FILE_PATH = "";
BCODE_READER = "";
LAST_FILE_PATH = "";
CURRENT_FILE_STATUE = "STATE_INVALID";
}
}RUNNING_TRACE_INFO;
private:
vector<DecodeResultInfo> m_vctDecodeResults;
ostream *m_pOStream,*m_pContentOStream;
RUNNING_TRACE_INFO m_runningTraceInfo;
bool m_bTraceThePoint;
string m_outputFilePath;
string m_scanDirectory;
private:
void RemoveReaderRunningTrace();
void OutputDecodResult(DecodeResultInfo *resultMode);
void OutputStatisticsResult();
string Base64encodestring(const string &strString);
string Base64decodestring(const string &strString);
public:
void Initialization(string &lastScanFileDir, string &lastDecodeBarcodeOutputFilepath);
void StartRecord(ostream *pOstream, ostream *pContentOstream, string scanFileDir, string outputFilepath);
void RecordStatisticsData(DecodeResultInfo decodeResult);
bool FindLastScanPoint(string currentFilePath);
void StopRecord();
RUNNING_TRACE_INFO LoadReaderRunningTrace();
void RecordReaderRunningTrace(RUNNING_TRACE_INFO runningTraceInfo);
void AddDecodeResult(DecodeResultInfo decodeResult);
size_t GetDecodeResultSize();
bool FindDecodeResultByFilePath(const string strFileName, CBarcodeStatisticsRecorder::DecodeResultInfo &decodeResultInfo);
bool FindDecodeResultByIndex(const int index,CBarcodeStatisticsRecorder::DecodeResultInfo &decodeResultInfo);
void ClearDecodeResult();
vector<DecodeResultInfo> getDecodeResultList();
DecodeStatisticsResult DoDataStatistics();
};