1 // File Description
2 /// \file EntireFileQuery.h
3 /// \brief Defines the EntireFileQuery class.
4 //
5 // Author: Derek Barnett
6 
7 #ifndef ENTIREFILEQUERY_H
8 #define ENTIREFILEQUERY_H
9 
10 #include <memory>
11 #include "pbbam/internal/QueryBase.h"
12 
13 namespace PacBio {
14 namespace BAM {
15 
16 /// \brief The EntireFileQuery class provides iterable access to a DataSet's
17 ///        %BAM records, reading through the entire contents of each file.
18 ///
19 /// Input files will be accessed in the order listed in the DataSet.
20 ///
21 /// \include code/EntireFileQuery.txt
22 ///
23 /// Iteration is not limited to only 'const' records. The files themselves will
24 /// not be affected, but individual records may be modified if needed.
25 ///
26 /// \include code/EntireFileQuery_NonConst.txt
27 ///
28 /// \note DataSets can be implicitly constructed from %BAM filenames as well.
29 ///       Thus a single %BAM file can be read through using the following:
30 ///
31 /// \include code/EntireFileQuery_BamFilename.txt
32 ///
33 class PBBAM_EXPORT EntireFileQuery : public internal::IQuery
34 {
35 public:
36     /// \brief Creates a new EntireFileQuery, reading through the entire
37     ///        contents of a dataset.
38     ///
39     /// \param[in] dataset  input data source(s)
40     /// \throws std::runtime_error on failure to open/read underlying %BAM
41     ///         files.
42     ///
43     EntireFileQuery(const PacBio::BAM::DataSet& dataset);
44     ~EntireFileQuery() override;
45 
46 public:
47     /// \brief Main iteration point for record access.
48     ///
49     /// Most client code should not need to use this method directly. Use
50     /// iterators instead.
51     ///
52     bool GetNext(BamRecord& r) override;
53 
54 private:
55     struct EntireFileQueryPrivate;
56     std::unique_ptr<EntireFileQueryPrivate> d_;
57 };
58 
59 }  // namespace BAM
60 }  // namspace PacBio
61 
62 #endif  // ENTIREFILEQUERY_H
63