-
Notifications
You must be signed in to change notification settings - Fork 1
/
lbp_constants.h.in
99 lines (75 loc) · 3.27 KB
/
lbp_constants.h.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/**
\file lbp_constants.h
\details File contain main constans for whole Queetech LBP libary.
\author Petr Neduchal
\date 2013
*/
/* ========================================================================= */
#ifndef __lbp_constants_h
#define __lbp_constants_h
#include <iostream>
#include <cmath>
#include <string>
/* ========================================================================= */
#define CHECK_VERSION_SIMPLE 0
#define CHECK_VERSION_COMPLETE 1
using namespace std;
/* ========================================================================= */
namespace queetech
{
/* ========================================================================= */
namespace lbplib
{
const char* PROJECT_NAME = "Queetech LBP Library";
// version Queetech LBP libary
class Version
{
public :
/* ------------------------------------------------------------------- */
static const int MAJOR = @QUEETECH_LbpLibrary_VERSION_MAJOR@ ;
static const int MINOR = @QUEETECH_LbpLibrary_VERSION_MINOR@ ;
static const int PATCH = @QUEETECH_LbpLibrary_VERSION_PATCH@ ;
Version() {}
~Version() {}
/* ------------------------------------------------------------------- */
/**
* \fn check(int req_major, int req_minor, int req_patch, char option)
*
* \brief Function checks the version of LbpLibrary.
* \param req_major - Major version of library X.*.*
* \param req_minor - Minor version of library *.X.*
* \param req_patch - Patch version of library *.*.X
* \param option - CHECK_VERSION_SIMPLE | CHECK_VERSION_COMPLETE
* \return 0 or 1 for CHECK_VERSION_SIMPLE and
for CHECK_VERSION_Complete :
0 - required version is correct.
1 - required version is higher than using version.
-1 - required version is lower than usung version.
*/
static int check(int req_major, int req_minor, int req_patch, char option)
{
switch(option)
{
case 0 : return ((req_major == Version::MAJOR)&&
(req_minor == Version::MINOR)&&
(req_patch == Version::PATCH));
case 1 : int ver = Version::MAJOR * 10000 +
Version::MINOR * 100 +
Version::PATCH;
int req_ver = req_major * 10000 +
req_minor * 100 +
req_patch;
if((req_ver - ver) == 0) return 0;
else return
(int)((req_ver-ver)*abs(1.0/(double)(ver-req_ver)));
}
return 0;
}
/* ------------------------------------------------------------------- */
};
};
/* ========================================================================= */
};
/* ========================================================================= */
#endif
/* ========================================================================= */