GetValue.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <SimoxUtility/meta/enum/adapt_enum.h>
4 
5 #include "../Storage.h"
6 
7 #include "Common.h"
8 
9 namespace armarx::RemoteGui
10 {
11  template<class T>
12  std::enable_if_t<meta::cfg::gui_definition_enabled_v<T>, void>
15  std::string const& name)
16  {
18  namespace hana = boost::hana;
19  static constexpr auto accessors = hana::accessors<T>();
20  hana::for_each(accessors, [&](auto & e)
21  {
23  using elem_det = decltype(armarx::meta::cfg::to_element_detail(e));
24  if constexpr(!elem_det::no_remote_gui)
25  {
26  const auto varname = hana::to<char const*>(hana::first(e));
27  const auto& id = armarx::meta::cfg::ConcatID(name, varname);
28  auto& elem = hana::second(e)(cfg);
30  getValueFromMap(elem, values, id);
31  }
32  else
33  {
34  // do nothing
35  }
36  });
37  }
38 
39  template<class T>
40  simox::meta::enable_if_enum_adapted_t<T>
43  std::string const& name)
44  {
46  cfg = simox::meta::enum_names<T>.from_name(getAndReturnValue<std::string>(values, name));
47  }
48 
49  inline void getValueFromMap(long unsigned int& val, ValueMap const& values, std::string const& name)
50  {
51  int value;
53  val = value;
54  }
55 
56 }
armarx::RemoteGui
Definition: LightweightRemoteGuiComponentPlugin.h:30
Common.h
ProsthesisInterface.values
values
Definition: ProsthesisInterface.py:190
armarx::RemoteGui::ValueMap
std::map< std::string, ValueVariant > ValueMap
Definition: RemoteGuiVisitors.h:41
ARMARX_TRACE_LITE
#define ARMARX_TRACE_LITE
Definition: trace.h:85
ARMARX_TRACE
#define ARMARX_TRACE
Definition: trace.h:69
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
armarx::meta::cfg::ConcatID
std::string ConcatID(const std::string &prefix, const std::string &suffix)
Definition: ConcatID.h:7
armarx::meta::cfg::to_element_detail
element_details< CL, MT, ptr > to_element_detail(const boost::hana::pair< VarName, boost::hana::struct_detail::member_ptr< MT CL::*, ptr >> &)
T
float T
Definition: UnscentedKalmanFilterTest.cpp:35
armarx::RemoteGui::getValueFromMap
std::enable_if_t< meta::cfg::gui_definition_enabled_v< T >, void > getValueFromMap(T &cfg, RemoteGui::ValueMap const &values, std::string const &name)
Definition: GetValue.h:13