ait/os/baseinc.h
author om
Tue, 12 Nov 2013 11:31:34 +0100
branchom
changeset 2 c9bf2537109a
permissions -rw-r--r--
added C/C++ and Python sources
om@2
     1
/*
om@2
     2
 * baseinc.h
om@2
     3
 *
om@2
     4
 * Standard header include file to get the most common system definitions
om@2
     5
 *
om@2
     6
 * Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
om@2
     7
 *
om@2
     8
 * Copyright (C) 2013 AIT Austrian Institute of Technology
om@2
     9
 * AIT Austrian Institute of Technology GmbH
om@2
    10
 * Donau-City-Strasse 1 | 1220 Vienna | Austria
om@2
    11
 * http://www.ait.ac.at
om@2
    12
 *
om@2
    13
 * This library is free software; you can redistribute it and/or
om@2
    14
 * modify it under the terms of the GNU Lesser General Public
om@2
    15
 * License version 2.1 as published by the Free Software Foundation.
om@2
    16
 *
om@2
    17
 * This library is distributed in the hope that it will be useful,
om@2
    18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
om@2
    19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
om@2
    20
 * Lesser General Public License for more details.
om@2
    21
 *
om@2
    22
 * You should have received a copy of the GNU Lesser General Public
om@2
    23
 * License along with this library; if not, write to the
om@2
    24
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
om@2
    25
 * Boston, MA 02110-1301, USA.
om@2
    26
 */
om@2
    27
om@2
    28
#ifndef __BASEINC_H
om@2
    29
#define __BASEINC_H
om@2
    30
om@2
    31
// get definitions found by cmake
om@2
    32
#include "config.h"
om@2
    33
om@2
    34
// ------------------------------------------------------------
om@2
    35
// C++
om@2
    36
om@2
    37
// C++11 standard and boost stuff
om@2
    38
#ifdef __cplusplus
om@2
    39
#   include <algorithm>
om@2
    40
#   include <atomic>
om@2
    41
#   include <cassert>
om@2
    42
#   include <chrono>
om@2
    43
#   include <condition_variable>
om@2
    44
#   include <deque>
om@2
    45
#   include <exception>
om@2
    46
#   include <fstream>
om@2
    47
#   include <iostream>
om@2
    48
#   include <iomanip>
om@2
    49
#   include <limits>
om@2
    50
#   include <list>
om@2
    51
#   include <map>
om@2
    52
#   include <memory>
om@2
    53
#   include <mutex>
om@2
    54
#   include <queue>
om@2
    55
#   include <set>
om@2
    56
#   include <stdexcept>
om@2
    57
#   include <sstream>
om@2
    58
#   include <string>
om@2
    59
#   include <thread>
om@2
    60
#   include <tuple>
om@2
    61
#   include <vector>
om@2
    62
om@2
    63
#   ifdef HAVE_BOOST_LIB
om@2
    64
#       include <boost/algorithm/string.hpp>
om@2
    65
#       include <boost/crc.hpp>
om@2
    66
#       include <boost/filesystem.hpp>
om@2
    67
#       include <boost/format.hpp>
om@2
    68
#       include <boost/program_options.hpp>
om@2
    69
#       include <boost/program_options/detail/config_file.hpp>
om@2
    70
#       include <boost/range.hpp>
om@2
    71
#       include <boost/tokenizer.hpp>
om@2
    72
#   endif
om@2
    73
om@2
    74
#endif
om@2
    75
om@2
    76
om@2
    77
// ------------------------------------------------------------
om@2
    78
// check defs (headers only)
om@2
    79
om@2
    80
// standard C headers
om@2
    81
#ifdef HAVE_STDIO_H 
om@2
    82
#   include <stdio.h>
om@2
    83
#endif
om@2
    84
om@2
    85
#ifdef HAVE_STDDEF_H 
om@2
    86
#   include <stddef.h>
om@2
    87
#endif
om@2
    88
om@2
    89
#ifdef HAVE_STDLIB_H
om@2
    90
#   include <stdlib.h>
om@2
    91
#endif
om@2
    92
om@2
    93
#ifdef HAVE_INTTYPES_H
om@2
    94
#   include <inttypes.h>
om@2
    95
#endif
om@2
    96
om@2
    97
#ifdef HAVE_MEMORY_H
om@2
    98
#   include <memory.h>
om@2
    99
#endif
om@2
   100
om@2
   101
#ifdef HAVE_STRING_H
om@2
   102
#   include <string.h>
om@2
   103
#endif
om@2
   104
om@2
   105
#ifdef HAVE_UNISTD_H
om@2
   106
#   include <unistd.h>
om@2
   107
#endif
om@2
   108
om@2
   109
om@2
   110
// stdbool.h
om@2
   111
#ifdef HAVE_STDBOOL_H
om@2
   112
#   include <stdbool.h>
om@2
   113
#endif
om@2
   114
om@2
   115
om@2
   116
// endian.h
om@2
   117
#ifdef HAVE_ENDIAN_H
om@2
   118
#   include <endian.h>
om@2
   119
#endif
om@2
   120
