ProteoWizard
SpectrumList_ABI.hpp
Go to the documentation of this file.
1 //
2 // $Id: SpectrumList_ABI.hpp 6585 2014-08-07 22:49:28Z chambm $
3 //
4 //
5 // Original author: Matt Chambers <matt.chambers .@. vanderbilt.edu>
6 //
7 // Copyright 2009 Vanderbilt University - Nashville, TN 37232
8 //
9 // Licensed under the Apache License, Version 2.0 (the "License");
10 // you may not use this file except in compliance with the License.
11 // You may obtain a copy of the License at
12 //
13 // http://www.apache.org/licenses/LICENSE-2.0
14 //
15 // Unless required by applicable law or agreed to in writing, software
16 // distributed under the License is distributed on an "AS IS" BASIS,
17 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 // See the License for the specific language governing permissions and
19 // limitations under the License.
20 //
21 
22 
28 #include <boost/thread/mutex.hpp>
29 #include <boost/container/flat_map.hpp>
30 
31 #ifdef PWIZ_READER_ABI
32 #include "pwiz_aux/msrc/utility/vendor_api/ABI/WiffFile.hpp"
34 #include <boost/thread.hpp>
35 using namespace pwiz::vendor_api::ABI;
36 #endif // PWIZ_READER_ABI
37 
38 
39 namespace pwiz {
40 namespace msdata {
41 namespace detail {
42 
44 {
45  public:
46 
47  virtual size_t size() const;
48  virtual const SpectrumIdentity& spectrumIdentity(size_t index) const;
49  virtual size_t find(const std::string& id) const;
50  virtual SpectrumPtr spectrum(size_t index, bool getBinaryData) const;
51  virtual SpectrumPtr spectrum(size_t index, DetailLevel detailLevel) const;
52  virtual SpectrumPtr spectrum(size_t index, bool getBinaryData, const pwiz::util::IntegerSet& msLevelsToCentroid) const;
53  virtual SpectrumPtr spectrum(size_t index, DetailLevel detailLevel, const pwiz::util::IntegerSet& msLevelsToCentroid) const;
54 
55 #ifdef PWIZ_READER_ABI
56  SpectrumList_ABI(const MSData& msd, WiffFilePtr wifffile,
57  const ExperimentsMap& experimentsMap, int sample,
58  const Reader::Config& config);
59 
60  private:
61 
62  const MSData& msd_;
63  WiffFilePtr wifffile_;
64  const Reader::Config config_;
65  ExperimentsMap experimentsMap_;
66  int sample;
67  mutable boost::mutex readMutex;
68 
69  mutable size_t size_;
70 
71  mutable util::once_flag_proxy indexInitialized_;
72 
73  struct IndexEntry : public SpectrumIdentity
74  {
75  int sample;
76  int period;
77  int cycle;
78  ExperimentPtr experiment;
79  int transition;
80  };
81 
82  mutable std::vector<IndexEntry> index_;
83  mutable std::map<std::string, size_t> idToIndexMap_;
84 
85  // Cache last accessed spectrum for fast in order access
86  mutable boost::mutex spectrum_mutex;
87  mutable size_t spectrumLastIndex_;
88  mutable pwiz::vendor_api::ABI::SpectrumPtr spectrumLast_;
89 
90  void createIndex() const;
91 #endif // PWIZ_READER_ABI
92 };
93 
94 
95 } // detail
96 } // msdata
97 } // pwiz
common functionality for base SpectrumList implementations
a virtual container of integers, accessible via an iterator interface, stored as union of intervals ...
Definition: IntegerSet.hpp:37
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: MSData.hpp:569
#define PWIZ_API_DECL
Definition: Export.hpp:32
Identifying information for a spectrum.
Definition: MSData.hpp:469
Reader configuration.
Definition: Reader.hpp:43
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845