1 |
|
|
// |
2 |
|
|
// Copyright (c) 2018 CNRS |
3 |
|
|
// |
4 |
|
|
|
5 |
|
|
#ifndef __pinocchio_utils_version_hpp__ |
6 |
|
|
#define __pinocchio_utils_version_hpp__ |
7 |
|
|
|
8 |
|
|
#include "pinocchio/config.hpp" |
9 |
|
|
|
10 |
|
|
#include <string> |
11 |
|
|
#include <sstream> |
12 |
|
|
|
13 |
|
|
namespace pinocchio |
14 |
|
|
{ |
15 |
|
|
|
16 |
|
|
/// |
17 |
|
|
/// \brief Returns the current version of Pinocchio as a string using |
18 |
|
|
/// the following standard: |
19 |
|
|
/// PINOCCHIO_MINOR_VERSION.PINOCCHIO_MINOR_VERSION.PINOCCHIO_PATCH_VERSION |
20 |
|
|
/// |
21 |
|
20 |
inline std::string printVersion(const std::string & delimiter = ".") |
22 |
|
|
{ |
23 |
✓✗ |
40 |
std::ostringstream oss; |
24 |
|
|
oss |
25 |
✓✗✓✗
|
20 |
<< PINOCCHIO_MAJOR_VERSION << delimiter |
26 |
✓✗✓✗
|
20 |
<< PINOCCHIO_MINOR_VERSION << delimiter |
27 |
✓✗ |
20 |
<< PINOCCHIO_PATCH_VERSION; |
28 |
✓✗ |
40 |
return oss.str(); |
29 |
|
|
} |
30 |
|
|
|
31 |
|
|
/// |
32 |
|
|
/// \brief Checks if the current version of Pinocchio is at least the version provided |
33 |
|
|
/// by the input arguments. |
34 |
|
|
/// |
35 |
|
|
/// \param[in] major_version Major version to check. |
36 |
|
|
/// \param[in] minor_version Minor version to check. |
37 |
|
|
/// \param[in] patch_version Patch version to check. |
38 |
|
|
/// |
39 |
|
|
/// \returns true if the current version of Pinocchio is greater than the version provided |
40 |
|
|
/// by the input arguments. |
41 |
|
|
/// |
42 |
|
4 |
inline bool checkVersionAtLeast(unsigned int major_version, |
43 |
|
|
unsigned int minor_version, |
44 |
|
|
unsigned int patch_version) |
45 |
|
|
{ |
46 |
|
|
return |
47 |
|
|
PINOCCHIO_MAJOR_VERSION > major_version |
48 |
✓✓✓✓
|
6 |
|| (PINOCCHIO_MAJOR_VERSION >= major_version |
49 |
✓✗ |
2 |
&& (PINOCCHIO_MINOR_VERSION > minor_version |
50 |
✓✗ |
2 |
|| (PINOCCHIO_MINOR_VERSION >= minor_version |
51 |
✓✓ |
6 |
&& PINOCCHIO_PATCH_VERSION >= patch_version))); |
52 |
|
|
} |
53 |
|
|
} |
54 |
|
|
|
55 |
|
|
#endif // __pinocchio_utils_version_hpp__ |