Skip to content
Snippets Groups Projects
Commit 60d248e5 authored by Philip Scherer's avatar Philip Scherer
Browse files

Make PredictionResult error messages into strings

Turns out std::stringstreams can't be copied, so you can't use them in
containers.
parent ea64a429
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@
# ArmarX.ApplicationName = ""
# ArmarX.CachePath: Path for cache files. If relative path AND env. variable ARMARX_USER_CONFIG_DIR is set, the cache path will be made relative to ARMARX_USER_CONFIG_DIR. Otherwise if relative it will be relative to the default ArmarX config dir (${HOME}/.armarx)
# ArmarX.CachePath: Path for cache files. If relative path AND env. variable ARMARX_CONFIG_DIR is set, the cache path will be made relative to ARMARX_CONFIG_DIR. Otherwise if relative it will be relative to the default ArmarX config dir (${ARMARX_WORKSPACE}/armarx_config)
# Attributes:
# - Default: mongo/.cache
# - Case sensitivity: yes
......@@ -109,6 +109,14 @@
# ArmarX.RemoteHandlesDeletionTimeout = 3000
# ArmarX.RobotToArViz.ArVizStorageName: Name of the ArViz storage
# Attributes:
# - Default: ArVizStorage
# - Case sensitivity: yes
# - Required: no
# ArmarX.RobotToArViz.ArVizStorageName = ArVizStorage
# ArmarX.RobotToArViz.ArVizTopicName: Name of the ArViz topic
# Attributes:
# - Default: ArVizTopic
......
......@@ -217,7 +217,7 @@ namespace armarx
ExampleMemory::predict(const armem::prediction::data::PredictionRequestSeq& requests)
{
armem::prediction::data::PredictionResultSeq result;
for (auto request : requests)
for (const auto& request : requests)
{
result.push_back(predictSingle(request));
}
......@@ -253,20 +253,22 @@ namespace armarx
else
{
result.success = false;
result.errorMessage <<
"Could not find entity referenced by MemoryID " << boID;
result.errorMessage =
"Could not find entity referenced by MemoryID '" + boID.str() + "'.";
}
}
else
{
result.success = false;
result.errorMessage << "Could not find entity referenced by MemoryID " << boID;
result.errorMessage =
"Could not find entity referenced by MemoryID '" + boID.str() + "'.";
}
}
else
{
result.success = false;
result.errorMessage << "This memory does not support the prediction engine \"" << engine << "\"";
result.errorMessage =
"This memory does not support the prediction engine '" + engine + "'.";
}
return result.toIce();
......
......@@ -248,7 +248,7 @@ namespace armarx::armem::server::obj
objpose::ObjectPosePredictionResult objPoseResult =
predictObjectPoses({objPoseRequest}).at(0);
result.success = objPoseResult.success;
result.errorMessage.str(objPoseResult.errorMessage);
result.errorMessage = objPoseResult.errorMessage;
if (objPoseResult.success)
{
......
......@@ -118,7 +118,7 @@ namespace armarx::armem::client
toIce(armem::prediction::data::PredictionResult& ice, const PredictionResult& result)
{
ice.success = result.success;
ice.errorMessage = result.errorMessage.str();
ice.errorMessage = result.errorMessage;
toIce(ice.snapshotID, result.snapshotID);
ice.prediction = result.prediction->toAronDictDTO();
}
......@@ -127,7 +127,7 @@ namespace armarx::armem::client
fromIce(const armem::prediction::data::PredictionResult& ice, PredictionResult& result)
{
result.success = ice.success;
result.errorMessage.str(ice.errorMessage);
result.errorMessage = ice.errorMessage;
fromIce(ice.snapshotID, result.snapshotID);
result.prediction = aron::data::Dict::FromAronDictDTO(ice.prediction);
}
......
......@@ -57,7 +57,7 @@ namespace armarx::armem::client
struct PredictionResult
{
bool success;
std::stringstream errorMessage;
std::string errorMessage;
armem::MemoryID snapshotID;
aron::data::DictPtr prediction;
......
......@@ -127,7 +127,7 @@ namespace armarx::armem::server::plugins
{
armem::client::PredictionResult singleResult;
singleResult.success = false;
singleResult.errorMessage << "This memory does not implement predictions.";
singleResult.errorMessage = "This memory does not implement predictions.";
singleResult.prediction = nullptr;
result.push_back(singleResult.toIce());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment