crocoddyl  1.6.0
Contact RObot COntrol by Differential DYnamic programming Library (Crocoddyl)
version.hpp
1 // 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.
8 
9 #ifndef CROCODDYL_CORE_UTILS_VERSION_HPP_
10 #define CROCODDYL_CORE_UTILS_VERSION_HPP_
11 
12 #include <string>
13 #include <sstream>
14 
15 #include "crocoddyl/config.hh"
16 
17 namespace crocoddyl {
18 
24 inline std::string printVersion(const std::string& delimiter = ".") {
25  std::ostringstream oss;
26  oss << CROCODDYL_MAJOR_VERSION << delimiter << CROCODDYL_MINOR_VERSION << delimiter << CROCODDYL_PATCH_VERSION;
27  return oss.str();
28 }
29 
41 inline bool checkVersionAtLeast(int major_version, int minor_version, int patch_version) {
42  return CROCODDYL_MAJOR_VERSION > major_version ||
43  (CROCODDYL_MAJOR_VERSION >= major_version &&
44  (CROCODDYL_MINOR_VERSION > minor_version ||
45  (CROCODDYL_MINOR_VERSION >= minor_version && CROCODDYL_PATCH_VERSION >= patch_version)));
46 }
47 } // namespace crocoddyl
48 
49 #endif // CROCODDYL_CORE_UTILS_VERSION_HPP_