34 reader.connect(memoryNameSystem);
39 const std::string& provider,
41 const std::string& entityName)
43 std::string entityNameAdjusted = entityName;
47 ARMARX_INFO <<
"Setting entity name to " << entityNameAdjusted;
55 const std::string& providerName,
62 profile = this->reader.queryLatestProfileByName(
67 ARMARX_WARNING <<
"You are trying to commit preferences to a profile which cannot be "
68 "read (maybe it does not exist?)";
83 const std::string& providerName,
85 const std::string key,
86 const std::string value)
92 profile = this->reader.queryLatestProfileByName(
101 ARMARX_WARNING <<
"You are trying to commit preferences to a profile which cannot be "
102 "read (maybe it does not exist?)";
107 ARMARX_INFO <<
"Amount of custom attributes before: " << customAttributeCountBefore;
112 << personID.
lastName <<
" successfully";
117 << personID.
lastName <<
" successfully";
119 ARMARX_INFO <<
"Amount of custom attributes before commiting: "
131 const std::string& provider,
133 const std::string& entityName)
135 std::vector<armarx::aron::data::dto::DictPtr> humanProfilesDto;
136 for (
const Person& humanProfile : humanProfiles)
138 armarx::human::arondto::Person humanProfileAron;
139 toAron(humanProfileAron, humanProfile);
140 humanProfilesDto.push_back(humanProfileAron.toAronDTO());
143 core::time::dto::DateTime referencedTimeDto;
144 toIce(referencedTimeDto, referencedTime);
147 humanMemory->commitHumanProfiles(
148 humanProfilesDto, provider, referencedTimeDto, entityName);
160 const std::string& providerName,
162 const std::string& drink)
168 preferences = this->reader.queryPreferences(
173 ARMARX_WARNING <<
"You are trying to set preferred drinks on a profile which could not "
174 "be read (maybe it does not exist?)";
178 if (!preferences.
drink)
179 preferences.
drink.emplace();
182 preferences.
drink->preferred.erase(std::remove(preferences.
drink->preferred.begin(),
183 preferences.
drink->preferred.end(),
185 preferences.
drink->preferred.end());
189 preferences.
drink->preferred.insert(preferences.
drink->preferred.begin(), drink);
static Duration Hours(std::int64_t hours)
Constructs a duration in hours.
The memory name system (MNS) client.
armem::client::Writer & memoryWriter()
void connect(armarx::armem::client::MemoryNameSystem &mns)
void registerPropertyDefinitions(armarx::PropertyDefinitionsPtr &def)
void connect(armem::client::MemoryNameSystem &memoryNameSystem)
~ProfileWriter() override
bool commitHumanProfiles(const std::vector< Person > &humanProfiles, const std::string &provider, const armem::Time &referencedTime, const std::string &entityName)
bool commitPreferencesToProfile(const armarx::armem::human::PersonID &personID, const std::string &providerName, const armem::Time &referencedTime, const armarx::armem::human::Preferences preferences)
bool commitHumanProfile(const Person &humanProfile, const std::string &provider, const armem::Time &referencedTime, const std::string &entityName="")
bool setCustomAttributeInProfile(const armarx::armem::human::PersonID &personID, const std::string &providerName, const armem::Time &referencedTime, const std::string key, const std::string value)
bool setPreferredDrink(const armarx::armem::human::PersonID &personID, const std::string &providerName, const armem::Time &referencedTime, const std::string &drink)
Inserts the given drink at the first place of the given humans list of preferred drinks,...
void registerPropertyDefinitions(armarx::PropertyDefinitionsPtr &def)
Brief description of class memory.
#define ARMARX_INFO
The normal logging level.
#define ARMARX_DEBUG
The logging level for output that is only interesting while debugging.
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
#define ARMARX_VERBOSE
The logging level for verbose information.
void toAron(armarx::human::arondto::HumanPose &dto, const HumanPose &bo)
armarx::core::time::DateTime Time
void toIce(data::MemoryID &ice, const MemoryID &id)
std::string GetHandledExceptionString()
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
std::map< std::string, std::string > customAttributes
std::optional< Preference > drink