Prediction.cpp
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  * @package RobotAPI::armem::client
17  * @author phesch ( ulila at student dot kit dot edu )
18  * @date 2022
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #include "Prediction.h"
24 
26 
28 
29 namespace armarx::armem
30 {
31  PredictionEngine
32  PredictionEngine::fromIce(const armem::prediction::data::PredictionEngine& ice)
33  {
34  return armarx::fromIce<PredictionEngine>(ice);
35  }
36 
37  armem::prediction::data::PredictionEngine
39  {
40  return armarx::toIce<armem::prediction::data::PredictionEngine>(*this);
41  }
42 
44  PredictionSettings::fromIce(const armem::prediction::data::PredictionSettings& ice)
45  {
46  return armarx::fromIce<PredictionSettings>(ice);
47  }
48 
49  armem::prediction::data::PredictionSettings
51  {
52  return armarx::toIce<armem::prediction::data::PredictionSettings>(*this);
53  }
54 
56  PredictionRequest::fromIce(const armem::prediction::data::PredictionRequest& ice)
57  {
58  return armarx::fromIce<PredictionRequest>(ice);
59  }
60 
61  armem::prediction::data::PredictionRequest
63  {
64  return armarx::toIce<armem::prediction::data::PredictionRequest>(*this);
65  }
66 
68  PredictionResult::fromIce(const armem::prediction::data::PredictionResult& ice)
69  {
70  return armarx::fromIce<PredictionResult>(ice);
71  }
72 
73  armem::prediction::data::PredictionResult
75  {
76  return armarx::toIce<armem::prediction::data::PredictionResult>(*this);
77  }
78 
79  void
80  toIce(armem::prediction::data::PredictionEngine& ice, const PredictionEngine& engine)
81  {
82  ice.engineID = engine.engineID;
83  }
84 
85  void
86  fromIce(const armem::prediction::data::PredictionEngine& ice, PredictionEngine& engine)
87  {
88  engine.engineID = ice.engineID;
89  }
90 
91  void
92  toIce(armem::prediction::data::PredictionSettings& ice, const PredictionSettings& settings)
93  {
94  ice.predictionEngineID = settings.predictionEngineID;
95  }
96 
97  void
98  fromIce(const armem::prediction::data::PredictionSettings& ice, PredictionSettings& settings)
99  {
100  settings.predictionEngineID = ice.predictionEngineID;
101  }
102 
103  void
104  toIce(armem::prediction::data::PredictionRequest& ice, const PredictionRequest& request)
105  {
106  toIce(ice.snapshotID, request.snapshotID);
107  toIce(ice.settings, request.predictionSettings);
108  }
109 
110  void
111  fromIce(const armem::prediction::data::PredictionRequest& ice, PredictionRequest& request)
112  {
113  fromIce(ice.snapshotID, request.snapshotID);
114  fromIce(ice.settings, request.predictionSettings);
115  }
116 
117  void
118  toIce(armem::prediction::data::PredictionResult& ice, const PredictionResult& result)
119  {
120  ice.success = result.success;
121  ice.errorMessage = result.errorMessage;
122  toIce(ice.snapshotID, result.snapshotID);
123  if (result.prediction)
124  {
125  ice.prediction = result.prediction->toAronDictDTO();
126  }
127  else
128  {
129  ice.prediction = nullptr;
130  }
131  }
132 
133  void
134  fromIce(const armem::prediction::data::PredictionResult& ice, PredictionResult& result)
135  {
136  result.success = ice.success;
137  result.errorMessage = ice.errorMessage;
138  fromIce(ice.snapshotID, result.snapshotID);
139  result.prediction = aron::data::Dict::FromAronDictDTO(ice.prediction);
140  }
141 
142 } // namespace armarx::armem
armarx::armem::PredictionRequest
Definition: Prediction.h:49
armarx::armem::PredictionResult::snapshotID
armem::MemoryID snapshotID
Definition: Prediction.h:63
armarx::armem::PredictionEngine::engineID
std::string engineID
Definition: Prediction.h:35
armarx::armem::PredictionSettings
Definition: Prediction.h:41
armarx::armem::PredictionRequest::predictionSettings
PredictionSettings predictionSettings
Definition: Prediction.h:52
Prediction.h
armarx::armem
Definition: LegacyRobotStateMemoryAdapter.cpp:31
armarx::armem::toIce
void toIce(data::MemoryID &ice, const MemoryID &id)
Definition: ice_conversions.cpp:21
armarx::armem::PredictionResult
Definition: Prediction.h:58
armarx::armem::PredictionSettings::toIce
armem::prediction::data::PredictionSettings toIce() const
Definition: Prediction.cpp:50
armarx::aron::data::Dict::FromAronDictDTO
static PointerType FromAronDictDTO(const data::dto::DictPtr &aron)
Definition: Dict.cpp:129
armarx::armem::PredictionEngine::toIce
armem::prediction::data::PredictionEngine toIce() const
Definition: Prediction.cpp:38
armarx::armem::PredictionResult::fromIce
static PredictionResult fromIce(const armem::prediction::data::PredictionResult &ice)
Definition: Prediction.cpp:68
armarx::armem::PredictionResult::prediction
aron::data::DictPtr prediction
Definition: Prediction.h:64
ice_conversions.h
armarx::armem::PredictionResult::toIce
armem::prediction::data::PredictionResult toIce() const
Definition: Prediction.cpp:74
armarx::armem::PredictionRequest::fromIce
static PredictionRequest fromIce(const armem::prediction::data::PredictionRequest &ice)
Definition: Prediction.cpp:56
armarx::armem::fromIce
void fromIce(const data::MemoryID &ice, MemoryID &id)
Definition: ice_conversions.cpp:31
armarx::armem::PredictionEngine
Definition: Prediction.h:33
armarx::armem::PredictionSettings::fromIce
static PredictionSettings fromIce(const armem::prediction::data::PredictionSettings &ice)
Definition: Prediction.cpp:44
armarx::armem::PredictionResult::errorMessage
std::string errorMessage
Definition: Prediction.h:61
armarx::armem::PredictionEngine::fromIce
static PredictionEngine fromIce(const armem::prediction::data::PredictionEngine &ice)
Definition: Prediction.cpp:32
ice_conversions_templates.h
armarx::armem::PredictionRequest::toIce
armem::prediction::data::PredictionRequest toIce() const
Definition: Prediction.cpp:62
armarx::armem::PredictionResult::success
bool success
Definition: Prediction.h:60
armarx::armem::PredictionRequest::snapshotID
armem::MemoryID snapshotID
Definition: Prediction.h:51
armarx::armem::PredictionSettings::predictionEngineID
std::string predictionEngineID
Definition: Prediction.h:43