Thrill  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
version.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * foxxll/version.hpp
3  *
4  * Part of FOXXLL. See http://foxxll.org
5  *
6  * Copyright (C) 2007, 2011 Andreas Beckmann <[email protected]>
7  * Copyright (C) 2013 Timo Bingmann <[email protected]>
8  *
9  * Distributed under the Boost Software License, Version 1.0.
10  * (See accompanying file LICENSE_1_0.txt or copy at
11  * http://www.boost.org/LICENSE_1_0.txt)
12  **************************************************************************/
13 
14 #ifndef FOXXLL_VERSION_HEADER
15 #define FOXXLL_VERSION_HEADER
16 
17 #include <string>
18 
19 #include <tlx/die.hpp>
20 
21 #include <foxxll/config.hpp>
22 
23 namespace foxxll {
24 
25 // FOXXLL_VERSION_{MAJOR,MINOR,PATCH} are defined in cmake generated config.h
26 
27 // construct an integer version number, like "10400" for "1.4.0".
28 #define FOXXLL_VERSION_INTEGER (FOXXLL_VERSION_MAJOR * 10000 + FOXXLL_VERSION_MINOR * 100 + FOXXLL_VERSION_PATCH)
29 
30 #define stringify_(x) #x
31 #define stringify(x) stringify_(x)
32 
33 //! Return "X.Y.Z" version string (of headers)
35 {
36  return FOXXLL_VERSION_STRING;
37 }
38 
39 //! Return longer "X.Y.Z (feature) (version)" version string (of headers)
41 {
42  return "FOXXLL"
44 #ifdef FOXXLL_VERSION_PHASE
45  " (" FOXXLL_VERSION_PHASE ")"
46 #endif
47 #ifdef FOXXLL_VERSION_GIT_SHA1
48  " (git " FOXXLL_VERSION_GIT_SHA1 ")"
49 #endif // FOXXLL_VERSION_GIT_SHA1
50  ; // NOLINT
51 }
52 
53 #undef stringify
54 #undef stringify_
55 
56 //! return X if the FOXXLL library version is X.Y.Z
57 int version_major();
58 //! return Y if the FOXXLL library version is X.Y.Z
59 int version_minor();
60 //! return Z if the FOXXLL library version is X.Y.Z
61 int version_patch();
62 //! return integer version number of the FOXXLL library
63 int version_integer();
64 
65 //! returns "X.Y.Z" version string of library
67 
68 //! returns longer "X.Y.Z (feature) (version)" string of library
70 
71 //! Check for a mismatch between library and headers
73 {
75  return 1;
77  return 2;
79  return 3;
80  return 0;
81 }
82 
83 //! Check and print mismatch between header and library versions
85 {
87  {
88  die(
89  "version mismatch between headers"
90  " (" << FOXXLL_VERSION_STRING ") and library"
91  " (" << get_library_version_string() << ")"
92  );
93  }
94 }
95 
96 } // namespace foxxll
97 
98 #endif // !FOXXLL_VERSION_HEADER
99 
100 /**************************************************************************/
int version_minor()
return Y if the FOXXLL library version is X.Y.Z
Definition: version.cpp:25
#define die(msg)
Instead of std::terminate(), throw the output the message via an exception.
Definition: die.hpp:22
#define FOXXLL_VERSION_PHASE
Definition: config.hpp.in:25
int check_library_version()
Check for a mismatch between library and headers.
Definition: version.hpp:72
int version_patch()
return Z if the FOXXLL library version is X.Y.Z
Definition: version.cpp:30
#define FOXXLL_VERSION_MAJOR
Definition: config.hpp.in:21
std::string get_version_string()
Return "X.Y.Z" version string (of headers)
Definition: version.hpp:34
std::basic_string< char, std::char_traits< char >, Allocator< char > > string
string with Manager tracking
Definition: allocator.hpp:220
#define FOXXLL_VERSION_MINOR
Definition: config.hpp.in:22
int version_integer()
return integer version number of the FOXXLL library
Definition: version.cpp:35
void print_library_version_mismatch()
Check and print mismatch between header and library versions.
Definition: version.hpp:84
#define FOXXLL_VERSION_GIT_SHA1
Definition: config.hpp.in:29
#define FOXXLL_VERSION_STRING
Definition: config.hpp.in:24
std::string get_library_version_string()
returns "X.Y.Z" version string of library
Definition: version.cpp:40
#define FOXXLL_VERSION_PATCH
Definition: config.hpp.in:23
std::string get_library_version_string_long()
returns longer "X.Y.Z (feature) (version)" string of library
Definition: version.cpp:45
int version_major()
return X if the FOXXLL library version is X.Y.Z
Definition: version.cpp:20
std::string get_version_string_long()
Return longer "X.Y.Z (feature) (version)" version string (of headers)
Definition: version.hpp:40