ProteoWizard
SpectrumListBase.hpp
Go to the documentation of this file.
1 //
2 // $Id$
3 //
4 //
5 // Original author: Darren Kessner <darren@proteowizard.org>
6 //
7 // Copyright 2009 Spielberg Family Center for Applied Proteomics
8 // Cedars-Sinai Medical Center, Los Angeles, California 90048
9 //
10 // Licensed under the Apache License, Version 2.0 (the "License");
11 // you may not use this file except in compliance with the License.
12 // You may obtain a copy of the License at
13 //
14 // http://www.apache.org/licenses/LICENSE-2.0
15 //
16 // Unless required by applicable law or agreed to in writing, software
17 // distributed under the License is distributed on an "AS IS" BASIS,
18 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 // See the License for the specific language governing permissions and
20 // limitations under the License.
21 //
22 
23 
24 #ifndef _SPECTRUMLISTBASE_HPP_
25 #define _SPECTRUMLISTBASE_HPP_
26 
27 
30 #include <boost/functional/hash.hpp>
31 #include <stdexcept>
32 #include <iostream>
33 
34 
35 namespace pwiz {
36 namespace msdata {
37 
38 
39 /// common functionality for base SpectrumList implementations
41 {
42  public:
43  SpectrumListBase() : MSLevelsNone() {};
44 
45  /// implementation of SpectrumList
46  virtual const boost::shared_ptr<const DataProcessing> dataProcessingPtr() const {return dp_;}
47 
48  /// set DataProcessing
49  virtual void setDataProcessingPtr(DataProcessingPtr dp) { dp_ = dp; }
50 
51  /// issues a warning once per SpectrumList instance (based on string hash)
52  virtual void warn_once(const char* msg) const
53  {
54  boost::hash<const char*> H;
55  if (warn_msg_hashes.insert(H(msg)).second) // .second is true iff value is new
56  {
57  std::cerr << msg << std::endl;
58  }
59  }
60 
61  protected:
62 
64 
65  // Useful for avoiding repeated ctor when you just want an empty set
67 
68  private:
69 
70  mutable std::set<size_t> warn_msg_hashes; // for warn_once use
71 };
72 
73 
75 {
76  public:
77  virtual bool hasIonMobility() const = 0;
78  // CONSIDER: should this be in the interface? virtual bool hasPASEF() const = 0;
79  virtual bool canConvertIonMobilityAndCCS() const = 0;
80  virtual double ionMobilityToCCS(double ionMobility, double mz, int charge) const = 0;
81  virtual double ccsToIonMobility(double ccs, double mz, int charge) const = 0;
82 };
83 
84 
85 } // namespace msdata
86 } // namespace pwiz
87 
88 
89 #endif // _SPECTRUMLISTBASE_HPP_
90 
pwiz
Definition: ChromatogramList_Filter.hpp:36
MSData.hpp
pwiz::msdata::SpectrumListBase::dp_
DataProcessingPtr dp_
Definition: SpectrumListBase.hpp:63
PWIZ_API_DECL
#define PWIZ_API_DECL
Definition: Export.hpp:32
pwiz::msdata::SpectrumListBase::setDataProcessingPtr
virtual void setDataProcessingPtr(DataProcessingPtr dp)
set DataProcessing
Definition: SpectrumListBase.hpp:49
pwiz::msdata::SpectrumListBase::warn_once
virtual void warn_once(const char *msg) const
issues a warning once per SpectrumList instance (based on string hash)
Definition: SpectrumListBase.hpp:52
H
H
Definition: Chemistry.hpp:80
pwiz::msdata::DataProcessingPtr
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: MSData.hpp:288
pwiz::msdata::SpectrumListBase::warn_msg_hashes
std::set< size_t > warn_msg_hashes
Definition: SpectrumListBase.hpp:70
pwiz::chemistry::Ion::mz
double mz(double neutralMass, int protonDelta, int electronDelta=0, int neutronDelta=0)
Definition: Ion.hpp:78
pwiz::msdata::SpectrumListBase::dataProcessingPtr
virtual const boost::shared_ptr< const DataProcessing > dataProcessingPtr() const
implementation of SpectrumList
Definition: SpectrumListBase.hpp:46
pwiz::msdata::SpectrumListBase::SpectrumListBase
SpectrumListBase()
Definition: SpectrumListBase.hpp:43
pwiz::msdata::SpectrumListBase
common functionality for base SpectrumList implementations
Definition: SpectrumListBase.hpp:40
IntegerSet.hpp
pwiz::msdata::SpectrumListBase::MSLevelsNone
const pwiz::util::IntegerSet MSLevelsNone
Definition: SpectrumListBase.hpp:66
pwiz::msdata::SpectrumListIonMobilityBase
Definition: SpectrumListBase.hpp:74
pwiz::msdata::SpectrumList
Interface for accessing spectra, which may be stored in memory or backed by a data file (RAW,...
Definition: MSData.hpp:660
pwiz::util::IntegerSet
a virtual container of integers, accessible via an iterator interface, stored as union of intervals
Definition: IntegerSet.hpp:37