OpenMS  2.6.0
openms/include/OpenMS/INTERFACES/ISpectrumAccess.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2020.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Hannes Roest $
32 // $Authors: Hannes Roest, Witold Wolski $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
38 
39 #include <vector>
40 #include <string>
41 #include <boost/shared_ptr.hpp>
42 
43 namespace OpenMS
44 {
45 namespace Interfaces
46 {
47 
51  class OPENMS_DLLAPI ISpectraReader
52  {
53 public:
54  virtual ~ISpectraReader() {}
56  virtual SpectrumPtr getSpectrumById(int id) const = 0;
58  virtual SpectrumPtr getSpectrumById(const std::string& id) const = 0;
60  virtual std::vector<std::size_t> getSpectraByRT(double RT, double deltaRT) const = 0;
62  virtual size_t getNrSpectra() const = 0;
64  virtual SpectrumMetaPtr getSpectrumMetaById(int id) const = 0;
65 
66  /*
67  * Do we need an Iterator here?
68  * We would have to provide our own iterator wrapper class because we don't
69  * know whether all the spectra are loaded at any given timepoint
70  typedef SpectrumPtr const ConstSpectraIterator;
71  ConstSpectraIterator beginSpectra() const;
72  ConstSpectraIterator endSpectra() const;
73  */
74  };
75  typedef boost::shared_ptr<ISpectraReader> SpectraReaderPtr;
76 
77 
81  class OPENMS_DLLAPI IChromatogramsReader
82  {
83 public:
84  virtual ~IChromatogramsReader() {}
86  virtual ChromatogramPtr getChromatogramById(int id) const = 0;
88  virtual ChromatogramPtr getChromatogramById(const std::string& id) const = 0;
90  virtual std::vector<std::size_t> getChromatogramByPrecursorMZ(double mz, double deltaMZ) const = 0;
92  virtual std::size_t getNrChromatograms() const = 0;
94  virtual ChromatogramMetaPtr getChromatogramMetaById(int id) const = 0;
95 
96  /*
97  * Do we need an Iterator here?
98  * We would have to provide our own iterator wrapper class because we don't
99  * know whether all the chromatograms are loaded at any given timepoint
100  ConstChromatogramIterator beginChromatograms() const;
101  ConstChromatogramIterator endChromatograms() const;
102  */
103  };
104  typedef boost::shared_ptr<IChromatogramsReader> ChromatogramsReaderPtr;
105 
106 
107  class OPENMS_DLLAPI ISpectraWriter
108  {
109 public:
110  virtual ~ISpectraWriter() {}
112  virtual void appendSpectrum(SpectrumPtr spectrum, bool write_through=false) = 0;
114  virtual void flush() = 0;
115  };
116  typedef boost::shared_ptr<ISpectraWriter> SpectraWriterPtr;
117 
118 
119  class OPENMS_DLLAPI IChromatogramsWriter
120  {
121 public:
124  virtual void appendChromatogram(ChromatogramPtr chromatogram, bool write_through=false) = 0;
126  virtual void flush() = 0;
127  };
128  typedef boost::shared_ptr<IChromatogramsWriter> ChromatogramsWriterPtr;
129 
130 } //end namespace Interfaces
131 } //end namespace OpenMS
132 
OpenMS::Interfaces::ISpectraReader::~ISpectraReader
virtual ~ISpectraReader()
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:54
OpenMS::Interfaces::SpectrumPtr
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: openms/include/OpenMS/INTERFACES/DataStructures.h:236
DataStructures.h
OpenMS::Interfaces::IChromatogramsReader::~IChromatogramsReader
virtual ~IChromatogramsReader()
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:84
OpenMS::Interfaces::IChromatogramsReader
The interface of read-access to a list of chromatograms.
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:81
OpenMS::Interfaces::ChromatogramsWriterPtr
boost::shared_ptr< IChromatogramsWriter > ChromatogramsWriterPtr
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:128
OpenMS::Interfaces::ISpectraReader
The interface of read-access to a list of spectra.
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:51
OpenMS::Interfaces::ChromatogramsReaderPtr
boost::shared_ptr< IChromatogramsReader > ChromatogramsReaderPtr
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:104
OpenMS::Interfaces::ChromatogramPtr
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: openms/include/OpenMS/INTERFACES/DataStructures.h:156
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::Interfaces::ChromatogramMetaPtr
boost::shared_ptr< ChromatogramMeta > ChromatogramMetaPtr
Definition: openms/include/OpenMS/INTERFACES/DataStructures.h:99
OpenMS::Interfaces::SpectrumMetaPtr
boost::shared_ptr< SpectrumMeta > SpectrumMetaPtr
Definition: openms/include/OpenMS/INTERFACES/DataStructures.h:179
OpenMS::Interfaces::SpectraReaderPtr
boost::shared_ptr< ISpectraReader > SpectraReaderPtr
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:75
OpenMS::Interfaces::ISpectraWriter::~ISpectraWriter
virtual ~ISpectraWriter()
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:110
OpenMS::Interfaces::IChromatogramsWriter::~IChromatogramsWriter
virtual ~IChromatogramsWriter()
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:122
OpenMS::Interfaces::ISpectraWriter
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:107
OpenMS::Interfaces::IChromatogramsWriter
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:119
OpenMS::Interfaces::SpectraWriterPtr
boost::shared_ptr< ISpectraWriter > SpectraWriterPtr
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:116