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