ArchiveFileItor.hpp 2.25 KB
Newer Older
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
/*
 * The CERN Tape Archive (CTA) project
 * Copyright (C) 2015  CERN
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#pragma once

#include "common/dataStructures/ArchiveFile.hpp"

namespace cta {
namespace catalogue {

/**
27
28
29
30
31
32
33
34
35
36
37
38
39
40
 * Forward declaration.
 */
class ArchiveFileItorImpl;

/**
 * Forward declaration.
 */
class Catalogue;

/**
 * A wrapper around an object that iterators over a list of archive files.
 *
 * This wrapper permits the user of the Catalogue API to use different
 * iterator implementations whilst only using a single iterator type.
41
42
43
44
 */
class ArchiveFileItor {
public:

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
  /**
   * Constructor.
   */
  ArchiveFileItor();

  /**
   * Constructor.
   *
   * @param impl The object actually implementing this iterator.
   */
  ArchiveFileItor(ArchiveFileItorImpl *const impl);

  /**
   * Deletion of copy constructor.
   */
  ArchiveFileItor(const ArchiveFileItor &) = delete;

  /**
   * Move constructor.
   *
   * @param other The other object to be moved.
   */
  ArchiveFileItor(ArchiveFileItor &&other);

69
70
71
  /**
   * Destructor.
   */
72
73
74
75
76
77
78
79
80
81
82
  ~ArchiveFileItor();

  /**
   * Deletion of copy assignment.
   */
  ArchiveFileItor &operator=(const ArchiveFileItor &) = delete;

  /**
   * Move assignment.
   */
  ArchiveFileItor &operator=(ArchiveFileItor &&rhs);
83
84
85
86

  /**
   * Returns true if a call to next would return another archive file.
   */
87
  bool hasMore();
88
89
90
91

  /**
   * Returns the next archive or throws an exception if there isn't one.
   */
92
93
94
95
96
97
98
99
  common::dataStructures::ArchiveFile next();

private:

  /**
   * The object actually implementing this iterator.
   */
  ArchiveFileItorImpl *m_impl;
100
101
102
103
104

}; // class ArchiveFileItor

} // namespace catalogue
} // namespace cta