-
Notifications
You must be signed in to change notification settings - Fork 0
/
FileUtils.h
47 lines (35 loc) · 1.09 KB
/
FileUtils.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
/**
* Utility methods for save data in binary file on disk and read data from file
*/
#ifndef FILE_UTILS_H
#define FILE_UTILS_H
#include <fstream> //Äëÿ ðàáîòû ñ ôàéëàìè
#include "Config.h"
using namespace std;
extern char* BASE_DIR;
extern char* TIME_SERIES_FILE_NAME;
extern char* RESULT_FILE_NAME;
extern char* DISTANCE_MATRIX_FILE_NAME;
/**
* Data structure:
* 1. TIME_SERIES_FILE
* first string: length of series - long
* second string: time series items:
* 2. DISTANCE_MATRIX_FILE
* first string: m-n+1 - long
* strings 2 - m-n+2: distance matrix rows:
*/
series_t readTimeSeries(ifstream reader);
matrix_t readDistanceMatrix(ifstream reader);
bool writeResult(ofstream writer, long bsfPos, float bsfDist);
bool writeResult(long bsfPos, float bsfDist, float time, int threadsNum);
bool writeDistanceMatrix(ofstream writer, matrix_t distMatrix);
/**
* Read time series items from text file
* File contains m items (one per line)
* @param m - length of time series
* @param path - path to file with time series data
* @return time series
*/
series_t readTimeSeries(char* path, int m);
#endif