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
35namespace pwiz {
36namespace 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
H
Definition Chemistry.hpp:80
#define PWIZ_API_DECL
Definition Export.hpp:32
common functionality for base SpectrumList implementations
virtual const boost::shared_ptr< const DataProcessing > dataProcessingPtr() const
implementation of SpectrumList
const pwiz::util::IntegerSet MSLevelsNone
virtual void setDataProcessingPtr(DataProcessingPtr dp)
set DataProcessing
virtual void warn_once(const char *msg) const
issues a warning once per SpectrumList instance (based on string hash)
Interface for accessing spectra, which may be stored in memory or backed by a data file (RAW,...
Definition MSData.hpp:661
virtual double ionMobilityToCCS(double ionMobility, double mz, int charge) const =0
virtual bool canConvertIonMobilityAndCCS() const =0
virtual bool hasIonMobility() const =0
virtual double ccsToIonMobility(double ccs, double mz, int charge) const =0
a virtual container of integers, accessible via an iterator interface, stored as union of intervals
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition MSData.hpp:288