OpenMS
DataFrameWriter.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg $
6 // $Authors: Witold Wolski $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <fstream>
12 #include <string>
13 #include <vector>
14 
15 #include <OpenMS/OPENSWATHALGO/OpenSwathAlgoConfig.h>
16 
17 namespace OpenSwath
18 {
19  struct OPENSWATHALGO_DLLAPI IDataFrameWriter
20  {
21  virtual ~IDataFrameWriter();
22  virtual void colnames(const std::vector<std::string>& colnames) = 0;
23  virtual void store(const std::string& rowname,
24  const std::vector<double>& values) = 0;
25  };
26 
27  struct OPENSWATHALGO_DLLAPI DataMatrix :
29  {
30 private:
31  std::vector<std::string> colnames_;
32  std::vector<std::string> rownames_;
33  std::vector<std::vector<double> > store_;
34 
35 public:
37 
38  void store(const std::string& rowname,
39  const std::vector<double>& values) override;
40 
41  void colnames(const std::vector<std::string>& colnames) override;
42 
43  };
44 
45  struct OPENSWATHALGO_DLLAPI CSVWriter :
47  {
48 private:
49  std::ofstream file_stream_;
50  std::string sep_;
51  std::string eol_;
52 
53 public:
54  explicit CSVWriter(std::string filename);
55 
56  void store(const std::string& rowname,
57  const std::vector<double>& values) override;
58 
59  ~CSVWriter() override;
60 
61  void colnames(const std::vector<std::string>& colnames) override;
62 
63  };
64 }
65 
Definition: Scoring.h:18
Definition: DataFrameWriter.h:47
void store(const std::string &rowname, const std::vector< double > &values) override
CSVWriter(std::string filename)
std::ofstream file_stream_
Definition: DataFrameWriter.h:49
void colnames(const std::vector< std::string > &colnames) override
std::string eol_
Definition: DataFrameWriter.h:51
std::string sep_
Definition: DataFrameWriter.h:50
Definition: DataFrameWriter.h:29
void store(const std::string &rowname, const std::vector< double > &values) override
std::vector< std::string > colnames_
Definition: DataFrameWriter.h:31
std::vector< std::vector< double > > store_
Definition: DataFrameWriter.h:33
void colnames(const std::vector< std::string > &colnames) override
std::vector< std::string > rownames_
Definition: DataFrameWriter.h:32
Definition: DataFrameWriter.h:20
virtual void colnames(const std::vector< std::string > &colnames)=0
virtual void store(const std::string &rowname, const std::vector< double > &values)=0