-
Notifications
You must be signed in to change notification settings - Fork 0
/
readFile.h
84 lines (69 loc) · 1.87 KB
/
readFile.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**
* \class ReadFile
*
* \ingroup PackageName
* (Note, this needs exactly one \defgroup somewhere)
*
* \brief This is the class that is able to read and to write in files.
*
* \note Mandatory Part of the project
*
* \author (last to touch it) $Author: DC & NL$
*
* \version $Revision: 1.0 $
*
* \date $Date: 2017.12.11 $
*
* Contact: [email protected] & [email protected]
*
*/
#ifndef PCSC2017_GROUP5_READFILE_H
#define PCSC2017_GROUP5_READFILE_H
#include <string>
#include <fstream>
#include <vector>
///\enum
enum Gender {MALE, FEMALE};
///\struct
struct Data
{
std::vector<double> heights;
std::vector<double> weights;
};
typedef struct {
double x;
double y;
} point_t;
class ReadFile
{
public:
/** \brief Constructor
* \param filename is the name and path of the file to open
*/
explicit ReadFile (std::string const& filename);
/** \brief Reads in the file and save the data in the data variable
* \param data is taken by reference to contain all the values in the file
*/
void loadFromFile(Data& data) const;
/** \brief Reads in the file and save the data in the data variable
* \param data is taken by reference to contain all the values in the file
*/
void loadFromFileTest(Data& data) const;
/** \brief Reads in the file and save the data in the data variable for the config file
*/
std::vector<size_t> loadFromFileConfig() const;
/** \brief gives the name of the file to open
*/
std::string getFilename() const;
/** \brief diplay all the read values in the terminal
* \param data contains the values to display
*/
void show(Data const& data) const;
/** \brief writes in a file
* \param data data to write in a file
*/
void writeFile(Data const& data) const;
private:
std::string mFilename;
};
#endif //PCSC2017_GROUP5_READFILE_H