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 */
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
Accessor for human profile files.
Definition Info.h:20
armarx::armem::human::Info Info
Definition Finder.h:23
static const std::string DefaultPackageName
Definition Finder.h:25
Finder(const std::string &packageName=DefaultPackageName, const path &relativeDirectory=DefaultRelativeDirectory)
Definition Finder.cpp:17
void setPath(const std::string &path)
Definition Finder.cpp:24
static const std::string DefaultRelativeDirectory
Definition Finder.h:26
std::optional< Info > find(const std::string &name) const
Definition Finder.cpp:71
std::vector< Info > findAll(bool checkPaths=true) const
Definition Finder.cpp:87