CMakePackageFinderCache.cpp
Go to the documentation of this file.
2 
3 namespace armarx
4 {
5  CMakePackageFinderCache CMakePackageFinderCache::GlobalCache;
6 
8  packageFinders(s.packageFinders), timeout(s.timeout)
9  {
10  }
11 
13  {
14  }
15 
16  const CMakePackageFinder&
17  CMakePackageFinderCache::findPackage(const std::string& packageName,
18  const std::filesystem::path& packagePath,
19  bool suppressStdErr,
20  bool usePackagePathOnlyAsHint)
21  {
22  std::unique_lock lock(mutex);
23  auto it = packageFinders.find(packageName);
24  if (it != packageFinders.end())
25  {
26  if ((IceUtil::Time::now() - it->second.first) > timeout)
27  {
28  it->second.second = CMakePackageFinder(
29  packageName, packagePath, suppressStdErr, usePackagePathOnlyAsHint);
30  it->second.first = IceUtil::Time::now();
31  }
32  return it->second.second;
33  }
34  else
35  {
36  auto insertion = packageFinders.insert(std::make_pair(
37  packageName,
38  std::make_pair(IceUtil::Time::now(), CMakePackageFinder(packageName))));
39  return insertion.first->second.second;
40  }
41  }
42 } // namespace armarx
armarx::CMakePackageFinderCache
Definition: CMakePackageFinderCache.h:14
armarx::CMakePackageFinderCache::findPackage
const CMakePackageFinder & findPackage(const std::string &packageName, const std::filesystem::path &packagePath="", bool suppressStdErr=false, bool usePackagePathOnlyAsHint=false)
Definition: CMakePackageFinderCache.cpp:17
armarx::CMakePackageFinder
The CMakePackageFinder class provides an interface to the CMake Package finder capabilities.
Definition: CMakePackageFinder.h:52
armarx::CMakePackageFinderCache::CMakePackageFinderCache
CMakePackageFinderCache(const CMakePackageFinderCache &s)
Definition: CMakePackageFinderCache.cpp:7
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
CMakePackageFinderCache.h
armarx::CMakePackageFinderCache::GlobalCache
static CMakePackageFinderCache GlobalCache
Definition: CMakePackageFinderCache.h:23
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27