ProteoWizard
SpectrumList_Sorter.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 2008 Spielberg Family Center for Applied Proteomics
8// Cedars-Sinai Medical Center, Los Angeles, California 90048
9// Copyright 2008 Vanderbilt University - Nashville, TN 37232
10//
11// Licensed under the Apache License, Version 2.0 (the "License");
12// you may not use this file except in compliance with the License.
13// You may obtain a copy of the License at
14//
15// http://www.apache.org/licenses/LICENSE-2.0
16//
17// Unless required by applicable law or agreed to in writing, software
18// distributed under the License is distributed on an "AS IS" BASIS,
19// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20// See the License for the specific language governing permissions and
21// limitations under the License.
22//
23
24
25#ifndef _SPECTRUMLIST_SORTER_HPP_
26#define _SPECTRUMLIST_SORTER_HPP_
27
28
31#include "boost/logic/tribool.hpp"
32
33
34namespace pwiz {
35namespace analysis {
36
37
38/// Provides a custom-sorted spectrum list
40{
41 public:
42
43 /// client-implemented sort predicate -- called during construction of
44 /// SpectrumList_Sorter to sort the underlying spectrum list
46 {
47 /// return values:
48 /// true: lhs < rhs
49 /// false: lhs >= rhs
50 /// indeterminate: need to see the full Spectrum object to decide
51 virtual boost::logic::tribool less(const msdata::SpectrumIdentity& lhs,
52 const msdata::SpectrumIdentity& rhs) const
53 {return boost::logic::indeterminate;}
54
55 /// return values:
56 /// true: lhs < rhs
57 /// false: lhs >= rhs
58 /// indeterminate: need a more detailed Spectrum object to decide
59 virtual boost::logic::tribool less(const msdata::Spectrum& lhs,
60 const msdata::Spectrum& rhs) const
61 {return lhs.index < rhs.index;}
62
63 virtual ~Predicate() {}
64 };
65
67 const Predicate& predicate,
68 bool stable = false);
69
70 /// \name SpectrumList interface
71 //@{
72 virtual size_t size() const;
73 virtual const msdata::SpectrumIdentity& spectrumIdentity(size_t index) const;
74 virtual msdata::SpectrumPtr spectrum(size_t index, bool getBinaryData = false) const;
75 //@}
76
77 private:
78 struct Impl;
79 boost::shared_ptr<Impl> impl_;
82};
83
84
86{
87 public:
88 virtual boost::logic::tribool less(const msdata::Spectrum& lhs,
89 const msdata::Spectrum& rhs) const;
90};
91
92
93} // namespace analysis
94} // namespace pwiz
95
96
97#endif // _SPECTRUMLIST_SORTER_HPP_
98
#define PWIZ_API_DECL
Definition Export.hpp:32
Provides a custom-sorted spectrum list.
SpectrumList_Sorter(SpectrumList_Sorter &)
virtual size_t size() const
returns the number of spectra
virtual const msdata::SpectrumIdentity & spectrumIdentity(size_t index) const
access to a spectrum index
SpectrumList_Sorter & operator=(SpectrumList_Sorter &)
SpectrumList_Sorter(const msdata::SpectrumListPtr &inner, const Predicate &predicate, bool stable=false)
virtual msdata::SpectrumPtr spectrum(size_t index, bool getBinaryData=false) const
retrieve a spectrum by index
virtual boost::logic::tribool less(const msdata::Spectrum &lhs, const msdata::Spectrum &rhs) const
return values: true: lhs < rhs false: lhs >= rhs indeterminate: need a more detailed Spectrum object ...
Inheritable pass-through implementation for wrapping a SpectrumList.
boost::shared_ptr< SpectrumList > SpectrumListPtr
Definition MSData.hpp:711
boost::shared_ptr< Spectrum > SpectrumPtr
Definition MSData.hpp:573
client-implemented sort predicate – called during construction of SpectrumList_Sorter to sort the und...
virtual boost::logic::tribool less(const msdata::SpectrumIdentity &lhs, const msdata::SpectrumIdentity &rhs) const
return values: true: lhs < rhs false: lhs >= rhs indeterminate: need to see the full Spectrum object ...
virtual boost::logic::tribool less(const msdata::Spectrum &lhs, const msdata::Spectrum &rhs) const
return values: true: lhs < rhs false: lhs >= rhs indeterminate: need a more detailed Spectrum object ...
The structure that captures the generation of a peak list (including the underlying acquisitions)
Definition MSData.hpp:506
Identifying information for a spectrum.
Definition MSData.hpp:471
size_t index
the zero-based, consecutive index of the spectrum in the SpectrumList.
Definition MSData.hpp:473