51 gSystem->ExpandPathName(list_file_path);
53 ifstream list_file(list_file_path.
Data());
54 if (!list_file.is_open()) {
55 cout <<
"ERROR: cannot open the input text file: " << list_file_path << endl;
59 list<string> file_list;
61 while (getline(list_file, s)) {
63 size_t first = s.find_first_not_of(
" \t\r\n");
64 if (first == string::npos)
66 size_t last = s.find_last_not_of(
" \t\r\n");
67 file_list.push_back(s.substr(first, last - first + 1));
69 if (file_list.empty()) {
70 cout <<
"WARNING: There are no files in the list of the input text file: " << list_file_path << endl;
73 cout <<
"Total file records in the input text file: " << file_list.size() << endl;
76 unordered_map<string, vector<string>> period_files;
78 if (record_count < 0) {
79 cout <<
"ERROR: getting the raw file records of period " << period_number <<
" from the Database failed"
83 cout <<
"Raw file records of period " << period_number <<
" in the Database: " << record_count << endl;
85 vector<string> missing_files, single_files;
87 map<string, vector<string>> duplicate_files;
88 for (
auto const& cur_file_path : file_list) {
90 if (found == period_files.end())
91 missing_files.push_back(cur_file_path);
92 else if (found->second.size() == 1)
93 single_files.push_back(cur_file_path);
95 duplicate_files[cur_file_path] = found->second;
99 sort(missing_files.begin(), missing_files.end());
100 sort(single_files.begin(), single_files.end());
102 if (!missing_files.empty()) {
103 cout << endl <<
"Files missing in the raw_file table for period " << period_number <<
":" << endl;
104 for (
auto const& cur_file_path : missing_files)
105 cout << cur_file_path << endl;
107 if (!duplicate_files.empty()) {
109 <<
"Files present in the raw_file table for period " << period_number <<
" more than once:" << endl;
110 for (
auto const& [cur_file_path, records] : duplicate_files) {
111 cout << cur_file_path << endl;
112 for (
auto const& record : records)
113 cout <<
" " << record << endl;
116 if (!single_files.empty()) {
117 cout << endl <<
"Files present in the raw_file table for period " << period_number <<
" once:" << endl;
118 for (
auto const& cur_file_path : single_files)
119 cout << cur_file_path << endl;
123 <<
"Missing: " << missing_files.size() <<
", present more than once: " << duplicate_files.size()
124 <<
", present once: " << single_files.size() << endl;