ait/os/baseinc.h
branchom
changeset 2 c9bf2537109a
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ait/os/baseinc.h	Tue Nov 12 11:31:34 2013 +0100
     1.3 @@ -0,0 +1,263 @@
     1.4 +/*
     1.5 + * baseinc.h
     1.6 + *
     1.7 + * Standard header include file to get the most common system definitions
     1.8 + *
     1.9 + * Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
    1.10 + *
    1.11 + * Copyright (C) 2013 AIT Austrian Institute of Technology
    1.12 + * AIT Austrian Institute of Technology GmbH
    1.13 + * Donau-City-Strasse 1 | 1220 Vienna | Austria
    1.14 + * http://www.ait.ac.at
    1.15 + *
    1.16 + * This library is free software; you can redistribute it and/or
    1.17 + * modify it under the terms of the GNU Lesser General Public
    1.18 + * License version 2.1 as published by the Free Software Foundation.
    1.19 + *
    1.20 + * This library is distributed in the hope that it will be useful,
    1.21 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.22 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.23 + * Lesser General Public License for more details.
    1.24 + *
    1.25 + * You should have received a copy of the GNU Lesser General Public
    1.26 + * License along with this library; if not, write to the
    1.27 + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    1.28 + * Boston, MA 02110-1301, USA.
    1.29 + */
    1.30 +
    1.31 +#ifndef __BASEINC_H
    1.32 +#define __BASEINC_H
    1.33 +
    1.34 +// get definitions found by cmake
    1.35 +#include "config.h"
    1.36 +
    1.37 +// ------------------------------------------------------------
    1.38 +// C++
    1.39 +
    1.40 +// C++11 standard and boost stuff
    1.41 +#ifdef __cplusplus
    1.42 +#   include <algorithm>
    1.43 +#   include <atomic>
    1.44 +#   include <cassert>
    1.45 +#   include <chrono>
    1.46 +#   include <condition_variable>
    1.47 +#   include <deque>
    1.48 +#   include <exception>
    1.49 +#   include <fstream>
    1.50 +#   include <iostream>
    1.51 +#   include <iomanip>
    1.52 +#   include <limits>
    1.53 +#   include <list>
    1.54 +#   include <map>
    1.55 +#   include <memory>
    1.56 +#   include <mutex>
    1.57 +#   include <queue>
    1.58 +#   include <set>
    1.59 +#   include <stdexcept>
    1.60 +#   include <sstream>
    1.61 +#   include <string>
    1.62 +#   include <thread>
    1.63 +#   include <tuple>
    1.64 +#   include <vector>
    1.65 +
    1.66 +#   ifdef HAVE_BOOST_LIB
    1.67 +#       include <boost/algorithm/string.hpp>
    1.68 +#       include <boost/crc.hpp>
    1.69 +#       include <boost/filesystem.hpp>
    1.70 +#       include <boost/format.hpp>
    1.71 +#       include <boost/program_options.hpp>
    1.72 +#       include <boost/program_options/detail/config_file.hpp>
    1.73 +#       include <boost/range.hpp>
    1.74 +#       include <boost/tokenizer.hpp>
    1.75 +#   endif
    1.76 +
    1.77 +#endif
    1.78 +
    1.79 +
    1.80 +// ------------------------------------------------------------
    1.81 +// check defs (headers only)
    1.82 +
    1.83 +// standard C headers
    1.84 +#ifdef HAVE_STDIO_H 
    1.85 +#   include <stdio.h>
    1.86 +#endif
    1.87 +
    1.88 +#ifdef HAVE_STDDEF_H 
    1.89 +#   include <stddef.h>
    1.90 +#endif
    1.91 +
    1.92 +#ifdef HAVE_STDLIB_H
    1.93 +#   include <stdlib.h>
    1.94 +#endif
    1.95 +
    1.96 +#ifdef HAVE_INTTYPES_H
    1.97 +#   include <inttypes.h>
    1.98 +#endif
    1.99 +
   1.100 +#ifdef HAVE_MEMORY_H
   1.101 +#   include <memory.h>
   1.102 +#endif
   1.103 +
   1.104 +#ifdef HAVE_STRING_H
   1.105 +#   include <string.h>
   1.106 +#endif
   1.107 +
   1.108 +#ifdef HAVE_UNISTD_H
   1.109 +#   include <unistd.h>
   1.110 +#endif
   1.111 +
   1.112 +
   1.113 +// stdbool.h
   1.114 +#ifdef HAVE_STDBOOL_H
   1.115 +#   include <stdbool.h>
   1.116 +#endif
   1.117 +
   1.118 +
   1.119 +// endian.h
   1.120 +#ifdef HAVE_ENDIAN_H
   1.121 +#   include <endian.h>
   1.122 +#endif
   1.123 +
   1.124 +
   1.125 +// time system headers
   1.126 +#ifdef HAVE_SYS_TIME_H
   1.127 +#   include <sys/time.h>
   1.128 +#endif
   1.129 +
   1.130 +#ifdef HAVE_SYS_TIMES_H
   1.131 +#   include <sys/times.h>
   1.132 +#endif
   1.133 +
   1.134 +#ifdef HAVE_TIME_H
   1.135 +#   include <time.h>
   1.136 +#endif
   1.137 +
   1.138 +
   1.139 +// files
   1.140 +#ifdef HAVE_FCNTL_H
   1.141 +#   include <fcntl.h>
   1.142 +#endif
   1.143 +
   1.144 +#ifdef HAVE_SYS_STAT_H
   1.145 +#   include <sys/stat.h>
   1.146 +#endif
   1.147 +
   1.148 +
   1.149 +// some math
   1.150 +#ifdef HAVE_MATH_H
   1.151 +#   include <math.h>
   1.152 +#endif
   1.153 +
   1.154 +
   1.155 +// networking
   1.156 +#ifdef HAVE_NETDB_H
   1.157 +#   include <netdb.h>
   1.158 +#endif
   1.159 +
   1.160 +#ifdef HAVE_IFADDRS_H
   1.161 +#   include <ifaddrs.h>
   1.162 +#endif
   1.163 +
   1.164 +#ifdef HAVE_NETINET_IN_H
   1.165 +#   include <netinet/in.h>
   1.166 +#endif
   1.167 +
   1.168 +#ifdef HAVE_ARPA_INET_H
   1.169 +#   include <arpa/inet.h>
   1.170 +#endif
   1.171 +
   1.172 +#ifdef HAVE_SYS_SOCKET_H
   1.173 +#   include <sys/socket.h>
   1.174 +#endif
   1.175 +
   1.176 +#ifdef HAVE_SYS_UN_H
   1.177 +#   include <sys/un.h>
   1.178 +#endif
   1.179 +
   1.180 +
   1.181 +// assert.h
   1.182 +#ifdef HAVE_ASSERT_H
   1.183 +#   include <assert.h>
   1.184 +#endif
   1.185 +
   1.186 +
   1.187 +// signal.h
   1.188 +#ifdef HAVE_SIGNAL_H
   1.189 +#   include <signal.h>
   1.190 +#endif
   1.191 +
   1.192 +
   1.193 +// sys/uio.h
   1.194 +#ifdef HAVE_SYS_UIO_H
   1.195 +#   include <sys/uio.h>
   1.196 +#endif
   1.197 +
   1.198 +
   1.199 +// syslog.h
   1.200 +#ifdef HAVE_SYSLOG_H
   1.201 +#   include <syslog.h>
   1.202 +#endif
   1.203 +
   1.204 +
   1.205 +// errno.h
   1.206 +#ifdef HAVE_ERRNO_H
   1.207 +#   include <errno.h>
   1.208 +#endif
   1.209 +
   1.210 +
   1.211 +// limits.h
   1.212 +#ifdef HAVE_LIMITS_H
   1.213 +#   include <limits.h>
   1.214 +#endif
   1.215 +
   1.216 +
   1.217 +// sys/mman.h
   1.218 +#ifdef HAVE_SYS_MMAN_H
   1.219 +#   include <sys/mman.h>
   1.220 +#endif
   1.221 +
   1.222 +
   1.223 +// dirent.h
   1.224 +#ifdef HAVE_DIRENT_H
   1.225 +#   include <dirent.h>
   1.226 +#endif
   1.227 +
   1.228 +
   1.229 +// fuse.h
   1.230 +#ifdef HAVE_FUSE_H
   1.231 +#   ifndef FUSE_USE_VERSION
   1.232 +#       define FUSE_USE_VERSION 30
   1.233 +#   endif
   1.234 +#   include <fuse.h>
   1.235 +#endif
   1.236 +
   1.237 +
   1.238 +// ------------------------------------------------------------
   1.239 +// Windows
   1.240 +
   1.241 +#ifdef __WIN32__
   1.242 +#   include <windows.h>
   1.243 +#endif
   1.244 +
   1.245 +
   1.246 +// ------------------------------------------------------------
   1.247 +// Linux
   1.248 +
   1.249 +#ifdef __linux__
   1.250 +#   include <execinfo.h>
   1.251 +#endif
   1.252 +
   1.253 +
   1.254 +// ------------------------------------------------------------
   1.255 +// common macros
   1.256 +
   1.257 +#if defined(__GNUC__) || defined(__GNUCPP__)
   1.258 +#   define UNUSED   __attribute__((unused))
   1.259 +#else
   1.260 +#   define UNUSED
   1.261 +#endif
   1.262 +
   1.263 +
   1.264 +
   1.265 +#endif
   1.266 +