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 
36 namespace pwiz {
37 namespace 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 
pwiz::analysis::ChromatogramList_FilterPredicate_IndexSet::indexSet_
util::IntegerSet indexSet_
Definition: ChromatogramList_Filter.hpp:97
pwiz::analysis::ChromatogramList_Filter::operator=
ChromatogramList_Filter & operator=(ChromatogramList_Filter &)
pwiz::analysis::ChromatogramList_Filter::chromatogramIdentity
virtual const msdata::ChromatogramIdentity & chromatogramIdentity(size_t index) const
access to a chromatogram index
pwiz
Definition: ChromatogramList_Filter.hpp:36
pwiz::analysis::ChromatogramList_Filter::Predicate::accept
virtual boost::logic::tribool accept(const msdata::Chromatogram &chromatogram) const
return true iff Chromatogram is accepted
Definition: ChromatogramList_Filter.hpp:60
pwiz::analysis::ChromatogramList_FilterPredicate_IndexSet::accept
virtual boost::logic::tribool accept(const msdata::ChromatogramIdentity &chromatogramIdentity) const
return values: true: accept the Chromatogram false: reject the Chromatogram indeterminate: need to se...
pwiz::analysis::ChromatogramList_FilterPredicate_IndexSet::eos_
bool eos_
Definition: ChromatogramList_Filter.hpp:98
PWIZ_API_DECL
#define PWIZ_API_DECL
Definition: Export.hpp:32
ChromatogramListWrapper.hpp
pwiz::msdata::ChromatogramIdentity
Identifying information for a chromatogram.
Definition: MSData.hpp:490
Export.hpp
pwiz::msdata::ChromatogramListPtr
boost::shared_ptr< ChromatogramList > ChromatogramListPtr
Definition: MSData.hpp:785
pwiz::msdata::Chromatogram
A single chromatogram.
Definition: MSData.hpp:578
pwiz::analysis::ChromatogramList_FilterPredicate_IndexSet::ChromatogramList_FilterPredicate_IndexSet
ChromatogramList_FilterPredicate_IndexSet(const util::IntegerSet &indexSet)
pwiz::analysis::ChromatogramList_Filter::ChromatogramList_Filter
ChromatogramList_Filter(const msdata::ChromatogramListPtr original, const Predicate &predicate)
pwiz::analysis::ChromatogramList_Filter::Predicate::~Predicate
virtual ~Predicate()
Definition: ChromatogramList_Filter.hpp:69
pwiz::analysis::ChromatogramList_Filter::chromatogram
virtual msdata::ChromatogramPtr chromatogram(size_t index, bool getBinaryData=false) const
retrieve a chromatogram by index
pwiz::analysis::ChromatogramList_Filter::Predicate::suggestedDetailLevel
virtual bool suggestedDetailLevel() const
can be overridden in subclasses that know they will need a certain detail level; it must be overridde...
Definition: ChromatogramList_Filter.hpp:51
pwiz::analysis::ChromatogramList_Filter::impl_
boost::shared_ptr< Impl > impl_
Definition: ChromatogramList_Filter.hpp:82
pwiz::analysis::ChromatogramList_Filter::Predicate::accept
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...
pwiz::analysis::ChromatogramList_FilterPredicate_IndexSet
Definition: ChromatogramList_Filter.hpp:90
pwiz::analysis::ChromatogramList_Filter::Predicate::done
virtual bool done() const
return true iff done accepting chromatograms; this allows early termination of the iteration through ...
Definition: ChromatogramList_Filter.hpp:67
pwiz::analysis::ChromatogramListWrapper
Inheritable pass-through implementation for wrapping a ChromatogramList.
Definition: ChromatogramListWrapper.hpp:39
pwiz::analysis::ChromatogramList_Filter::Predicate
client-implemented filter predicate – called during construction of ChromatogramList_Filter to create...
Definition: ChromatogramList_Filter.hpp:48
pwiz::msdata::ChromatogramPtr
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: MSData.hpp:624
pwiz::analysis::ChromatogramList_Filter::size
virtual size_t size() const
returns the number of chromatograms
pwiz::analysis::ChromatogramList_Filter::ChromatogramList_Filter
ChromatogramList_Filter(ChromatogramList_Filter &)
IntegerSet.hpp
MZTolerance.hpp
pwiz::analysis::ChromatogramList_FilterPredicate_IndexSet::done
virtual bool done() const
return true iff done accepting chromatograms; this allows early termination of the iteration through ...
pwiz::util::IntegerSet
a virtual container of integers, accessible via an iterator interface, stored as union of intervals
Definition: IntegerSet.hpp:38
pwiz::analysis::ChromatogramList_Filter
ChromatogramList filter, for creating Chromatogram sub-lists.
Definition: ChromatogramList_Filter.hpp:42