Lunchbox  1.4.0
version.h
00001 
00002 /* Copyright (c) 2011-2012, Stefan Eilemann <eile@eyescale.ch> 
00003  *
00004  * This library is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU Lesser General Public License version 2.1 as published
00006  * by the Free Software Foundation.
00007  *  
00008  * This library is distributed in the hope that it will be useful, but WITHOUT
00009  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00010  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00011  * details.
00012  * 
00013  * You should have received a copy of the GNU Lesser General Public License
00014  * along with this library; if not, write to the Free Software Foundation, Inc.,
00015  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00016  */
00017 
00018 #ifndef LUNCHBOX_VERSION_H
00019 #define LUNCHBOX_VERSION_H
00020 
00021 #include <lunchbox/api.h>
00022 #include <lunchbox/types.h>
00023 #include <string>
00024 
00025 namespace lunchbox
00026 {
00027     // LunchBox version macros and functions
00029 #   define LUNCHBOX_VERSION_MAJOR 1
00030 
00032 #   define LUNCHBOX_VERSION_MINOR 4
00033 
00035 #   define LUNCHBOX_VERSION_PATCH 0
00036 
00038 #   define LUNCHBOX_VERSION_ABI 1
00039 
00041 #   define LUNCHBOX_VERSION_GT( MAJOR, MINOR, PATCH )                   \
00042     ( (LUNCHBOX_VERSION_MAJOR>MAJOR) ||                                 \
00043       (LUNCHBOX_VERSION_MAJOR==MAJOR &&                                 \
00044        (LUNCHBOX_VERSION_MINOR>MINOR ||                                 \
00045         (LUNCHBOX_VERSION_MINOR==MINOR && LUNCHBOX_VERSION_PATCH>PATCH))))
00046 
00048 #   define LUNCHBOX_VERSION_GE( MAJOR, MINOR, PATCH )                         \
00049     ( (LUNCHBOX_VERSION_MAJOR>MAJOR) ||                                       \
00050       (LUNCHBOX_VERSION_MAJOR==MAJOR &&                                 \
00051        (LUNCHBOX_VERSION_MINOR>MINOR ||                                 \
00052         (LUNCHBOX_VERSION_MINOR==MINOR && LUNCHBOX_VERSION_PATCH>=PATCH))))
00053 
00055 #   define LUNCHBOX_VERSION_LT( MAJOR, MINOR, PATCH )                         \
00056     ( (LUNCHBOX_VERSION_MAJOR<MAJOR) ||                                       \
00057       (LUNCHBOX_VERSION_MAJOR==MAJOR &&                                 \
00058        (LUNCHBOX_VERSION_MINOR<MINOR ||                                 \
00059         (LUNCHBOX_VERSION_MINOR==MINOR && LUNCHBOX_VERSION_PATCH<PATCH))))
00060 
00062 #   define LUNCHBOX_VERSION_LE( MAJOR, MINOR, PATCH )                         \
00063     ( (LUNCHBOX_VERSION_MAJOR<MAJOR) ||                                       \
00064       (LUNCHBOX_VERSION_MAJOR==MAJOR &&                                 \
00065        (LUNCHBOX_VERSION_MINOR<MINOR ||                                 \
00066         (LUNCHBOX_VERSION_MINOR==MINOR && LUNCHBOX_VERSION_PATCH<=PATCH))))
00067 
00069     class LUNCHBOX_API Version
00070     {
00071     public:
00073         static uint32_t getMajor();
00074 
00076         static uint32_t getMinor();
00077 
00079         static uint32_t getPatch();
00080 
00082         static std::string getRevision();
00083 
00085         static uint32_t getABI();
00086 
00088         static uint32_t getInt();
00089 
00091         static float    getFloat();
00092 
00097         static std::string getString();
00098 
00103         static bool check()
00104         { return getMajor()==LUNCHBOX_VERSION_MAJOR && getMinor()==LUNCHBOX_VERSION_MINOR; }
00105     };
00106 }
00107 
00108 #endif //LUNCHBOX_VERSION_H