OpenMS
openms/include/OpenMS/INTERFACES/ISpectrumAccess.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Hannes Roest $
6 // $Authors: Hannes Roest, Witold Wolski $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
12 
13 #include <vector>
14 #include <string>
15 #include <boost/shared_ptr.hpp>
16 
17 namespace OpenMS
18 {
19 namespace Interfaces
20 {
21 
25  class OPENMS_DLLAPI ISpectraReader
26  {
27 public:
28  virtual ~ISpectraReader() {}
30  virtual SpectrumPtr getSpectrumById(int id) const = 0;
32  virtual SpectrumPtr getSpectrumById(const std::string& id) const = 0;
34  virtual std::vector<std::size_t> getSpectraByRT(double RT, double deltaRT) const = 0;
36  virtual size_t getNrSpectra() const = 0;
38  virtual SpectrumMetaPtr getSpectrumMetaById(int id) const = 0;
39 
40  /*
41  * Do we need an Iterator here?
42  * We would have to provide our own iterator wrapper class because we don't
43  * know whether all the spectra are loaded at any given timepoint
44  typedef SpectrumPtr const ConstSpectraIterator;
45  ConstSpectraIterator beginSpectra() const;
46  ConstSpectraIterator endSpectra() const;
47  */
48  };
49  typedef boost::shared_ptr<ISpectraReader> SpectraReaderPtr;
50 
51 
55  class OPENMS_DLLAPI IChromatogramsReader
56  {
57 public:
58  virtual ~IChromatogramsReader() {}
60  virtual ChromatogramPtr getChromatogramById(int id) const = 0;
62  virtual ChromatogramPtr getChromatogramById(const std::string& id) const = 0;
64  virtual std::vector<std::size_t> getChromatogramByPrecursorMZ(double mz, double deltaMZ) const = 0;
66  virtual std::size_t getNrChromatograms() const = 0;
68  virtual ChromatogramMetaPtr getChromatogramMetaById(int id) const = 0;
69 
70  /*
71  * Do we need an Iterator here?
72  * We would have to provide our own iterator wrapper class because we don't
73  * know whether all the chromatograms are loaded at any given timepoint
74  ConstChromatogramIterator beginChromatograms() const;
75  ConstChromatogramIterator endChromatograms() const;
76  */
77  };
78  typedef boost::shared_ptr<IChromatogramsReader> ChromatogramsReaderPtr;
79 
80 
81  class OPENMS_DLLAPI ISpectraWriter
82  {
83 public:
84  virtual ~ISpectraWriter() {}
86  virtual void appendSpectrum(SpectrumPtr spectrum, bool write_through=false) = 0;
88  virtual void flush() = 0;
89  };
90  typedef boost::shared_ptr<ISpectraWriter> SpectraWriterPtr;
91 
92 
93  class OPENMS_DLLAPI IChromatogramsWriter
94  {
95 public:
96  virtual ~IChromatogramsWriter() {}
98  virtual void appendChromatogram(ChromatogramPtr chromatogram, bool write_through=false) = 0;
100  virtual void flush() = 0;
101  };
102  typedef boost::shared_ptr<IChromatogramsWriter> ChromatogramsWriterPtr;
103 
104 } //end namespace Interfaces
105 } //end namespace OpenMS
The interface of read-access to a list of chromatograms.
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:56
virtual ~IChromatogramsReader()
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:58
virtual ChromatogramMetaPtr getChromatogramMetaById(int id) const =0
Returns the meta information for a chromatogram.
virtual std::vector< std::size_t > getChromatogramByPrecursorMZ(double mz, double deltaMZ) const =0
Return a vector of ids of chromatograms that are within mz +/- deltaMz.
virtual std::size_t getNrChromatograms() const =0
Returns the number of chromatograms available.
virtual ChromatogramPtr getChromatogramById(int id) const =0
Return a pointer to a chromatogram at the given id.
virtual ChromatogramPtr getChromatogramById(const std::string &id) const =0
Return a pointer to a chromatogram at the given string id.
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:94
virtual void appendChromatogram(ChromatogramPtr chromatogram, bool write_through=false)=0
Append a chromatogram to the end.
virtual void flush()=0
write all cached data to disk
virtual ~IChromatogramsWriter()
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:96
The interface of read-access to a list of spectra.
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:26
virtual std::vector< std::size_t > getSpectraByRT(double RT, double deltaRT) const =0
Return a vector of ids of spectra that are within RT +/- deltaRT.
virtual ~ISpectraReader()
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:28
virtual size_t getNrSpectra() const =0
Returns the number of spectra available.
virtual SpectrumPtr getSpectrumById(int id) const =0
Return a pointer to a spectrum at the given id.
virtual SpectrumPtr getSpectrumById(const std::string &id) const =0
Return a pointer to a spectrum at the given string id.
virtual SpectrumMetaPtr getSpectrumMetaById(int id) const =0
Returns the meta information for a spectrum.
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:82
virtual ~ISpectraWriter()
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:84
virtual void flush()=0
write all cached data to disk
virtual void appendSpectrum(SpectrumPtr spectrum, bool write_through=false)=0
Append a spectrum to the end.
boost::shared_ptr< IChromatogramsReader > ChromatogramsReaderPtr
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:78
boost::shared_ptr< ChromatogramMeta > ChromatogramMetaPtr
Definition: openms/include/OpenMS/INTERFACES/DataStructures.h:73
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: openms/include/OpenMS/INTERFACES/DataStructures.h:130
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: openms/include/OpenMS/INTERFACES/DataStructures.h:210
boost::shared_ptr< IChromatogramsWriter > ChromatogramsWriterPtr
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:102
boost::shared_ptr< SpectrumMeta > SpectrumMetaPtr
Definition: openms/include/OpenMS/INTERFACES/DataStructures.h:153
boost::shared_ptr< ISpectraReader > SpectraReaderPtr
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:49
boost::shared_ptr< ISpectraWriter > SpectraWriterPtr
Definition: openms/include/OpenMS/INTERFACES/ISpectrumAccess.h:90
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19