om@2
   121
om@2
   122
// time system headers
om@2
   123
#ifdef HAVE_SYS_TIME_H
om@2
   124
#   include <sys/time.h>
om@2
   125
#endif
om@2
   126
om@2
   127
#ifdef HAVE_SYS_TIMES_H
om@2
   128
#   include <sys/times.h>
om@2
   129
#endif
om@2
   130
om@2
   131
#ifdef HAVE_TIME_H
om@2
   132
#   include <time.h>
om@2
   133
#endif
om@2
   134
om@2
   135
om@2
   136
// files
om@2
   137
#ifdef HAVE_FCNTL_H
om@2
   138
#   include <fcntl.h>
om@2
   139
#endif
om@2
   140
om@2
   141
#ifdef HAVE_SYS_STAT_H
om@2
   142
#   include <sys/stat.h>
om@2
   143
#endif
om@2
   144
om@2
   145
om@2
   146
// some math
om@2
   147
#ifdef HAVE_MATH_H
om@2
   148
#   include <math.h>
om@2
   149
#endif
om@2
   150
om@2
   151
om@2
   152
// networking
om@2
   153
#ifdef HAVE_NETDB_H
om@2
   154
#   include <netdb.h>
om@2
   155
#endif
om@2
   156
om@2
   157
#ifdef HAVE_IFADDRS_H
om@2
   158
#   include <ifaddrs.h>
om@2
   159
#endif
om@2
   160
om@2
   161
#ifdef HAVE_NETINET_IN_H
om@2
   162
#   include <netinet/in.h>
om@2
   163
#endif
om@2
   164
om@2
   165
#ifdef HAVE_ARPA_INET_H
om@2
   166
#   include <arpa/inet.h>
om@2
   167
#endif
om@2
   168
om@2
   169
#ifdef HAVE_SYS_SOCKET_H
om@2
   170
#   include <sys/socket.h>
om@2
   171
#endif
om@2
   172
om@2
   173
#ifdef HAVE_SYS_UN_H
om@2
   174
#   include <sys/un.h>
om@2
   175
#endif
om@2
   176
om@2
   177
om@2
   178
// assert.h
om@2
   179
#ifdef HAVE_ASSERT_H
om@2
   180
#   include <assert.h>
om@2
   181
#endif
om@2
   182
om@2
   183
om@2
   184
// signal.h
om@2
   185
#ifdef HAVE_SIGNAL_H
om@2
   186
#   include <signal.h>
om@2
   187
#endif
om@2
   188
om@2
   189
om@2
   190
// sys/uio.h
om@2
   191
#ifdef HAVE_SYS_UIO_H
om@2
   192
#   include <sys/uio.h>
om@2
   193
#endif
om@2
   194
om@2
   195
om@2
   196
// syslog.h
om@2
   197
#ifdef HAVE_SYSLOG_H
om@2
   198
#   include <syslog.h>
om@2
   199
#endif
om@2
   200
om@2
   201
om@2
   202
// errno.h
om@2
   203
#ifdef HAVE_ERRNO_H
om@2
   204
#   include <errno.h>
om@2
   205
#endif
om@2
   206
om@2
   207
om@2
   208
// limits.h
om@2
   209
#ifdef HAVE_LIMITS_H
om@2
   210
#   include <limits.h>
om@2
   211
#endif
om@2
   212
om@2
   213
om@2
   214
// sys/mman.h
om@2
   215
#ifdef HAVE_SYS_MMAN_H
om@2
   216
#   include <sys/mman.h>
om@2
   217
#endif
om@2
   218
om@2
   219
om@2
   220
// dirent.h
om@2
   221
#ifdef HAVE_DIRENT_H
om@2
   222
#   include <dirent.h>
om@2
   223
#endif
om@2
   224
om@2
   225
om@2
   226
// fuse.h
om@2
   227
#ifdef HAVE_FUSE_H
om@2
   228
#   ifndef FUSE_USE_VERSION
om@2
   229
#       define FUSE_USE_VERSION 30
om@2
   230
#   endif
om@2
   231
#   include <fuse.h>
om@2
   232
#endif
om@2
   233
om@2
   234
om@2
   235
// ------------------------------------------------------------
om@2
   236
// Windows
om@2
   237
om@2
   238
#ifdef __WIN32__
om@2
   239
#   include <windows.h>
om@2
   240
#endif
om@2
   241
om@2
   242
om@2
   243
// ------------------------------------------------------------
om@2
   244
// Linux
om@2
   245
om@2
   246
#ifdef __linux__
om@2
   247
#   include <execinfo.h>
om@2
   248
#endif
om@2
   249
om@2
   250
om@2
   251
// ------------------------------------------------------------
om@2
   252
// common macros
om@2
   253
om@2
   254
#if defined(__GNUC__) || defined(__GNUCPP__)
om@2
   255
#   define UNUSED   __attribute__((unused))
om@2
   256
#else
om@2
   257
#   define UNUSED
om@2
   258
#endif
om@2
   259
om@2
   260
om@2
   261
om@2
   262
#endif
om@2
   263