Commit a4aaab31 authored by Steven Murray's avatar Steven Murray
Browse files

ArchiveFileItor::next() is no longer const.

Woah!  Got carried away with const.  This commit Removes the const
qualifier from the ArchiveFileItor::next() method because next()
modifies the iterator.

To loop through an ArchiveFileItor:

  auto itor = catalogue.getArchiveFilesForRepackItor(vid, startFSeq);
  while(itor.hasMore()) {
    const auto archiveFile = itor.next();
    // Do something with archiveFile
  }
parent a884e319
......@@ -78,7 +78,7 @@ bool ArchiveFileItor::hasMore() const {
//------------------------------------------------------------------------------
// next
//------------------------------------------------------------------------------
common::dataStructures::ArchiveFile ArchiveFileItor::next() const {
common::dataStructures::ArchiveFile ArchiveFileItor::next() {
if(nullptr == m_impl) {
throw exception::Exception(std::string(__FUNCTION__) + " failed: "
"This iterator is invalid");
......
......@@ -89,7 +89,7 @@ public:
/**
* Returns the next archive or throws an exception if there isn't one.
*/
common::dataStructures::ArchiveFile next() const;
common::dataStructures::ArchiveFile next();
private:
......
......@@ -194,7 +194,7 @@ std::map<std::string, cta::common::dataStructures::Tape> cta_catalogue_Catalogue
// archiveFileItorToMap
//------------------------------------------------------------------------------
std::map<uint64_t, cta::common::dataStructures::ArchiveFile> cta_catalogue_CatalogueTest::archiveFileItorToMap(
const cta::catalogue::ArchiveFileItor &itor) {
cta::catalogue::ArchiveFileItor &itor) {
using namespace cta;
try {
......@@ -7509,7 +7509,7 @@ TEST_P(cta_catalogue_CatalogueTest, filesWrittenToTape_many_archive_files) {
{
const uint64_t startFseq = 1;
const auto archiveFileItor = m_catalogue->getArchiveFilesForRepackItor(vid1, startFseq);
auto archiveFileItor = m_catalogue->getArchiveFilesForRepackItor(vid1, startFseq);
const auto m = archiveFileItorToMap(archiveFileItor);
ASSERT_EQ(nbArchiveFiles, m.size());
......
......@@ -63,7 +63,7 @@ protected:
* @return Map from archive file ID to archive file.
*/
std::map<uint64_t, cta::common::dataStructures::ArchiveFile> archiveFileItorToMap(
const cta::catalogue::ArchiveFileItor &itor);
cta::catalogue::ArchiveFileItor &itor);
/**
* Creates a map from archive file ID to archive file from the specified
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment