Finder.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <filesystem>
4 
7 
9 
11 
13 {
14  /**
15  * @brief Used to find human profiles in the Prior Knowledge Data repository [1].
16  *
17  * @see [1] https://gitlab.com/ArmarX/PriorKnowledgeData
18  */
19  class Finder : Logging
20  {
21  public:
22  using path = std::filesystem::path;
24 
25  inline static const std::string DefaultPackageName = "PriorKnowledgeData";
26  inline static const std::string DefaultRelativeDirectory = "humans/profiles";
27 
28 
29  public:
30  Finder(const std::string& packageName = DefaultPackageName,
31  const path& relativeDirectory = DefaultRelativeDirectory);
32 
33  void setPath(const std::string& path);
34 
35  std::string getPackageName() const;
36 
37  std::optional<Info> find(const std::string& name) const;
38  std::vector<Info> findAll(bool checkPaths = true) const;
39 
40 
41  private:
42  void init() const;
43  bool isDatasetDirValid(const std::filesystem::path& path) const;
44 
45  path _rootDirAbs() const;
46  path _rootDirRel() const;
47 
48  bool _ready() const;
49 
50 
51  private:
52  /// Name of package containing the object models (ArmarXObjects by default).
53  mutable std::string packageName;
54 
55  /**
56  * @brief Absolute path to data directory (e.g. "/.../repos/ArmarXObjects/data").
57  * Empty if package could not be found.
58  */
59  mutable path absPackageDataDir;
60 
61  /// Path to the directory containing objects in the package's data directory.
62  path relativeDirectory;
63  };
64 } // namespace armarx::armem::server::human::profile
armarx::armem::server::human::profile::Finder::getPackageName
std::string getPackageName() const
Definition: Finder.cpp:31
armarx::armem::server::human::profile::Finder::find
std::optional< Info > find(const std::string &name) const
Definition: Finder.cpp:71
Info.h
armarx::armem::server::human::profile::Finder
Used to find human profiles in the Prior Knowledge Data repository [1].
Definition: Finder.h:19
armarx::armem::server::human::profile::Finder::DefaultRelativeDirectory
static const std::string DefaultRelativeDirectory
Definition: Finder.h:26
armarx::armem::server::human::profile::Finder::path
std::filesystem::path path
Definition: Finder.h:22
armarx::armem::server::human::profile
Definition: Finder.cpp:13
types.h
armarx::armem::server::human::profile::Finder::Finder
Finder(const std::string &packageName=DefaultPackageName, const path &relativeDirectory=DefaultRelativeDirectory)
Definition: Finder.cpp:17
armarx::armem::server::human::profile::Finder::findAll
std::vector< Info > findAll(bool checkPaths=true) const
Definition: Finder.cpp:87
armarx::Logging
Base Class for all Logging classes.
Definition: Logging.h:232
armarx::armem::server::human::profile::Finder::setPath
void setPath(const std::string &path)
Definition: Finder.cpp:24
Logging.h
armarx::armem::server::human::profile::Finder::DefaultPackageName
static const std::string DefaultPackageName
Definition: Finder.h:25
armarx::armem::human::Info
Accessor for human profile files.
Definition: Info.h:20
PackagePath.h