ProteoWizard
ChromatogramList_Filter.hpp
Go to the documentation of this file.
1//
2// $Id$
3//
4//
5// Original author: Darren Kessner <darren@proteowizard.org>
6//
7// Copyright 2008 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 _CHROMATOGRAMLIST_FILTER_HPP_
25#define _CHROMATOGRAMLIST_FILTER_HPP_
26
27
32#include "boost/logic/tribool.hpp"
33
34#include <set>
35
36namespace pwiz {
37namespace analysis {
38
39
40/// ChromatogramList filter, for creating Chromatogram sub-lists
42{
43 public:
44
45 /// client-implemented filter predicate -- called during construction of
46 /// ChromatogramList_Filter to create the filtered list of chromatograms
48 {
49 /// can be overridden in subclasses that know they will need a certain detail level;
50 /// it must be overridden to return DetailLevel_FullData if binary data is needed
51 virtual bool suggestedDetailLevel() const {return false;}
52
53 /// return values:
54 /// true: accept the Chromatogram
55 /// false: reject the Chromatogram
56 /// indeterminate: need to see the full Chromatogram object to decide
57 virtual boost::logic::tribool accept(const msdata::ChromatogramIdentity& chromatogramIdentity) const = 0;
58
59 /// return true iff Chromatogram is accepted
60 virtual boost::logic::tribool accept(const msdata::Chromatogram& chromatogram) const {return false;}
61
62 /// return true iff done accepting chromatograms;
63 /// this allows early termination of the iteration through the original
64 /// ChromatogramList, possibly using assumptions about the order of the
65 /// iteration (e.g. index is increasing, nativeID interpreted as scan number is
66 /// increasing, ...)
67 virtual bool done() const {return false;}
68
69 virtual ~Predicate() {}
70 };
71
73
74 /// \name ChromatogramList interface
75 //@{
76 virtual size_t size() const;
77 virtual const msdata::ChromatogramIdentity& chromatogramIdentity(size_t index) const;
78 virtual msdata::ChromatogramPtr chromatogram(size_t index, bool getBinaryData = false) const;
79 //@}
80
81 private:
82 struct Impl;
83 boost::shared_ptr<Impl> impl_;
86};
87
88
90{
91 public:
93 virtual boost::logic::tribool accept(const msdata::ChromatogramIdentity& chromatogramIdentity) const;
94 virtual bool done() const;
95
96 private:
98 mutable bool eos_;
99};
100
101
102} // namespace analysis
103} // namespace pwiz
104
105
106#endif // _CHROMATOGRAMLIST_FILTER_HPP_
107
#define PWIZ_API_DECL
Definition Export.hpp:32
ChromatogramList filter, for creating Chromatogram sub-lists.
virtual const msdata::ChromatogramIdentity & chromatogramIdentity(size_t index) const
access to a chromatogram index
virtual msdata::ChromatogramPtr chromatogram(size_t index, bool getBinaryData=false) const
retrieve a chromatogram by index
ChromatogramList_Filter(const msdata::ChromatogramListPtr original, const Predicate &predicate)
ChromatogramList_Filter & operator=(ChromatogramList_Filter &)
virtual size_t size() const
returns the number of chromatograms
ChromatogramList_Filter(ChromatogramList_Filter &)
ChromatogramList_FilterPredicate_IndexSet(const util::IntegerSet &indexSet)
virtual bool done() const
return true iff done accepting chromatograms; this allows early termination of the iteration through ...
virtual boost::logic::tribool accept(const msdata::ChromatogramIdentity &chromatogramIdentity) const
return values: true: accept the Chromatogram false: reject the Chromatogram indeterminate: need to se...
Inheritable pass-through implementation for wrapping a ChromatogramList.
a virtual container of integers, accessible via an iterator interface, stored as union of intervals
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition MSData.hpp:624
boost::shared_ptr< ChromatogramList > ChromatogramListPtr
Definition MSData.hpp:785
client-implemented filter predicate – called during construction of ChromatogramList_Filter to create...
virtual bool suggestedDetailLevel() const
can be overridden in subclasses that know they will need a certain detail level; it must be overridde...
virtual boost::logic::tribool accept(const msdata::Chromatogram &chromatogram) const
return true iff Chromatogram is accepted
virtual bool done() const
return true iff done accepting chromatograms; this allows early termination of the iteration through ...
virtual boost::logic::tribool accept(const msdata::ChromatogramIdentity &chromatogramIdentity) const =0
return values: true: accept the Chromatogram false: reject the Chromatogram indeterminate: need to se...
A single chromatogram.
Definition MSData.hpp:578
Identifying information for a chromatogram.
Definition MSData.hpp:490