- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Search for |

# util.hpp

Go to the documentation of this file.

    00001 //  Copyright (c) 2005-2009 Hartmut Kaiser
    00002 //  Copyright (c) 2005-2007 Andre Merzky (andre@merzky.net)
    00003 //  Copyright (c) 2007 Ole Weidner (oweidner@cct.lsu.edu)
    00004 //
    00005 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
    00006 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
    00007
    00008 #ifndef SAGA_UTIL_HPP
    00009 #define SAGA_UTIL_HPP
    00010
    00011 #include <utility>
    00012 #include <climits>
    00013 #include <saga/saga/base.hpp>
    00014
    00015 #include <boost/config.hpp>
    00016
    00017 // Include Boost specific libraries we rely on in the interface, but which are
    00018 // _not_ replaceable by standard components. We use these as a convenience to
    00019 // avoid reimplementing bicycles. If independence from Boost some day will be a
    00020 // requirement these will have to be replaced.
    00021 #include <boost/cstdint.hpp>
    00022
    00023 // Include Boost specific libraries we rely on in the interface, but which
    00024 // will be replaced by standard headers as soon as TR1 implementations will be
    00025 // available more widely
    00026 #if defined(SAGA_USE_TR1_NAMESPACE)
    00027 #include <type_traits>  // type traits
    00028 #include <memory>       // shared_ptr, enable_shared_from_this
    00029 #include <functional>   // function, ref, bind
    00030 #include <regex>        // regex
    00031 #include <array>        // array
    00032 #define TR1 std::tr1    // define proper namespace
    00033 #else
    00034 #include <boost/ref.hpp>
    00035 #include <boost/bind.hpp>
    00036 #include <boost/shared_ptr.hpp>
    00037 #include <boost/weak_ptr.hpp>
    00038 #include <boost/enable_shared_from_this.hpp>
    00039 #include <boost/function.hpp>
    00040 #include <boost/regex.hpp>
    00041 #include <boost/array.hpp>
    00042 #include <boost/type_traits/is_base_of.hpp>
    00043 #include <boost/type_traits/is_reference.hpp>
    00044 #include <boost/type_traits/remove_reference.hpp>
    00045 #include <boost/type_traits/remove_pointer.hpp>
    00046 #define TR1 boost       // define proper namespace
    00047 #endif
    00048
    00049 #include <saga/saga/export_definitions.hpp>
    00050
    00052 // maximum count of possible API parameters
    00053 #ifndef SAGA_ARGUMENT_LIMIT
    00054 #define SAGA_ARGUMENT_LIMIT  6              // default argument count limit
    00055 #endif
    00056
    00057 // make sure this file gets included before any of the Phoenix files
    00058 #if defined(PHOENIX_LIMIT) && PHOENIX_LIMIT < 6
    00059 # if defined(PHOENIX_TUPLES_HPP)
    00060 #  error "This file should be included before any of the Phoenix includes, or #define PHOENIX_LIMIT >= 6."
    00061 # else
    00062 #  undef PHOENIX_LIMIT
    00063 # endif
    00064 #endif
    00065
    00066 #if !defined(PHOENIX_LIMIT)
    00067 # define PHOENIX_LIMIT SAGA_ARGUMENT_LIMIT   // tuple size limit
    00068 #endif
    00069
    00071 //  Character used to delimit several saga ini paths
    00072 #ifdef BOOST_WINDOWS // windows
    00073 #  define SAGA_INI_PATH_DELIMITER     ";"
    00074 #  define SAGA_SHARED_LIB_EXTENSION   ".dll"
    00075 #  define SAGA_PATH_DELIMITERS        "\\/"
    00076 #else                // unix like
    00077 #  define SAGA_INI_PATH_DELIMITER     ":"
    00078 #  define SAGA_PATH_DELIMITERS        "/"
    00079 #  ifdef SAGA_APPLE   // apple
    00080 #    define SAGA_SHARED_LIB_EXTENSION ".dylib"
    00081 #  else              // linux & co
    00082 #    define SAGA_SHARED_LIB_EXTENSION ".so"
    00083 #  endif
    00084 #endif
    00085
    00087 // define missing POSIX functions
    00088 #if defined(BOOST_WINDOWS)
    00089 #define snprintf _snprintf
    00090 #endif
    00091
    00093 // We don't need to export the plugins functions for SAGA lite
    00094 #if defined(BUILD_SAGA_LITE)
    00095 #define BOOST_PLUGIN_NO_EXPORT_API
    00096 #endif
    00097
    00099 // on Windows the debug versions of the libraries have mangled entry points
    00100 #if !defined(BOOST_WINDOWS)
    00101 # define SAGA_MANGLE_ADAPTOR_NAME(name)        BOOST_PP_CAT(libsaga_adaptor_, name)
    00102 # define SAGA_MANGLE_ADAPTOR_NAME_STR(name)    "libsaga_adaptor_" + name
    00103 # define SAGA_MANGLE_PACKAGE_NAME(name)        BOOST_PP_CAT(libsaga_package_, name)
    00104 # define SAGA_MANGLE_PACKAGE_NAME_STR(name)    "libsaga_package_" + name
    00105 # define SAGA_MANGLE_ENGINE_NAME(name)         BOOST_PP_CAT(libsaga_, name)
    00106 # define SAGA_MANGLE_ENGINE_NAME_STR(name)     "libsaga_" + name
    00107 #elif defined(_DEBUG)
    00108 # define SAGA_MANGLE_ADAPTOR_NAME(name)         BOOST_PP_CAT(name, d)
    00109 # define SAGA_MANGLE_ADAPTOR_NAME_STR(name)     name + "d"
    00110 # define SAGA_MANGLE_PACKAGE_NAME(name)         BOOST_PP_CAT(name, d)
    00111 # define SAGA_MANGLE_PACKAGE_NAME_STR(name)     name + "d"
    00112 # define SAGA_MANGLE_ENGINE_NAME(name)          BOOST_PP_CAT(name, d)
    00113 # define SAGA_MANGLE_ENGINE_NAME_STR(name)      name + "d"
    00114 #else
    00115 # define SAGA_MANGLE_ADAPTOR_NAME(name)         name
    00116 # define SAGA_MANGLE_ADAPTOR_NAME_STR(name)     name
    00117 # define SAGA_MANGLE_PACKAGE_NAME(name)         name
    00118 # define SAGA_MANGLE_PACKAGE_NAME_STR(name)     name
    00119 # define SAGA_MANGLE_ENGINE_NAME(name)          name
    00120 # define SAGA_MANGLE_ENGINE_NAME_STR(name)      name
    00121 #endif
    00122
    00124 // some people like to have exception specifications, allow to use them if
    00125 // SAGA_USE_EXCEPTION_SPECIFICATIONS is defined
    00126 #if defined(SAGA_USE_EXCEPTION_SPECIFICATIONS)
    00127 #define SAGA_THROW_SPEC(x) x
    00128 #else
    00129 #define SAGA_THROW_SPEC(x)
    00130 #endif
    00131
    00132 #endif  // SAGA_UTIL_HPP
    00133