Line |
Branch |
Exec |
Source |
1 |
|
|
/////////////////////////////////////////////////////////////////////////////// |
2 |
|
|
// BSD 3-Clause License |
3 |
|
|
// |
4 |
|
|
// Copyright (C) 2019, LAAS-CNRS |
5 |
|
|
// Copyright note valid unless otherwise stated in individual files. |
6 |
|
|
// All rights reserved. |
7 |
|
|
/////////////////////////////////////////////////////////////////////////////// |
8 |
|
|
|
9 |
|
|
#ifndef CROCODDYL_CORE_UTILS_VERSION_HPP_ |
10 |
|
|
#define CROCODDYL_CORE_UTILS_VERSION_HPP_ |
11 |
|
|
|
12 |
|
|
#include <sstream> |
13 |
|
|
#include <string> |
14 |
|
|
|
15 |
|
|
#include "crocoddyl/config.hh" |
16 |
|
|
|
17 |
|
|
namespace crocoddyl { |
18 |
|
|
|
19 |
|
|
/// |
20 |
|
|
/// \brief Returns the current version of Crocoddyl as a string using |
21 |
|
|
/// the following standard: |
22 |
|
|
/// CROCODDYL_MINOR_VERSION.CROCODDYL_MINOR_VERSION.CROCODDYL_PATCH_VERSION |
23 |
|
|
/// |
24 |
|
✗ |
inline std::string printVersion(const std::string& delimiter = ".") { |
25 |
|
✗ |
std::ostringstream oss; |
26 |
|
✗ |
oss << CROCODDYL_MAJOR_VERSION << delimiter << CROCODDYL_MINOR_VERSION |
27 |
|
✗ |
<< delimiter << CROCODDYL_PATCH_VERSION; |
28 |
|
✗ |
return oss.str(); |
29 |
|
|
} |
30 |
|
|
|
31 |
|
|
/// |
32 |
|
|
/// \brief Checks if the current version of Crocoddyl is at least the version |
33 |
|
|
/// provided |
34 |
|
|
/// by the input arguments. |
35 |
|
|
/// |
36 |
|
|
/// \param[in] major_version Major version to check. |
37 |
|
|
/// \param[in] minor_version Minor version to check. |
38 |
|
|
/// \param[in] patch_version Patch version to check. |
39 |
|
|
/// |
40 |
|
|
/// \returns true if the current version of Pinocchio is greater than the |
41 |
|
|
/// version provided |
42 |
|
|
/// by the input arguments. |
43 |
|
|
/// |
44 |
|
|
inline bool checkVersionAtLeast(int major_version, int minor_version, |
45 |
|
|
int patch_version) { |
46 |
|
|
return CROCODDYL_MAJOR_VERSION > major_version || |
47 |
|
|
(CROCODDYL_MAJOR_VERSION >= major_version && |
48 |
|
|
(CROCODDYL_MINOR_VERSION > minor_version || |
49 |
|
|
(CROCODDYL_MINOR_VERSION >= minor_version && |
50 |
|
|
CROCODDYL_PATCH_VERSION >= patch_version))); |
51 |
|
|
} |
52 |
|
|
} // namespace crocoddyl |
53 |
|
|
|
54 |
|
|
#endif // CROCODDYL_CORE_UTILS_VERSION_HPP_ |
55 |
|
|
|