SAGA C++ API 1.6
version.hpp
Go to the documentation of this file.
00001 //  Copyright (c) 2005-2007 Andre Merzky (andre@merzky.net)
00002 //  Copyright (c) 2005-2009 Hartmut Kaiser
00003 //  Copyright (c) 2005-2008 Ole Weidner
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_VERSION_HPP
00009 #define SAGA_VERSION_HPP
00010 
00011 #include <boost/preprocessor/cat.hpp>
00012 #include <boost/config.hpp>
00013 #include <saga/saga/util.hpp>
00014 
00015 // SAGA_VERSION and Co come from saga-config
00016 #ifndef SAGA_SKIP_CONFIG_HPP
00017 # include <saga/saga-config.hpp>
00018 #endif
00019 
00020 // masks needed to get at the parts of the full SAGA_VERSION
00021 #define SAGA_VERSION_MAJORMASK    0xFF0000  //  SAGA_VERSION_FULL & 0xFF0000 is the major version
00022 #define SAGA_VERSION_MINORMASK    0x00FF00  //  SAGA_VERSION_FULL & 0x00FF00 is the minor version
00023 #define SAGA_VERSION_SUBMINORMASK 0x0000FF  //  SAGA_VERSION_FULL & 0x0000FF is the sub-minor version
00024 
00025 // The version check enforces the major and minor version numbers to match for
00026 // every compilation unit to be compiled.
00027 #define SAGA_CHECK_VERSION                                                    \
00028     BOOST_PP_CAT(saga_check_version_,                                         \
00029         BOOST_PP_CAT(SAGA_VERSION_MAJOR,                                      \
00030             BOOST_PP_CAT(_, SAGA_VERSION_MINOR)))                             \
00031     
00032 
00034 //  The SAGA API version: here V1.0.0
00035 #define SAGA_VERSION_API          0x010000
00036 
00038 //
00039 //  SAGA_VERSION_ISCOMPATIBLE(), SAGA_VERSION_ISCOMPATIBLE_EX()
00040 // 
00041 //  The SAGA_VERSION_ISCOMPATIBLE macros test, if the version of the loaded
00042 //  SAGA engine is compatible with the version the calling application was 
00043 //  compiled against.
00044 //
00045 #define SAGA_VERSION_ISCOMPATIBLE_EX(version)                                 \
00046     (((version) & ~SAGA_VERSION_SUBMINORMASK) >=                              \
00047        (SAGA_VERSION_FULL & ~SAGA_VERSION_SUBMINORMASK))                      \
00048   
00049   
00050 #define SAGA_VERSION_ISCOMPATIBLE()                                           \
00051     SAGA_VERSION_ISCOMPATIBLE_EX(saga::get_engine_version())                  \
00052   
00053 
00056 namespace saga 
00057 {
00062   SAGA_EXPORT unsigned long get_engine_version (void);
00063   
00068   SAGA_EXPORT unsigned long get_saga_version (void);
00069   
00074 #if !defined(BOOST_WINDOWS)
00075   SAGA_EXPORT extern char const SAGA_CHECK_VERSION[];
00076 #else
00077   SAGA_EXPORT char const* SAGA_CHECK_VERSION();
00078 #endif
00079 
00081 } // namespace saga
00082 
00083 // This is instantiated per translation unit, forcing to resolve the variable
00084 // SAGA_CHECK_VERSION
00085 namespace
00086 {
00087     char const* check_saga_version()
00088     {
00089 #if !defined(BOOST_WINDOWS)
00090         return saga::SAGA_CHECK_VERSION;
00091 #else
00092         return saga::SAGA_CHECK_VERSION();
00093 #endif
00094     }
00095 }
00096 
00097 #endif // !SAGA_VERSION_HPP
00098 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines