-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbaseinc.h
280 lines (210 loc) · 4.97 KB
/
baseinc.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
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
/*
* baseinc.h
*
* Standard header include file to get the most common system definitions
*
* Autor: Oliver Maurhart, <[email protected]>
*
* Copyright (C) 2013, AIT Austrian Institute of Technology
* AIT Austrian Institute of Technology GmbH
* Donau-City-Strasse 1 | 1220 Vienna | Austria
* http://www.ait.ac.at
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __BASEINC_H
#define __BASEINC_H
// get definitions found by cmake
#include "config.h"
// ------------------------------------------------------------
// C++
// C++11 standard and boost stuff
#ifdef __cplusplus
# include <algorithm>
# include <cassert>
# include <chrono>
# include <condition_variable>
# include <exception>
# include <fstream>
# include <iostream>
# include <iomanip>
# include <limits>
# include <list>
# include <map>
# include <memory>
# include <mutex>
# include <set>
# include <stdexcept>
# include <sstream>
# include <string>
# include <thread>
# include <tuple>
# include <vector>
# ifdef HAVE_BOOST_LIB
# include <boost/version.hpp>
# include <boost/algorithm/string.hpp>
# include <boost/crc.hpp>
# include <boost/filesystem.hpp>
# include <boost/format.hpp>
// fix for boost 1.51: this boost version has some poor programming quality
# if __GNUC__ == 4 && __GNUC_MINOR__ >= 6 && BOOST_VERSION == 105100
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-parameter"
# include <boost/program_options.hpp>
# pragma GCC diagnostic pop
# else
# include <boost/program_options.hpp>
# endif
# include <boost/program_options/detail/config_file.hpp>
# include <boost/range.hpp>
# include <boost/tokenizer.hpp>
# endif
#endif
// ------------------------------------------------------------
// check defs (headers only)
// standard C headers
#ifdef HAVE_STDIO_H
# include <stdio.h>
#endif
#ifdef HAVE_STDDEF_H
# include <stddef.h>
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#ifdef HAVE_MEMORY_H
# include <memory.h>
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
// stdbool.h
#ifdef HAVE_STDBOOL_H
# include <stdbool.h>
#endif
// endian.h
#ifdef HAVE_ENDIAN_H
# include <endian.h>
#endif
// time system headers
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#ifdef HAVE_SYS_TIMES_H
# include <sys/times.h>
#endif
#ifdef HAVE_TIME_H
# include <time.h>
#endif
// files
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
// some math
#ifdef HAVE_MATH_H
# include <math.h>
#endif
// networking
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
#ifdef HAVE_IFADDRS_H
# include <ifaddrs.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_SYS_UN_H
# include <sys/un.h>
#endif
// Windows networking
#ifdef HAVE_WINSOCK2_H
# include <Winsock2.h>
#endif
// assert.h
#ifdef HAVE_ASSERT_H
# include <assert.h>
#endif
// signal.h
#ifdef HAVE_SIGNAL_H
# include <signal.h>
#endif
// sys/uio.h
#ifdef HAVE_SYS_UIO_H
# include <sys/uio.h>
#endif
// syslog.h
#ifdef HAVE_SYSLOG_H
# include <syslog.h>
#endif
// errno.h
#ifdef HAVE_ERRNO_H
# include <errno.h>
#endif
// limits.h
#ifdef HAVE_LIMITS_H
# include <limits.h>
#endif
// sys/mman.h
#ifdef HAVE_SYS_MMAN_H
# include <sys/mman.h>
#endif
// ------------------------------------------------------------
// packages
// Qt4
#ifdef HAVE_QT4_PKG
#ifdef __cplusplus
// Qt libs are included on a per file basis
// but QtGlobal and QDebug should be included allways
# include <QtGlobal>
# include <QtCore>
# include <QDebug>
#endif
#endif
// ------------------------------------------------------------
// Windows
#ifdef _WIN32
# define __WIN32__
#endif
#ifdef __WIN32__
# include <windows.h>
#endif
// ------------------------------------------------------------
// Linux
#ifdef __linux__
# include <execinfo.h>
#endif
// ------------------------------------------------------------
// common macros
#if defined(__GNUC__)
# define UNUSED __attribute__((unused))
#else
# define UNUSED
#endif
#endif