Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00009
00010
00011 #ifndef SAGA_UTIL_HPP
00012 #define SAGA_UTIL_HPP
00013
00014 #include <utility>
00015 #include <climits>
00016 #include <saga/saga/base.hpp>
00017
00018 #include <boost/config.hpp>
00019
00020
00021
00022
00023
00024 #include <boost/cstdint.hpp>
00025
00026
00027
00028
00029 #if defined(SAGA_USE_TR1_NAMESPACE)
00030
00031 #if defined(SAGA_PRINT_USED_NAMESPACE)
00032 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__)
00033 #pragma message("Note: using namespace std::tr1")
00034 #elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__)
00035 #warning "using namespace std::tr1"
00036 #endif
00037 #endif
00038
00039 #include <type_traits>
00040 #include <memory>
00041 #include <functional>
00042 #include <regex>
00043 #include <array>
00044 #define TR1 std::tr1 // define proper namespace
00045 #else
00046
00047 #if defined(SAGA_PRINT_USED_NAMESPACE)
00048 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__)
00049 #pragma message("Note: using namespace boost")
00050 #elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__)
00051 #warning "using namespace boost"
00052 #endif
00053 #endif
00054
00055 #include <boost/ref.hpp>
00056 #include <boost/bind.hpp>
00057 #include <boost/shared_ptr.hpp>
00058 #include <boost/weak_ptr.hpp>
00059 #include <boost/enable_shared_from_this.hpp>
00060 #include <boost/function.hpp>
00061 #include <boost/regex.hpp>
00062 #include <boost/array.hpp>
00063 #include <boost/type_traits/is_base_of.hpp>
00064 #include <boost/type_traits/is_reference.hpp>
00065 #include <boost/type_traits/remove_reference.hpp>
00066 #include <boost/type_traits/remove_pointer.hpp>
00067 #define TR1 boost // define proper namespace
00068
00069
00070
00071
00072 namespace boost { namespace placeholders
00073 {
00074 using ::_1;
00075 using ::_2;
00076 using ::_3;
00077 using ::_4;
00078 using ::_5;
00079 using ::_6;
00080 using ::_7;
00081 using ::_8;
00082 using ::_9;
00083 }}
00084 #endif
00085
00086 #include <saga/saga/export_definitions.hpp>
00087
00089
00090 #ifndef SAGA_ARGUMENT_LIMIT
00091 #define SAGA_ARGUMENT_LIMIT 6 // default argument count limit
00092 #endif
00093
00094
00095 #if defined(PHOENIX_LIMIT) && PHOENIX_LIMIT < 6
00096 # if defined(PHOENIX_TUPLES_HPP)
00097 # error "This file should be included before any of the Phoenix includes, or #define PHOENIX_LIMIT >= 6."
00098 # else
00099 # undef PHOENIX_LIMIT
00100 # endif
00101 #endif
00102
00103 #if !defined(PHOENIX_LIMIT)
00104 # define PHOENIX_LIMIT SAGA_ARGUMENT_LIMIT // tuple size limit
00105 #endif
00106
00108
00109 #ifdef BOOST_WINDOWS // windows
00110 # define SAGA_INI_PATH_DELIMITER ";"
00111 # define SAGA_SHARED_LIB_EXTENSION ".dll"
00112 # define SAGA_PATH_DELIMITERS "\\/"
00113 #else // unix like
00114 # define SAGA_INI_PATH_DELIMITER ":"
00115 # define SAGA_PATH_DELIMITERS "/"
00116 # ifdef SAGA_APPLE // apple
00117 # define SAGA_SHARED_LIB_EXTENSION ".dylib"
00118 # else // linux & co
00119 # define SAGA_SHARED_LIB_EXTENSION ".so"
00120 # endif
00121 #endif
00122
00124
00125 #if defined(BOOST_WINDOWS)
00126 #define snprintf _snprintf
00127 #endif
00128
00130
00131 #if defined(BUILD_SAGA_LITE)
00132 #define BOOST_PLUGIN_NO_EXPORT_API
00133 #endif
00134
00136
00137 #if !defined(BOOST_WINDOWS)
00138 # define SAGA_MANGLE_ADAPTOR_NAME(name) BOOST_PP_CAT(libsaga_adaptor_, name)
00139 # define SAGA_MANGLE_ADAPTOR_NAME_STR(name) "libsaga_adaptor_" + name
00140 # define SAGA_MANGLE_PACKAGE_NAME(name) BOOST_PP_CAT(libsaga_package_, name)
00141 # define SAGA_MANGLE_PACKAGE_NAME_STR(name) "libsaga_package_" + name
00142 # define SAGA_MANGLE_ENGINE_NAME(name) BOOST_PP_CAT(libsaga_, name)
00143 # define SAGA_MANGLE_ENGINE_NAME_STR(name) "libsaga_" + name
00144 #elif defined(_DEBUG)
00145 # define SAGA_MANGLE_ADAPTOR_NAME(name) BOOST_PP_CAT(name, d)
00146 # define SAGA_MANGLE_ADAPTOR_NAME_STR(name) name + "d"
00147 # define SAGA_MANGLE_PACKAGE_NAME(name) BOOST_PP_CAT(name, d)
00148 # define SAGA_MANGLE_PACKAGE_NAME_STR(name) name + "d"
00149 # define SAGA_MANGLE_ENGINE_NAME(name) BOOST_PP_CAT(saga_, BOOST_PP_CAT(name, d))
00150 # define SAGA_MANGLE_ENGINE_NAME_STR(name) "saga_" + name + "d"
00151 #else
00152 # define SAGA_MANGLE_ADAPTOR_NAME(name) name
00153 # define SAGA_MANGLE_ADAPTOR_NAME_STR(name) name
00154 # define SAGA_MANGLE_PACKAGE_NAME(name) name
00155 # define SAGA_MANGLE_PACKAGE_NAME_STR(name) name
00156 # define SAGA_MANGLE_ENGINE_NAME(name) BOOST_PP_CAT(saga_, name)
00157 # define SAGA_MANGLE_ENGINE_NAME_STR(name) "saga_" + name
00158 #endif
00159
00161
00162
00163 #if defined(SAGA_USE_EXCEPTION_SPECIFICATIONS)
00164 #define SAGA_THROW_SPEC(x) x
00165 #else
00166 #define SAGA_THROW_SPEC(x)
00167 #endif
00168
00170
00171 #if !defined(SAGA_MODULE_NAME)
00172 # if defined(SAGA_PACKAGE_NAME)
00173 # define SAGA_MODULE_NAME SAGA_PACKAGE_NAME
00174 # define SAGA_MANGLED_MODULE_NAME SAGA_MANGLE_PACKAGE_NAME(SAGA_PACKAGE_NAME)
00175 # elif defined(SAGA_ADAPTOR_NAME)
00176 # define SAGA_MODULE_NAME SAGA_ADAPTOR_NAME
00177 # define SAGA_MANGLED_MODULE_NAME SAGA_MANGLE_ADAPTOR_NAME(SAGA_ADAPTOR_NAME)
00178 # elif defined(SAGA_ENGINE_EXPORTS)
00179 # define SAGA_MODULE_NAME saga_core
00180 # define SAGA_MANGLED_MODULE_NAME SAGA_MANGLE_ENGINE_NAME(core)
00181 # else
00182 # define SAGA_MODULE_NAME unknown
00183 # define SAGA_MANGLED_MODULE_NAME unknown
00184 # endif
00185 #endif
00186
00187 #endif // SAGA_UTIL_HPP
00188
00190