|
SAGA C++ API 1.5.3
|
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 00028 #if defined(SAGA_PRINT_USED_NAMESPACE) 00029 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) 00030 #pragma message("Note: using namespace std::tr1") 00031 #elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__) 00032 #warning "using namespace std::tr1" 00033 #endif 00034 #endif 00035 00036 #include <type_traits> // type traits 00037 #include <memory> // shared_ptr, enable_shared_from_this 00038 #include <functional> // function, ref, bind 00039 #include <regex> // regex 00040 #include <array> // array 00041 #define TR1 std::tr1 // define proper namespace 00042 #else 00043 00044 #if defined(SAGA_PRINT_USED_NAMESPACE) 00045 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) 00046 #pragma message("Note: using namespace boost") 00047 #elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__) 00048 #warning "using namespace boost" 00049 #endif 00050 #endif 00051 00052 #include <boost/ref.hpp> 00053 #include <boost/bind.hpp> 00054 #include <boost/shared_ptr.hpp> 00055 #include <boost/weak_ptr.hpp> 00056 #include <boost/enable_shared_from_this.hpp> 00057 #include <boost/function.hpp> 00058 #include <boost/regex.hpp> 00059 #include <boost/array.hpp> 00060 #include <boost/type_traits/is_base_of.hpp> 00061 #include <boost/type_traits/is_reference.hpp> 00062 #include <boost/type_traits/remove_reference.hpp> 00063 #include <boost/type_traits/remove_pointer.hpp> 00064 #define TR1 boost // define proper namespace 00065 00066 // pull in bind placeholders into boost::placeholders 00067 namespace boost { namespace placeholders 00068 { 00069 using ::_1; 00070 using ::_2; 00071 using ::_3; 00072 using ::_4; 00073 using ::_5; 00074 using ::_6; 00075 using ::_7; 00076 using ::_8; 00077 using ::_9; 00078 }} 00079 #endif 00080 00081 #include <saga/saga/export_definitions.hpp> 00082 00084 // maximum count of possible API parameters 00085 #ifndef SAGA_ARGUMENT_LIMIT 00086 #define SAGA_ARGUMENT_LIMIT 6 // default argument count limit 00087 #endif 00088 00089 // make sure this file gets included before any of the Phoenix files 00090 #if defined(PHOENIX_LIMIT) && PHOENIX_LIMIT < 6 00091 # if defined(PHOENIX_TUPLES_HPP) 00092 # error "This file should be included before any of the Phoenix includes, or #define PHOENIX_LIMIT >= 6." 00093 # else 00094 # undef PHOENIX_LIMIT 00095 # endif 00096 #endif 00097 00098 #if !defined(PHOENIX_LIMIT) 00099 # define PHOENIX_LIMIT SAGA_ARGUMENT_LIMIT // tuple size limit 00100 #endif 00101 00103 // Character used to delimit several saga ini paths 00104 #ifdef BOOST_WINDOWS // windows 00105 # define SAGA_INI_PATH_DELIMITER ";" 00106 # define SAGA_SHARED_LIB_EXTENSION ".dll" 00107 # define SAGA_PATH_DELIMITERS "\\/" 00108 #else // unix like 00109 # define SAGA_INI_PATH_DELIMITER ":" 00110 # define SAGA_PATH_DELIMITERS "/" 00111 # ifdef SAGA_APPLE // apple 00112 # define SAGA_SHARED_LIB_EXTENSION ".dylib" 00113 # else // linux & co 00114 # define SAGA_SHARED_LIB_EXTENSION ".so" 00115 # endif 00116 #endif 00117 00119 // define missing POSIX functions 00120 #if defined(BOOST_WINDOWS) 00121 #define snprintf _snprintf 00122 #endif 00123 00125 // We don't need to export the plugins functions for SAGA lite 00126 #if defined(BUILD_SAGA_LITE) 00127 #define BOOST_PLUGIN_NO_EXPORT_API 00128 #endif 00129 00131 // on Windows the debug versions of the libraries have mangled entry points 00132 #if !defined(BOOST_WINDOWS) 00133 # define SAGA_MANGLE_ADAPTOR_NAME(name) BOOST_PP_CAT(libsaga_adaptor_, name) 00134 # define SAGA_MANGLE_ADAPTOR_NAME_STR(name) "libsaga_adaptor_" + name 00135 # define SAGA_MANGLE_PACKAGE_NAME(name) BOOST_PP_CAT(libsaga_package_, name) 00136 # define SAGA_MANGLE_PACKAGE_NAME_STR(name) "libsaga_package_" + name 00137 # define SAGA_MANGLE_ENGINE_NAME(name) BOOST_PP_CAT(libsaga_, name) 00138 # define SAGA_MANGLE_ENGINE_NAME_STR(name) "libsaga_" + name 00139 #elif defined(_DEBUG) 00140 # define SAGA_MANGLE_ADAPTOR_NAME(name) BOOST_PP_CAT(name, d) 00141 # define SAGA_MANGLE_ADAPTOR_NAME_STR(name) name + "d" 00142 # define SAGA_MANGLE_PACKAGE_NAME(name) BOOST_PP_CAT(name, d) 00143 # define SAGA_MANGLE_PACKAGE_NAME_STR(name) name + "d" 00144 # define SAGA_MANGLE_ENGINE_NAME(name) BOOST_PP_CAT(saga_, BOOST_PP_CAT(name, d)) 00145 # define SAGA_MANGLE_ENGINE_NAME_STR(name) "saga_" + name + "d" 00146 #else 00147 # define SAGA_MANGLE_ADAPTOR_NAME(name) name 00148 # define SAGA_MANGLE_ADAPTOR_NAME_STR(name) name 00149 # define SAGA_MANGLE_PACKAGE_NAME(name) name 00150 # define SAGA_MANGLE_PACKAGE_NAME_STR(name) name 00151 # define SAGA_MANGLE_ENGINE_NAME(name) BOOST_PP_CAT(saga_, name) 00152 # define SAGA_MANGLE_ENGINE_NAME_STR(name) "saga_" + name 00153 #endif 00154 00156 // some people like to have exception specifications, allow to use them if 00157 // SAGA_USE_EXCEPTION_SPECIFICATIONS is defined 00158 #if defined(SAGA_USE_EXCEPTION_SPECIFICATIONS) 00159 #define SAGA_THROW_SPEC(x) x 00160 #else 00161 #define SAGA_THROW_SPEC(x) 00162 #endif 00163 00164 #endif // SAGA_UTIL_HPP 00165