libatomprobe
Library for Atom Probe Tomography (APT) computation
version.h
Go to the documentation of this file.
1 /* version.h : version tracking information
2  * Copyright (C) 2020 Daniel Haley
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 
19 #ifndef LIBATOMPROBE_VERSION_H
20 #define LIBATOMPROBE_VERSION_H
21 
22 #include "stringFuncs.h"
23 
24 
25 #define LIBATOMPROBE_MAJOR 0
26 #define LIBATOMPROBE_MINOR 0
27 #define LIBATOMPROBE_REVISION 1
28 
29 #include <string>
30 #include <cstdlib>
31 #include <iostream>
32 
33 namespace AtomProbe
34 {
35 
38 {
39  bool isDebug;
40  public:
42  #ifdef DEBUG
43  std::cerr << "libatomprobe built with DEBUG enabled. This will be slow!" <<std::endl;
44  std::cerr << "Using libatomprobe " << LIBATOMPROBE_MAJOR << "." << LIBATOMPROBE_MINOR << "." << LIBATOMPROBE_REVISION << std::endl;
45  isDebug=true;
46  #else
47  isDebug=false;
48  #endif
49 
50  checkDebug();
51 
52  }
53 
54  void checkDebug();
55  static unsigned int getMajor() { return LIBATOMPROBE_MAJOR;}
56  static unsigned int getMinor() { return LIBATOMPROBE_MINOR;}
57  static unsigned int getRevision() { return LIBATOMPROBE_REVISION;}
58 
60  static std::string getVersionStr() {
61  std::string tmp1,tmp2;
62  stream_cast(tmp1,getMajor());
63  tmp1+=".";
64  stream_cast(tmp2,getMinor());
65  tmp1+=tmp2 +".";
66  stream_cast(tmp2,getRevision());
67  tmp1+=tmp2;
68  return tmp1;
69  };
70 
71 };
72 
73 }
74 
75 #endif
static unsigned int getMajor()
Definition: version.h:55
#define LIBATOMPROBE_REVISION
Definition: version.h:27
static unsigned int getMinor()
Definition: version.h:56
Class to hold the library version data.
Definition: version.h:37
#define LIBATOMPROBE_MINOR
Definition: version.h:26
static unsigned int getRevision()
Definition: version.h:57
bool stream_cast(T1 &result, const T2 &obj)
Template function to cast and object to another by the stringstream.
Definition: stringFuncs.h:32
#define LIBATOMPROBE_MAJOR
Definition: version.h:25
static std::string getVersionStr()
Obtain the version of the program as a string.
Definition: version.h:60