ice_conversions_boost_templates.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <map>
4 
5 #include <boost/container/flat_map.hpp>
6 
7 
8 namespace armarx::armem
9 {
10  // std::map <-> boost::container::flat_map
11 
12  template <class IceKeyT, class IceValueT, class CppKeyT, class CppValueT>
13  void toIce(std::map<IceKeyT, IceValueT>& iceMap,
14  const boost::container::flat_map<CppKeyT, CppValueT>& cppMap)
15  {
16  iceMap.clear();
17  for (const auto& [key, value] : cppMap)
18  {
19  iceMap.emplace(toIce<IceKeyT>(key), toIce<IceValueT>(value));
20  }
21  }
22 
23  template <class IceKeyT, class IceValueT, class CppKeyT, class CppValueT>
24  void fromIce(const std::map<IceKeyT, IceValueT>& iceMap,
25  boost::container::flat_map<CppKeyT, CppValueT>& cppMap)
26  {
27  cppMap.clear();
28  for (const auto& [key, value] : iceMap)
29  {
30  cppMap.emplace(fromIce<CppKeyT>(key), fromIce<CppValueT>(value));
31  }
32  }
33 
34 }
armarx::armem
Definition: LegacyRobotStateMemoryAdapter.cpp:31
armarx::armem::toIce
void toIce(data::MemoryID &ice, const MemoryID &id)
Definition: ice_conversions.cpp:21
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
armarx::armem::fromIce
void fromIce(const data::MemoryID &ice, MemoryID &id)
Definition: ice_conversions.cpp:31