CMakePackageFinderCache.cpp
Go to the documentation of this file.
2 
3 namespace armarx
4 {
5  CMakePackageFinderCache CMakePackageFinderCache::GlobalCache;
6 
8  packageFinders(s.packageFinders),
9  timeout(s.timeout)
10  {
11 
12  }
13 
15  timeout(timeout)
16  {
17 
18  }
19 
20  const CMakePackageFinder& CMakePackageFinderCache::findPackage(const std::string& packageName, const std::filesystem::path& packagePath, bool suppressStdErr, 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(packageName, packagePath, suppressStdErr, usePackagePathOnlyAsHint);
29  it->second.first = IceUtil::Time::now();
30  }
31  return it->second.second;
32  }
33  else
34  {
35  auto insertion = packageFinders.insert(std::make_pair(packageName, std::make_pair(IceUtil::Time::now(), CMakePackageFinder(packageName))));
36  return insertion.first->second.second;
37  }
38  }
39 }
armarx::CMakePackageFinderCache
Definition: CMakePackageFinderCache.h:13
armarx::CMakePackageFinderCache::findPackage
const CMakePackageFinder & findPackage(const std::string &packageName, const std::filesystem::path &packagePath="", bool suppressStdErr=false, bool usePackagePathOnlyAsHint=false)
Definition: CMakePackageFinderCache.cpp:20
armarx::CMakePackageFinder
The CMakePackageFinder class provides an interface to the CMake Package finder capabilities.
Definition: CMakePackageFinder.h:53
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:19
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:28