FileReaderASCII.hh
2.09 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
* FileReaderASCII.hh
*
* Created on: Nov 24, 2014
* Author: AKKA
*/
#ifndef FILEREADERASCII_HH_
#define FILEREADERASCII_HH_
#include <fstream>
#include "FileReaderAbstract.hh"
namespace AMDA {
namespace LocalFileInterface {
/*
* @brief Implementation of the class FileReaderAbstract to load a ASCII file format
*/
class FileReaderASCII : public FileReaderAbstract
{
public:
static int MaxLineSize;
static std::string ClbKey;
/*
* @brief Constructor
*/
FileReaderASCII();
/*
* @brief Destructor
*/
virtual ~FileReaderASCII();
/*
* @brief Open a ASCII file
*/
virtual bool open(std::string filePath);
/*
* @brief Close the ASCII file
*/
virtual bool close(void);
/*
* @brief Test if a ASCII file is currently opened
*/
virtual bool isOpened(void);
/*
* @brief Get the id of the time param to use. For the ASCII format, it's the first column
*/
virtual std::string getTimeParamId(void);
/*
* @brief Get a param type and a param size in the ASCII file
*/
virtual bool getParamInfo(std::string& paramId, LocalParamType& paramType, int& dim1Size, int& dim2Size);
/*
* @brief Get the index of the nearest record of time (the higher one) in the ASCII file
*/
virtual int getRecordIndex(std::string& timeId, double time);
/*
* @brief Get a param packet from the ASCII file
*/
virtual FileReaderStatus getParamPacketData(std::string& timeId, std::string& paramId,
int recordIndex, double stopTime, LocalParamDataPacket *packet);
/*
* @brief Get an information
*/
virtual bool getInfo(const char* pInfoName, std::vector<double>& res);
/*
* @brief Set time format
*/
void setTimeFormat(LocalTimeFormat timeFormat)
{
_timeFormat = timeFormat;
}
private:
/*
* @brief Split line
*/
bool split (const char *line, std::vector<std::string> &lineFields);
/*
* @brief Get time from string
*/
double getTime(std::string& timeString);
/*
* @brief ASCII identifier
*/
std::ifstream _asciiStream;
/*
* @brief Time format
*/
LocalTimeFormat _timeFormat;
};
} /* LocalFileInterface */
} /* AMDA */
#endif /* FILEREADERASCII_HH_ */