From 893538752d402dcbc2e9f71d5dd0e196047b297e Mon Sep 17 00:00:00 2001 From: "art1@andreas-romeyke.de" Date: Sun, 3 Jun 2018 14:51:56 +0200 Subject: [PATCH] - using mulitmap calling get_checksum_file_pairs() --- src/lib/payloadmanifest.cpp | 10 ++++++++-- src/lib/tagmanifest.cpp | 25 ++++++++++++++++++------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/lib/payloadmanifest.cpp b/src/lib/payloadmanifest.cpp index d68f0a2..2732fc7 100644 --- a/src/lib/payloadmanifest.cpp +++ b/src/lib/payloadmanifest.cpp @@ -27,10 +27,13 @@ Payloadmanifest::Payloadmanifest( string basedir ) { if (fs::is_regular_file( s)) { Payloadmanifest::manifest_algorithm_files[it->first] = filename; // debug - cout << "PAYLOADMANIFEST: alg="<< it->first << " => filename=" << it->second << endl; + //cout << "PAYLOADMANIFEST: alg="<< it->first << " => filename=" << it->second << endl; // cout << " alg="<< it->first << " => filename=" << Payloadmanifest::manifest_algorithm_files[it->first] << endl; } } + //cout << "PAYLOADMANIFEST constructor, calling debug()" << endl; + //this->debug(); + //cout << "PAYLOADMANIFEST constructor, finished" << endl; } bool Payloadmanifest::validate( list & log ) { @@ -38,11 +41,14 @@ bool Payloadmanifest::validate( list & log ) { bool tmp = Manifest::validate( log ); if (false == tmp) { is_valid = false; } // check if at least one payload file exist - cout << "payload_manifest: " << this->manifest_algorithm_files.size() << endl; + //cout << "payload_manifest: " << this->manifest_algorithm_files.size() << endl; if (0 == this->manifest_algorithm_files.size()) { log.push_back("Bagit payloadmanifest count greater zero expected, but " + to_string(this->manifest_algorithm_files.size()) + " found"); is_valid = false; } + //cout << "PAYLOADMANIFEST validate, calling debug()" << endl; + //this->debug(); + //cout << "PAYLOADMANIFEST validate, finished" << endl; return is_valid; } diff --git a/src/lib/tagmanifest.cpp b/src/lib/tagmanifest.cpp index 22893d2..ef46620 100644 --- a/src/lib/tagmanifest.cpp +++ b/src/lib/tagmanifest.cpp @@ -19,30 +19,41 @@ Tagmanifest::Tagmanifest( string basedir ) { possible_manifest_files[sha1] = "tagmanifest-sha1.txt"; for (map::iterator it=possible_manifest_files.begin(); it!=possible_manifest_files.end(); ++it) { // debug - cout << it->first << " => " << it->second << endl; + // cout << it->first << " => " << it->second << endl; // test if file exists string filename = basedir + it->second; fs::path p{ filename }; fs::file_status s = fs::status( p ); - cout << "path "<< p.string() << endl; - cout << "is file: "<< fs::is_regular_file( s) << endl; + //cout << "path "<< p.string() << endl; + //cout << "is file: "<< fs::is_regular_file( s) << endl; if (fs::is_regular_file( s)) { Tagmanifest::manifest_algorithm_files[it->first] = filename; // debug - cout << "TAGMANIFEST: alg="<< it->first << " => filename=" << it->second << endl; + //cout << "TAGMANIFEST: alg="<< it->first << " => filename=" << it->second << endl; + //cout << "TAGMANIFEST2: alg="<< it->first << " => filename=" << filename << endl; } } this->exist_manifest_files = possible_manifest_files.empty(); + //cout << "TAGMANIFEST constructor, calling debug()" << endl; + //this->debug(); + //cout << "TAGMANIFEST constructor, finished" << endl; + } -map Tagmanifest::get_checksum_file_pairs(checksum_algorithms alg) { - map checksum_file_pairs = Manifest::get_checksum_file_pairs(alg); +multimap Tagmanifest::get_checksum_file_pairs(checksum_algorithms alg) { + //cout << "DEBUG: begin Tagmanifest::get_checksum_file_pairs" << endl; + multimap checksum_file_pairs = Manifest::get_checksum_file_pairs(alg); + //cout << "DEBUG: called super->get_checksum_file_pairs" << endl; - for (map::iterator it=checksum_file_pairs.begin(); it!=checksum_file_pairs.end(); ++it) { + for (multimap::iterator it=checksum_file_pairs.begin(); it!=checksum_file_pairs.end(); ++it) { + // cout << "DEBUG: TAGMANIFEST found 'data/' in the beginning of file '"<second<<"' in tagmanifest file '"<< this->manifest_algorithm_files[ alg] << endl; if (it->second.find( "data/" ) == 0) { cout << "found 'data/' in the beginning of file '"<second<<"' in tagmanifest file '"<< this->manifest_algorithm_files[ alg] << endl; } } + //cout << "TAGMANIFEST get_checksum_file_pairs, calling debug()" << endl; + //this->debug(); + //cout << "TAGMANIFEST get_checksum_file_pairs, finished" << endl; return checksum_file_pairs; }