Blame view

src/ParamGetImpl/LocalFileInterface/FileReaderASCII.hh 2.09 KB
fbe3c2bb   Benjamin Renard   First commit
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
/*
 * 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;

f5c53312   Benjamin Renard   Get calib info in...
26
27
	static std::string ClbKey;

fbe3c2bb   Benjamin Renard   First commit
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
	/*
	 * @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);

f5c53312   Benjamin Renard   Get calib info in...
74
75
76
77
78
79
80
81
82
83
84
85
86
	/*
	 * @brief Get an information
	 */
	virtual bool getInfo(const char* pInfoName, std::vector<double>& res);

	/*
	 * @brief Set time format
	 */
	void setTimeFormat(LocalTimeFormat timeFormat)
	{
		_timeFormat = timeFormat;
	}

fbe3c2bb   Benjamin Renard   First commit
87
88
89
	private:

	/*
f5c53312   Benjamin Renard   Get calib info in...
90
	 * @brief Split line
fbe3c2bb   Benjamin Renard   First commit
91
	 */
f5c53312   Benjamin Renard   Get calib info in...
92
93
94
95
96
97
	bool split (const char *line, std::vector<std::string> &lineFields);

	/*
	 * @brief Get time from string
	 */
	double getTime(std::string& timeString);
fbe3c2bb   Benjamin Renard   First commit
98
99
100
101
102
103

	/*
	 * @brief ASCII identifier
	 */
	std::ifstream _asciiStream;

f5c53312   Benjamin Renard   Get calib info in...
104
105
106
107
108
	/*
	 * @brief Time format
	 */
	LocalTimeFormat _timeFormat;

fbe3c2bb   Benjamin Renard   First commit
109
110
111
112
113
114
};

} /* LocalFileInterface */
} /* AMDA */

#endif /* FILEREADERASCII_HH_ */