HumanProfileReader.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @author Joana Plewnia
17 * @date 2025
18 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19 * GNU General Public License
20 */
21
22#pragma once
23
26
28
30{
31
33 {
34 public:
36 ~ProfileReader() override;
37
38 struct Query
39 {
40 // if empty, will query all providers
41 std::string providerName;
43
45 };
46
47 struct Result
48 {
49 std::vector<armarx::armem::human::Person> humanProfiles{};
50
57
58 std::string errorMessage = "";
59
60 operator bool() const noexcept
61 {
62 return status != Status::Error;
63 }
64 };
65
66 Result query(const Query& query, bool latest) const;
67
69 queryPreferences(const std::string& firstName,
70 const std::string& lastName,
71 const Duration& maxAge,
72 const std::string& providerName = "All Profiles");
73
75 queryLatestProfileByName(const std::string& firstName,
76 const std::string& lastName,
77 const std::string& providerName = "All Profiles");
78
79 /**
80 * Returns a list of a humans preferred drinks.
81 *
82 * @param firstName first name of the human
83 * @param lastName last name of the human
84 * @param providerName name of the profile provider
85 * @return a list of strings where each string describes a drink (e.g. 'orange juice').
86 * By convention, the first entry in the list can be used as the most favorite drink.
87 */
88 std::vector<std::string>
89 getPreferredDrinks(const std::string& firstName,
90 const std::string& lastName,
91 const std::string& providerName = "All Profiles");
92
93
94 protected:
96
98
99 std::vector<armarx::armem::human::Person>
100 asPersonProfiles(const wm::ProviderSegment& providerSegment,
101 const DateTime& timestamp,
102 const Duration& maxAge) const;
103
104 std::string propertyPrefix() const override;
105 Properties defaultProperties() const override;
106 };
107
108} // namespace armarx::armem::human::client
std::string timestamp()
The query::Builder class provides a fluent-style specification of hierarchical queries.
Definition Builder.h:22
std::vector< armarx::armem::human::Person > asPersonProfiles(const wm::ProviderSegment &providerSegment, const DateTime &timestamp, const Duration &maxAge) const
armarx::armem::human::Person queryLatestProfileByName(const std::string &firstName, const std::string &lastName, const std::string &providerName="All Profiles")
armarx::armem::human::Preferences queryPreferences(const std::string &firstName, const std::string &lastName, const Duration &maxAge, const std::string &providerName="All Profiles")
::armarx::armem::client::query::Builder buildQuery(const Query &query) const
::armarx::armem::client::query::Builder buildLatestQuery(const Query &query) const
std::vector< std::string > getPreferredDrinks(const std::string &firstName, const std::string &lastName, const std::string &providerName="All Profiles")
Returns a list of a humans preferred drinks.
Represents a point in time.
Definition DateTime.h:25
armarx::core::time::DateTime Time
armarx::core::time::Duration Duration
std::vector< armarx::armem::human::Person > humanProfiles
enum armarx::armem::human::client::ProfileReader::Result::Status status