Copiste  0.1
 All Classes Functions Variables Enumerations Friends Pages
corpus.h
1 /*
2  * This file is part of Copiste.
3  *
4  * Copiste is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * Copiste is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Copiste. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 
19 #ifndef INCLUDEDCORPUSH
20 #define INCLUDEDCORPUSH
21 
22 #include <iostream>
23 #include <string>
24 #include <vector>
25 #include <cmath>
26 #include <QFile>
27 #include <QDomDocument>
28 
29 using namespace std;
30 
31 class Corpus;
32 
34 class Corpus
35 {
36  public:
38 
40  Corpus(string file = "");
42  Corpus(int dim);
44  Corpus(const Corpus &c, unsigned int keepOnly = -1);
46  ~Corpus();
48  void erase(int dimension = 0);
49 
51 
53  bool load(string file, bool verbose = false);
55  void write(string file);
57  void display() const;
58 
60 
62  unsigned int size() const;
64  unsigned int dimension() const;
65 
67  double* elem(unsigned int index) const { return mPool[index]; }
69  std::string name(unsigned int index) const { return mNames[index]; }
71  void addElem(double* elem, std::string name = "");
73  std::vector<double> bounds() const;
74 
75  private:
76  double** mPool;
77  int mSize; // Stores the number of elements stored in the pool
78  int mDimension;
79 
80  int mPoolSize; // Stores the actual capacity of the pool
81 
82  std::vector<std::string> mNames; // Stores the names of the samples
83 };
84 
85 #endif