ProteoWizard
SpectrumList_Shimadzu.hpp
Go to the documentation of this file.
1 //
2 // $Id$
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_SHIMADZU
32 #include "pwiz_aux/msrc/utility/vendor_api/Shimadzu/ShimadzuReader.hpp"
34 #include <boost/thread.hpp>
35 using namespace pwiz::vendor_api::Shimadzu;
36 #endif // PWIZ_READER_SHIMADZU
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_SHIMADZU
56  SpectrumList_Shimadzu(const MSData& msd, ShimadzuReaderPtr rawfile, const Reader::Config& config);
57 
58  private:
59 
60  const MSData& msd_;
61  const Reader::Config config_;
62  ShimadzuReaderPtr rawfile_;
63  mutable boost::mutex readMutex;
64 
65  mutable size_t size_;
66 
67  mutable util::once_flag_proxy indexInitialized_;
68 
69  struct IndexEntry : public SpectrumIdentity
70  {
71  int scanNumber;
72  };
73 
74  mutable std::vector<IndexEntry> index_;
75  mutable std::map<std::string, size_t> idToIndexMap_;
76 
77  // Cache last accessed spectrum for fast in order access
78  mutable boost::mutex spectrum_mutex;
79  mutable size_t spectrumLastIndex_;
80  mutable pwiz::vendor_api::Shimadzu::SpectrumPtr spectrumLast_;
81 
82  void createIndex() const;
83 #endif // PWIZ_READER_SHIMADZU
84 };
85 
86 
87 } // detail
88 } // msdata
89 } // pwiz
pwiz::msdata::Reader::Config
Reader configuration.
Definition: Reader.hpp:45
pwiz::util::once_flag_proxy
Definition: Once.hpp:35
pwiz::msdata::SpectrumIdentity
Identifying information for a spectrum.
Definition: MSData.hpp:471
pwiz
Definition: ChromatogramList_Filter.hpp:36
pwiz::msdata::detail::SpectrumList_Shimadzu
Definition: SpectrumList_Shimadzu.hpp:44
PWIZ_API_DECL
#define PWIZ_API_DECL
Definition: Export.hpp:32
Container.hpp
pwiz::msdata::detail::SpectrumList_Shimadzu::find
virtual size_t find(const std::string &id) const
find id in the spectrum index (returns size() on failure)
Export.hpp
Once.hpp
pwiz::msdata::detail::SpectrumList_Shimadzu::spectrumIdentity
virtual const SpectrumIdentity & spectrumIdentity(size_t index) const
access to a spectrum index
SpectrumListBase.hpp
pwiz::msdata::detail::SpectrumList_Shimadzu::spectrum
virtual SpectrumPtr spectrum(size_t index, bool getBinaryData) const
retrieve a spectrum by index
pwiz::msdata::detail::SpectrumList_Shimadzu::size
virtual size_t size() const
returns the number of spectra
pwiz::msdata::SpectrumPtr
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: MSData.hpp:573
pwiz::msdata::detail::SpectrumList_Shimadzu::spectrum
virtual SpectrumPtr spectrum(size_t index, DetailLevel detailLevel, const pwiz::util::IntegerSet &msLevelsToCentroid) const
pwiz::msdata::MSData
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:850
pwiz::msdata::SpectrumListBase
common functionality for base SpectrumList implementations
Definition: SpectrumListBase.hpp:41
pwiz::msdata::detail::SpectrumList_Shimadzu::spectrum
virtual SpectrumPtr spectrum(size_t index, DetailLevel detailLevel) const
retrieve a spectrum by index
pwiz::msdata::DetailLevel
DetailLevel
Definition: MSData.hpp:631
IntegerSet.hpp
pwiz::msdata::detail::SpectrumList_Shimadzu::spectrum
virtual SpectrumPtr spectrum(size_t index, bool getBinaryData, const pwiz::util::IntegerSet &msLevelsToCentroid) const
Reader.hpp
pwiz::util::IntegerSet
a virtual container of integers, accessible via an iterator interface, stored as union of intervals
Definition: IntegerSet.hpp:38