-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfpm.h
More file actions
192 lines (151 loc) · 4.08 KB
/
fpm.h
File metadata and controls
192 lines (151 loc) · 4.08 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
/*
* FPM
* Alireza Naimi
* March, 2015
*/
#ifndef FN_H
#define FN_H
#ifdef ALI_EXPORT
#define ALI_API __declspec(dllexport)
#else
#define ALI_API __declspec(dllimport)
#endif
#include "rec.h"
#include <sstream>
#include <vector>
#include <ctime>
#include <iostream>
#include <cstdio>
#include <string>
#include <functional>
#include <signal.h>
#include <atomic>
#include <boost/signals2.hpp>
using namespace std;
enum mnth {
January, February, March, April, May, June,
July, August, September, October, November, December
};
enum days{ Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday };
static const char *monthsNames[12] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
static const char * dayNames[7] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
void ali_timer(std::function<void(void)>, unsigned int);
typedef unsigned long long ullong;
class db
{
public:
boost::signals2::signal<void()> sigImported;
boost::signals2::signal<void()> SigExported;
boost::signals2::signal<void(string)> SigMSG;
db();
vector <rec> allRec;
unsigned concurentThreadsSupported;
static bool multithreaded_console_IO;
int preprocess_o(char *);
void process_o(bool DoW[], bool MoY[], bool ToD[], struct tm tm_fr, struct tm tm_to);
void process();
int preprocess();
void process2();
int split_by;
bool DoW[7];
bool MoY[12];
bool ToD[24];
vector <int> Yremoved;
struct structProgrs{
std::atomic<ullong> cnt;
std::atomic<ullong> ib;
string cur;
string progrs_txt;
std::atomic<double> progrs_per;
std::atomic<ullong> cnt_line_read;
std::atomic<ullong> cnt_line_wrote;
std::atomic<ullong> total_shp_files;
std::atomic<ullong> total_shp_recs;
std::atomic<ullong> total_shp_recs_done;
long steps;
};
static structProgrs progrs;
static ullong length;
void Set_fr(struct tm v);
struct tm Get_fr();
void Set_to(struct tm v);
struct tm Get_to();
time_t Get_fr_timet();
time_t Get_to_timet();
struct tm tm_fr;
struct tm tm_to;
struct tm tm_fr_min();
struct tm tm_to_max();
time_t dur();
void find_minmax_fr_to();
struct structMapf{
int x = 0;
int y = 1;
int segment = 2;
int truckid = 3;
int readdate = 4;
int speed = 5;
int heading = 6;
int iid = 7;
};
static structMapf mapf;
static bool export_csv;
static bool export_shp;
static bool export_separateDT;
int sizl = 0;
char *test[10];
bool AllDoWChecked = true;
bool AllMoYChecked = true;
bool AllToDChecked = true;
int readdb();
char * read_wholefile();
void reset();
void char2tm(const char *ca_dt, time_t *);
mnth get_month() { return month; }
string get_month_str();
void set_month(string);
void set_month(mnth);
char delim = ',';
char delimbs = '/';
char delimsc = ':';
int w2shp();
int _w2shp();
int _w2shp_n2(string fn, vector<unsigned long> lst);
int _w2shp_o();
int _w2shp_o(string fn, long fr, long to);
std::string str_in;
std::string str_out;
void chkinc(bool * inc, rec * r);
static bool lock;
void hdlCMDMSG(string);
// int maino(int, char**);
int maino(int argc, char* argv[]);
void get_file_size();
static bool applyDST;
private:
time_t _tm_fr_it;
time_t _tm_to_it;
struct tm _tm_fr_min;
struct tm _tm_to_max;
time_t _dur;
rec r;
mnth month;
char *ctmpp;
int st_dt = 0;
int iperv = 0;
inline void filrec(char * rowp, bool * inc);
void split_row(char *row, char* a[], char** b);
void split_row2(char *row, char* a[], char** b);
void split_row_s(char *row, string(&s)[10]);
void chkinc_once(bool DoW[], bool MoY[], bool ToD[]);
void find_start_datetime(int & st_dt, int & sizl, const char *ctmpp);
int testwithCpp(char * name, int N);
int doSomeComputation(int * numbers, size_t size);
int ifs();
void sortdb();
void fill_tz();
void fill_tz_(size_t beg, size_t end);
};
std::string itos(int);
const std::string currentDateTime();
#endif