Query.cpp
Go to the documentation of this file.
1 #include "Query.h"
2 
5 
7 
8 
9 namespace armarx::armem::client
10 {
11  using armarx::fromIce;
12  using armarx::toIce;
13 
14 
15  QueryInput QueryInput::fromIce(const armem::query::data::Input& ice)
16  {
17  return armarx::fromIce<QueryInput>(ice);
18  }
19 
20  armem::query::data::Input QueryInput::toIce() const
21  {
22  return armarx::toIce<armem::query::data::Input>(*this);
23  }
24 
25  QueryResult QueryResult::fromIce(const armem::query::data::Result& ice)
26  {
27  return armarx::fromIce<QueryResult>(ice);
28  }
29 
30  armem::query::data::Result QueryResult::toIce() const
31  {
32  return armarx::toIce<armem::query::data::Result>(*this);
33  }
34 
35  std::ostream& operator<<(std::ostream& os, const QueryResult& rhs)
36  {
37  return os << "Query result: "
38  << "\n- success: \t" << rhs.success
39  << "\n- error message: \t" << rhs.errorMessage
40  ;
41  }
42 }
43 
44 
45 namespace armarx::armem
46 {
47  void client::toIce(armem::query::data::Input& ice, const QueryInput& input)
48  {
49  ice.memoryQueries = input.memoryQueries;
50  toIce(ice.withData, (input.dataMode == armem::query::DataMode::WithData));
51  }
52 
53  void client::fromIce(const armem::query::data::Input& ice, QueryInput& input)
54  {
55  input.memoryQueries = ice.memoryQueries;
57  }
58 
59  void client::toIce(armem::query::data::Result& ice, const QueryResult& result)
60  {
61  toIce(ice, dynamic_cast<const detail::SuccessHeader&>(result));
62  toIce(ice.memory, result.memory);
63  }
64 
65  void client::fromIce(const armem::query::data::Result& ice, QueryResult& result)
66  {
67  fromIce(ice, dynamic_cast<detail::SuccessHeader&>(result));
68  fromIce(ice.memory, result.memory);
69  }
70 
71 }
armarx::armem::client::fromIce
void fromIce(const armem::query::data::Input &ice, QueryInput &input)
Definition: Query.cpp:53
armarx::armem::detail::SuccessHeader::success
bool success
Definition: SuccessHeader.h:20
armarx::armem::client::QueryResult::memory
wm::Memory memory
The slice of the memory that matched the query.
Definition: Query.h:58
armarx::armem::query::DataMode::WithData
@ WithData
Get structure and ARON data.
armarx::armem
Definition: LegacyRobotStateMemoryAdapter.cpp:31
armarx::armem::toIce
void toIce(data::MemoryID &ice, const MemoryID &id)
Definition: ice_conversions.cpp:21
armarx::armem::client
This file is part of ArmarX.
Definition: forward_declarations.h:7
armarx::armem::client::QueryResult
Result of a QueryInput.
Definition: Query.h:50
Query.h
armarx::armem::client::QueryInput::fromIce
static QueryInput fromIce(const armem::query::data::Input &ice)
Definition: Query.cpp:15
armarx::toIce
void toIce(std::map< IceKeyT, IceValueT > &iceMap, const boost::container::flat_map< CppKeyT, CppValueT > &cppMap)
Definition: ice_conversions_boost_templates.h:15
armarx::armem::detail::SuccessHeader::errorMessage
std::string errorMessage
Definition: SuccessHeader.h:21
armarx::armem::client::operator<<
std::ostream & operator<<(std::ostream &os, const QueryResult &rhs)
Definition: Query.cpp:35
armarx::armem::client::QueryInput
A query for parts of a memory.
Definition: Query.h:23
armarx::aron::input
ReaderT::InputType & input
Definition: rw.h:19
armarx::armem::detail::SuccessHeader
Definition: SuccessHeader.h:13
armarx::armem::fromIce
void fromIce(const data::MemoryID &ice, MemoryID &id)
Definition: ice_conversions.cpp:31
armarx::fromIce
void fromIce(const std::map< IceKeyT, IceValueT > &iceMap, boost::container::flat_map< CppKeyT, CppValueT > &cppMap)
Definition: ice_conversions_boost_templates.h:26
armarx::armem::client::QueryResult::toIce
armem::query::data::Result toIce() const
Definition: Query.cpp:30
armarx::armem::query::DataMode::NoData
@ NoData
Just get the structure, but no ARON data.
ice_conversions_templates.h
armarx::armem::client::QueryResult::fromIce
static QueryResult fromIce(const armem::query::data::Result &ice)
Definition: Query.cpp:25
armarx::armem::client::QueryInput::toIce
armem::query::data::Input toIce() const
Definition: Query.cpp:20
armarx::armem::client::toIce
void toIce(armem::query::data::Input &ice, const QueryInput &input)
Definition: Query.cpp:47
ice_conversions.h
ice_conversions.h