Form.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2019 CNRS-UM LIRMM, CNRS-AIST JRL
3  */
4 
5 #pragma once
6 
8 #include <mc_rtc/gui/elements.h>
9 
10 #include <mc_rtc/logging.h>
11 
12 namespace mc_rtc::gui
13 {
14 
15 namespace details
16 {
17 
20 {
21  template<typename... Args>
22  FormElements(Args &&... args)
23  {
25  count_ = sizeof...(Args);
26  write_elements(builder, std::forward<Args>(args)...);
27  data_size_ = builder.finish();
28  }
29 
30  template<typename T>
31  void addElement(T && element)
32  {
33  count_ += 1;
34  using ElementT = typename std::decay<T>::type;
35  if(ElementT::is_dynamic()) { addDynamicElement(std::forward<T>(element)); }
36  else
37  {
38  std::vector<char> data = data_;
40  builder.write_object(data.data(), data_size_);
41  builder.start_array(element.write_size());
42  element.write(builder);
43  builder.finish_array();
44  data_size_ = builder.finish();
45  }
46  }
47 
49  {
50  builder.start_array(count_);
51  for(const auto & el : dynamic_elements_) { el(builder); }
52  builder.write_object(data_.data(), data_size_);
53  for(size_t i = dynamic_elements_.size() + 1; i < count_; ++i) { builder.write_object(nullptr, 0); }
54  builder.finish_array();
55  }
56 
57 protected:
58  template<typename... Args>
60  {
61  }
62 
63  template<typename Arg, typename... Args>
64  void write_elements(mc_rtc::MessagePackBuilder & builder, Arg && element, Args &&... args)
65  {
66  using ElementT = typename std::decay<Arg>::type;
67  if(ElementT::is_dynamic()) { addDynamicElement(std::forward<Arg>(element)); }
68  else
69  {
70  builder.start_array(element.write_size());
71  element.write(builder);
72  builder.finish_array();
73  }
74  write_elements(builder, std::forward<Args>(args)...);
75  }
76 
77  template<typename T>
78  void addDynamicElement(T && element)
79  {
80  auto callback = [element](mc_rtc::MessagePackBuilder & builder) mutable
81  {
82  builder.start_array(element.write_size());
83  element.write(builder);
84  builder.finish_array();
85  };
86  dynamic_elements_.push_back(callback);
87  }
88 
89  size_t count_;
90  std::vector<std::function<void(mc_rtc::MessagePackBuilder &)>> dynamic_elements_;
91  std::vector<char> data_;
92  size_t data_size_;
93 };
94 
103 template<typename Callback>
104 struct FormImpl : public CallbackElement<Element, Callback>, FormElements
105 {
106  static constexpr auto type = Elements::Form;
107 
108  template<typename... Args>
109  FormImpl(const std::string & name, Callback cb, Args &&... args)
110  : CallbackElement<Element, Callback>(name, cb), FormElements(std::forward<Args>(args)...)
111  {
112  }
113 
114  static constexpr size_t write_size() { return CallbackElement<Element, Callback>::write_size() + 1; }
115 
117  {
119  FormElements::write_impl(builder);
120  }
121 
123  FormImpl() {}
124 };
125 
128 {
129  template<typename T>
130  static auto test(T *) -> typename T::is_form_element_t;
131 
132  template<typename T>
133  static std::false_type test(...);
134 };
135 
136 template<typename T>
137 inline constexpr bool is_form_element_v = decltype(is_form_element::test<T>(nullptr))::value;
138 
139 } // namespace details
140 
141 template<typename Derived, Elements element>
143 {
144  using is_form_element_t = std::true_type;
145 
146  static constexpr auto type = element;
147 
148  static constexpr size_t write_size() { return 3 + Derived::write_size_(); }
149 
150  static constexpr bool is_dynamic() { return false; }
151 
153  {
154  builder.write(name_);
155  builder.write(static_cast<typename std::underlying_type<Elements>::type>(type));
156  builder.write(required_);
157  static_cast<Derived &>(*this).write_(builder);
158  }
159 
162 
163 protected:
164  FormElement(const std::string & name, bool required) : name_(name), required_(required) {}
165 
166  std::string name_;
167  bool required_;
168 };
169 
170 namespace details
171 {
172 
174 template<typename T>
176 {
177  static_assert(std::is_same_v<std::decay_t<T>, T>);
178 
179  CallbackOrValue(T value) : callback_or_value(value) {}
180 
182 
183  static inline constexpr bool is_callback = std::is_invocable_v<T>;
184 
186  {
187  if constexpr(is_callback) { builder.write(callback_or_value()); }
188  else { builder.write(callback_or_value); }
189  }
190 };
191 
192 struct VoidValue
193 {
194 };
195 
196 template<>
198 {
201 
202  static inline constexpr bool is_callback = false;
203 
204  void write(mc_rtc::MessagePackBuilder & builder) { builder.write(); }
205 };
206 
207 template<typename T>
209 {
210  FormDataInputBase(const T & def) : def_{def}, has_def_(true) {}
211 
212  FormDataInputBase() : FormDataInputBase(T{}) { has_def_ = false; }
213 
214  static constexpr size_t write_size_() { return 2; }
215 
216  static constexpr bool is_dynamic_() { return CallbackOrValue<T>::is_callback; }
217 
219  {
220  def_.write(builder);
221  builder.write(has_def_);
222  }
223 
224 private:
225  CallbackOrValue<T> def_;
226  bool has_def_;
227 };
228 
229 template<typename T, Elements element>
230 struct FormDataInput : public FormElement<FormDataInput<T, element>, element>, FormDataInputBase<T>
231 {
232  FormDataInput(const std::string & name, bool required, const T & def)
233  : FormElement<FormDataInput<T, element>, element>(name, required), FormDataInputBase<T>(def)
234  {
235  }
236 
237  FormDataInput(const std::string & name, bool required)
238  : FormElement<FormDataInput<T, element>, element>(name, required), FormDataInputBase<T>()
239  {
240  }
241 
242  static constexpr bool is_dynamic() { return FormDataInputBase<T>::is_dynamic_(); }
243 };
244 
245 template<typename T, Elements element>
246 struct FormInteractiveDataInput : public FormElement<FormInteractiveDataInput<T, element>, element>,
248 {
249  FormInteractiveDataInput(const std::string & name, bool required, const T & def, bool interactive = true)
250  : FormElement<FormInteractiveDataInput<T, element>, element>(name, required), FormDataInputBase<T>(def),
251  interactive_(interactive)
252  {
253  }
254 
255  FormInteractiveDataInput(const std::string & name, bool required, bool interactive)
256  : FormElement<FormInteractiveDataInput<T, element>, element>(name, required), FormDataInputBase<T>(),
257  interactive_(interactive)
258  {
259  }
260 
261  static constexpr bool is_dynamic() { return FormDataInputBase<T>::is_dynamic_(); }
262 
263  static constexpr size_t write_size_() { return FormDataInputBase<T>::write_size_() + 1; }
264 
266  {
268  builder.write(interactive_);
269  }
270 
271 private:
272  bool interactive_;
273 };
274 
275 } // namespace details
276 
277 #define MAKE_DATA_INPUT_HELPER(DATAT, ELEMENT, FNAME) \
278  inline details::FormDataInput<DATAT, ELEMENT> FNAME(const std::string & name, bool required) \
279  { \
280  return {name, required}; \
281  } \
282  \
283  template<typename T = DATAT> \
284  inline auto FNAME(const std::string & name, bool required, T value) \
285  { \
286  if constexpr(std::is_invocable_v<T>) { return details::FormDataInput<T, ELEMENT>{name, required, value}; } \
287  else \
288  { \
289  if constexpr(std::is_same_v<std::decay_t<T>, DATAT>) \
290  { \
291  return details::FormDataInput<DATAT, ELEMENT>{name, required, value}; \
292  } \
293  else { return details::FormDataInput<DATAT, ELEMENT>{name, required, DATAT{value}}; } \
294  } \
295  }
296 
297 #define MAKE_INTERACTIVE_DATA_INPUT_HELPER(DATAT, ELEMENT, FNAME) \
298  inline details::FormInteractiveDataInput<DATAT, ELEMENT> FNAME(const std::string & name, bool required, \
299  bool interactive = true) \
300  { \
301  return {name, required, interactive}; \
302  } \
303  \
304  template<typename T = DATAT, typename = std::enable_if_t<!std::is_same_v<T, bool>>> \
305  inline auto FNAME(const std::string & name, bool required, T value, bool interactive = true) \
306  { \
307  if constexpr(std::is_invocable_v<T>) \
308  { \
309  return details::FormInteractiveDataInput<T, ELEMENT>{name, required, value, interactive}; \
310  } \
311  else \
312  { \
313  if constexpr(std::is_same_v<std::decay_t<T>, DATAT>) \
314  { \
315  return details::FormInteractiveDataInput<DATAT, ELEMENT>{name, required, value, interactive}; \
316  } \
317  else { return details::FormInteractiveDataInput<DATAT, ELEMENT>{name, required, DATAT{value}, interactive}; } \
318  } \
319  }
320 
321 MAKE_DATA_INPUT_HELPER(bool, Elements::Checkbox, FormCheckbox)
322 MAKE_DATA_INPUT_HELPER(int, Elements::IntegerInput, FormIntegerInput)
323 MAKE_DATA_INPUT_HELPER(double, Elements::NumberInput, FormNumberInput)
324 MAKE_DATA_INPUT_HELPER(std::string, Elements::StringInput, FormStringInput)
325 MAKE_INTERACTIVE_DATA_INPUT_HELPER(Eigen::Vector3d, Elements::Point3D, FormPoint3DInput)
326 MAKE_INTERACTIVE_DATA_INPUT_HELPER(sva::PTransformd, Elements::Rotation, FormRotationInput)
327 MAKE_INTERACTIVE_DATA_INPUT_HELPER(sva::PTransformd, Elements::Transform, FormTransformInput)
328 
329 #undef MAKE_DATA_INPUT_HELPER
330 #undef MAKE_INTERACTIVE_DATA_INPUT_HELPER
331 
332 namespace details
333 {
334 
335 template<typename T>
336 struct FormArrayInput : public FormElement<FormArrayInput<T>, Elements::ArrayInput>
337 {
338  FormArrayInput(const std::string & name,
339  bool required,
340  const std::vector<std::string> & labels,
341  const T & def,
342  bool fixed_size = true)
343  : FormElement<FormArrayInput<T>, Elements::ArrayInput>(name, required), def_{def}, fixed_size_(fixed_size),
344  has_def_(true), labels_(labels)
345  {
346  }
347 
348  FormArrayInput(const std::string & name,
349  bool required,
350  const std::vector<std::string> & labels = {},
351  bool fixed_size = false)
352  : FormArrayInput<T>(name, required, labels, {}, fixed_size)
353  {
354  has_def_ = false;
355  }
356 
357  static constexpr size_t write_size_() { return 4; }
358 
359  static constexpr bool is_dynamic() { return CallbackOrValue<T>::is_callback; }
360 
362  {
363  def_.write(builder);
364  builder.write(fixed_size_);
365  builder.write(has_def_);
366  builder.write(labels_);
367  }
368 
369 private:
370  CallbackOrValue<T> def_;
371  bool fixed_size_;
372  bool has_def_;
373  std::vector<std::string> labels_;
374 };
375 
376 } // namespace details
377 
378 template<typename T>
379 details::FormArrayInput<T> FormArrayInput(const std::string & name, bool required, bool fixed_size = false)
380 {
381  using Labels = details::Labels<T>;
382  return {name, required, Labels::labels, fixed_size};
383 }
384 
385 template<typename T>
386 auto FormArrayInput(const std::string & name, bool required, T && value, bool fixed_size = true)
387 {
388  if constexpr(std::is_invocable_v<T>)
389  {
390  using DataT = std::decay_t<decltype(std::declval<T>()())>;
391  using Labels = details::Labels<DataT>;
392  return details::FormArrayInput{name, required, Labels::labels, std::forward<T>(value), fixed_size};
393  }
394  else
395  {
396  using DataT = std::decay_t<T>;
397  using Labels = details::Labels<DataT>;
398  return details::FormArrayInput<DataT>{name, required, Labels::labels, std::forward<T>(value), fixed_size};
399  }
400 }
401 
402 struct FormComboInput : public FormElement<FormComboInput, Elements::ComboInput>
403 {
404  inline FormComboInput(const std::string & name,
405  bool required,
406  const std::vector<std::string> & values,
407  bool send_index = false,
408  int def = -1)
409  : FormElement<FormComboInput, Elements::ComboInput>(name, required), values_(values), send_index_(send_index),
410  def_(def)
411  {
412  }
413 
414  static constexpr size_t write_size_() { return 3; }
415 
416  inline void write_(mc_rtc::MessagePackBuilder & builder)
417  {
418  builder.write(values_);
419  builder.write(send_index_);
420  builder.write(def_);
421  }
422 
424  inline FormComboInput() {}
425 
426 private:
427  std::vector<std::string> values_;
428  bool send_index_ = false;
429  int def_;
430 };
431 
432 struct FormDataComboInput : public FormElement<FormDataComboInput, Elements::DataComboInput>
433 {
434  inline FormDataComboInput(const std::string & name,
435  bool required,
436  const std::vector<std::string> & ref,
437  bool send_index = false)
438  : FormElement<FormDataComboInput, Elements::DataComboInput>(name, required), ref_(ref), send_index_(send_index)
439  {
440  }
441 
442  static constexpr size_t write_size_() { return 2; }
443 
444  inline void write_(mc_rtc::MessagePackBuilder & builder)
445  {
446  builder.write(ref_);
447  builder.write(send_index_);
448  }
449 
451  inline FormDataComboInput() {}
452 
453 private:
454  std::vector<std::string> ref_;
455  bool send_index_;
456 };
457 
463 struct FormObjectInput : public FormElement<FormObjectInput, Elements::Form>, details::FormElements
464 {
465  template<typename... Args>
466  FormObjectInput(const std::string & name, bool required, Args &&... args)
467  : FormElement<FormObjectInput, Elements::Form>(name, required), FormElements(std::forward<Args>(args)...)
468  {
469  }
470 
471  static constexpr bool is_dynamic() { return true; }
472 
473  static constexpr size_t write_size_() { return 1; }
474 
475  void write_(mc_rtc::MessagePackBuilder & builder) { FormElements::write_impl(builder); }
476 };
477 
489 template<typename T = details::VoidValue>
490 struct FormGenericArrayInput : public FormElement<FormGenericArrayInput<T>, Elements::GenericArray>,
492 {
493  template<typename = std::enable_if_t<!details::is_form_element_v<T>>>
494  FormGenericArrayInput(const std::string & name, bool required, T data = {})
496  {
497  }
498 
499  template<typename Element, typename = std::enable_if_t<details::is_form_element_v<Element>>>
500  FormGenericArrayInput(const std::string & name, bool required, Element && element, T data = {})
502  FormElements(std::forward<Element>(element)), data_{data}
503  {
504  }
505 
506  static constexpr bool is_dynamic() { return true; }
507 
508  static constexpr size_t write_size_() { return 2; }
509 
511  {
512  if(count_ != 1) { mc_rtc::log::error_and_throw("FormGenericArrayInput must have exactly one element"); }
513  FormElements::write_impl(builder);
514  data_.write(builder);
515  }
516 
517 private:
519 };
520 
531 template<typename T = details::VoidValue>
532 struct FormOneOfInput : public FormElement<FormOneOfInput<T>, Elements::OneOf>, details::FormElements
533 {
534  FormOneOfInput(const std::string & name, bool required)
535  : FormElement<FormOneOfInput, Elements::OneOf>(name, required), FormElements()
536  {
537  }
538 
539  template<typename U,
540  typename... Args,
541  typename = std::enable_if_t<!details::is_variant_v<std::decay_t<U>> && !details::is_getter<U>()>>
542  FormOneOfInput(const std::string & name, bool required, U && arg, Args &&... args)
543  : FormElement<FormOneOfInput, Elements::OneOf>(name, required),
544  FormElements(std::forward<U>(arg), std::forward<Args>(args)...)
545  {
546  }
547 
548  template<typename... Args>
549  FormOneOfInput(const std::string & name, bool required, const T & def, Args &&... args)
550  : FormElement<FormOneOfInput, Elements::OneOf>(name, required), FormElements(std::forward<Args>(args)...), def_(def)
551  {
552  }
553 
554  static constexpr bool is_dynamic() { return true; }
555 
556  static constexpr size_t write_size_() { return 2; }
557 
559  {
560  def_.write(builder);
561  FormElements::write_impl(builder);
562  }
563 
564 private:
566 };
567 
569 template<typename Callback, typename... Args>
570 auto Form(const std::string & name, Callback cb, Args &&... args)
571 {
572  return details::FormImpl(name, cb, std::forward<Args>(args)...);
573 }
574 
575 } // namespace mc_rtc::gui
mc_rtc::gui::details::FormImpl::type
static constexpr auto type
Definition: Form.h:106
mc_rtc::gui::Element
Definition: elements.h:58
mc_rtc::gui::FormGenericArrayInput::write_size_
static constexpr size_t write_size_()
Definition: Form.h:508
mc_rtc::MessagePackBuilder
Definition: MessagePackBuilder.h:86
mc_rtc::gui::details::CallbackOrValue< VoidValue >::CallbackOrValue
CallbackOrValue(VoidValue)
Definition: Form.h:200
mc_rtc::gui::details::FormDataInput
Definition: Form.h:230
mc_rtc::gui::details::FormImpl
Definition: Form.h:104
mc_rtc::gui::details::is_form_element::test
static auto test(T *) -> typename T::is_form_element_t
mc_rtc::gui::FormComboInput::write_
void write_(mc_rtc::MessagePackBuilder &builder)
Definition: Form.h:416
mc_rtc::gui::details::FormElements::write_elements
void write_elements(mc_rtc::MessagePackBuilder &, Args &&...)
Definition: Form.h:59
mc_rtc::gui::details::FormDataInputBase::FormDataInputBase
FormDataInputBase()
Definition: Form.h:212
mc_rtc::gui::FormObjectInput::write_size_
static constexpr size_t write_size_()
Definition: Form.h:473
mc_rtc::gui::Elements::Transform
@ Transform
mc_rtc::gui::details::VoidValue
Definition: Form.h:192
mc_rtc::gui::details::FormArrayInput::FormArrayInput
FormArrayInput(const std::string &name, bool required, const std::vector< std::string > &labels={}, bool fixed_size=false)
Definition: Form.h:348
mc_rtc::gui::details::FormElements::data_
std::vector< char > data_
Definition: Form.h:91
mc_rtc::gui::details::FormElements::addDynamicElement
void addDynamicElement(T &&element)
Definition: Form.h:78
MAKE_DATA_INPUT_HELPER
#define MAKE_DATA_INPUT_HELPER(DATAT, ELEMENT, FNAME)
Definition: Form.h:277
mc_rtc::gui::FormDataComboInput::FormDataComboInput
FormDataComboInput()
Definition: Form.h:451
mc_rtc::gui::details::FormImpl::FormImpl
FormImpl()
Definition: Form.h:123
mc_rtc::gui::Elements::Point3D
@ Point3D
mc_rtc::gui::DataComboInput
auto DataComboInput(const std::string &name, const std::vector< std::string > &values, GetT get_fn, SetT set_fn)
Definition: DataComboInput.h:51
mc_rtc::gui::details::FormDataInputBase::write_
void write_(mc_rtc::MessagePackBuilder &builder)
Definition: Form.h:218
mc_rtc::gui::FormElement::type
static constexpr auto type
Definition: Form.h:146
mc_rtc::gui::FormArrayInput
details::FormArrayInput< T > FormArrayInput(const std::string &name, bool required, bool fixed_size=false)
Definition: Form.h:379
mc_rtc::gui::details::is_form_element_v
constexpr bool is_form_element_v
Definition: Form.h:137
mc_rtc::gui::details::FormInteractiveDataInput::FormInteractiveDataInput
FormInteractiveDataInput(const std::string &name, bool required, bool interactive)
Definition: Form.h:255
mc_rtc::gui::Elements::NumberInput
@ NumberInput
mc_rtc::MessagePackBuilder::finish_array
void finish_array()
mc_rtc::gui::FormOneOfInput::FormOneOfInput
FormOneOfInput(const std::string &name, bool required)
Definition: Form.h:534
mc_rtc::gui::details::FormArrayInput::write_
void write_(mc_rtc::MessagePackBuilder &builder)
Definition: Form.h:361
mc_rtc::gui::CallbackElement
Definition: elements.h:126
mc_rtc::gui::FormDataComboInput::FormDataComboInput
FormDataComboInput(const std::string &name, bool required, const std::vector< std::string > &ref, bool send_index=false)
Definition: Form.h:434
mc_rtc::gui::FormComboInput::FormComboInput
FormComboInput()
Definition: Form.h:424
mc_rtc::gui::details::CallbackOrValue::callback_or_value
T callback_or_value
Definition: Form.h:181
mc_rtc::gui::details::FormInteractiveDataInput::is_dynamic
static constexpr bool is_dynamic()
Definition: Form.h:261
mc_rtc::gui::FormElement::FormElement
FormElement(const std::string &name, bool required)
Definition: Form.h:164
mc_rtc::gui::details::FormInteractiveDataInput
Definition: Form.h:246
mc_rtc::gui::details::FormImpl::write_size
static constexpr size_t write_size()
Definition: Form.h:114
mc_rtc::gui::FormElement::required_
bool required_
Definition: Form.h:167
mc_rtc::gui::details::CallbackOrValue::CallbackOrValue
CallbackOrValue(T value)
Definition: Form.h:179
mc_rtc::gui::Elements::OneOf
@ OneOf
mc_rtc::gui::details::CallbackOrValue::is_callback
static constexpr bool is_callback
Definition: Form.h:183
mc_rtc::gui::details::FormElements::data_size_
size_t data_size_
Definition: Form.h:92
mc_rtc::gui::details::is_form_element
Definition: Form.h:127
mc_rtc::gui::ArrayInput
auto ArrayInput(const std::string &name, GetT get_fn, SetT set_fn)
Definition: ArrayInput.h:59
mc_rtc::gui::details::FormDataInput::FormDataInput
FormDataInput(const std::string &name, bool required)
Definition: Form.h:237
MAKE_INTERACTIVE_DATA_INPUT_HELPER
#define MAKE_INTERACTIVE_DATA_INPUT_HELPER(DATAT, ELEMENT, FNAME)
Definition: Form.h:297
mc_rtc::gui::details::FormElements::addElement
void addElement(T &&element)
Definition: Form.h:31
mc_rtc::gui::Elements::IntegerInput
@ IntegerInput
mc_rtc::gui::FormElement::is_dynamic
static constexpr bool is_dynamic()
Definition: Form.h:150
mc_rtc::gui::details::FormDataInputBase::is_dynamic_
static constexpr bool is_dynamic_()
Definition: Form.h:216
mc_rtc::gui::FormElement::name_
std::string name_
Definition: Form.h:166
mc_rtc::gui::details::FormElements::FormElements
FormElements(Args &&... args)
Definition: Form.h:22
mc_rtc::gui::details::CallbackOrValue
Definition: Form.h:175
mc_rtc::gui::details::FormElements::dynamic_elements_
std::vector< std::function< void(mc_rtc::MessagePackBuilder &)> > dynamic_elements_
Definition: Form.h:90
elements.h
mc_rtc::gui::details::CallbackOrValue< VoidValue >::CallbackOrValue
CallbackOrValue()
Definition: Form.h:199
mc_rtc::gui::ComboInput
auto ComboInput(const std::string &name, const std::vector< std::string > &values, GetT get_fn, SetT set_fn)
Definition: ComboInput.h:52
mc_rtc::gui::FormGenericArrayInput
Definition: Form.h:490
mc_rtc::gui::FormElement< FormArrayInput< T >, Elements::ArrayInput >::is_form_element_t
std::true_type is_form_element_t
Definition: Form.h:144
mc_rtc::gui::details::FormArrayInput::FormArrayInput
FormArrayInput(const std::string &name, bool required, const std::vector< std::string > &labels, const T &def, bool fixed_size=true)
Definition: Form.h:338
mc_rtc::gui::details::write
auto write(T &value)
Definition: traits.h:224
mc_rtc::gui::details::FormElements::count_
size_t count_
Definition: Form.h:89
mc_rtc::MessagePackBuilder::start_array
void start_array(size_t size)
mc_rtc::gui::details::FormDataInputBase::write_size_
static constexpr size_t write_size_()
Definition: Form.h:214
mc_rtc::gui::Form
auto Form(const std::string &name, Callback cb, Args &&... args)
Definition: Form.h:570
mc_rtc::gui::FormOneOfInput
Definition: Form.h:532
mc_rtc::gui::details::FormDataInputBase::FormDataInputBase
FormDataInputBase(const T &def)
Definition: Form.h:210
mc_rtc::gui::details::FormElements::write_elements
void write_elements(mc_rtc::MessagePackBuilder &builder, Arg &&element, Args &&... args)
Definition: Form.h:64
mc_rtc::gui::FormObjectInput::FormObjectInput
FormObjectInput(const std::string &name, bool required, Args &&... args)
Definition: Form.h:466
mc_rtc::gui::Elements
Elements
Definition: elements.h:22
mc_rtc::gui::details::FormImpl::FormImpl
FormImpl(const std::string &name, Callback cb, Args &&... args)
Definition: Form.h:109
mc_rtc::gui::details::FormInteractiveDataInput::write_
void write_(mc_rtc::MessagePackBuilder &builder)
Definition: Form.h:265
mc_rtc::gui::FormComboInput::FormComboInput
FormComboInput(const std::string &name, bool required, const std::vector< std::string > &values, bool send_index=false, int def=-1)
Definition: Form.h:404
mc_rtc::log::error_and_throw
void error_and_throw(Args &&... args)
Definition: logging.h:47
mc_rtc::gui::FormOneOfInput::FormOneOfInput
FormOneOfInput(const std::string &name, bool required, const T &def, Args &&... args)
Definition: Form.h:549
mc_rtc::MessagePackBuilder::write
void write()
mc_rtc::gui::details::FormDataInput::is_dynamic
static constexpr bool is_dynamic()
Definition: Form.h:242
mc_rtc::gui::FormGenericArrayInput::write_
void write_(mc_rtc::MessagePackBuilder &builder)
Definition: Form.h:510
mc_rtc::gui::FormDataComboInput
Definition: Form.h:432
mc_rtc::gui::details::CallbackOrValue::write
void write(mc_rtc::MessagePackBuilder &builder)
Definition: Form.h:185
mc_rtc::gui::Elements::StringInput
@ StringInput
mc_rtc::gui::FormObjectInput::write_
void write_(mc_rtc::MessagePackBuilder &builder)
Definition: Form.h:475
mc_rtc::gui::details::CallbackOrValue< VoidValue >::write
void write(mc_rtc::MessagePackBuilder &builder)
Definition: Form.h:204
mc_rtc::gui::FormDataComboInput::write_
void write_(mc_rtc::MessagePackBuilder &builder)
Definition: Form.h:444
mc_rtc::gui::FormElement::write
void write(mc_rtc::MessagePackBuilder &builder)
Definition: Form.h:152
mc_rtc::gui::FormDataComboInput::write_size_
static constexpr size_t write_size_()
Definition: Form.h:442
mc_rtc::gui::details::FormInteractiveDataInput::write_size_
static constexpr size_t write_size_()
Definition: Form.h:263
mc_rtc::gui::FormGenericArrayInput::is_dynamic
static constexpr bool is_dynamic()
Definition: Form.h:506
mc_rtc::gui::details::FormElements::write_impl
void write_impl(mc_rtc::MessagePackBuilder &builder)
Definition: Form.h:48
mc_rtc::gui::FormElement::FormElement
FormElement()
Definition: Form.h:161
mc_rtc::gui::details::FormDataInputBase
Definition: Form.h:208
mc_rtc::gui::FormOneOfInput::FormOneOfInput
FormOneOfInput(const std::string &name, bool required, U &&arg, Args &&... args)
Definition: Form.h:542
mc_rtc::gui::FormOneOfInput::write_size_
static constexpr size_t write_size_()
Definition: Form.h:556
mc_rtc::gui::FormElement
Definition: Form.h:142
std
Definition: Contact.h:66
mc_rtc::gui::Elements::Checkbox
@ Checkbox
mc_rtc::gui::Elements::Form
@ Form
logging.h
mc_rtc::gui::details::FormArrayInput::write_size_
static constexpr size_t write_size_()
Definition: Form.h:357
mc_rtc::gui::FormComboInput::write_size_
static constexpr size_t write_size_()
Definition: Form.h:414
mc_rtc::gui::details::FormArrayInput
Definition: Form.h:336
mc_rtc::MessagePackBuilder::write_object
void write_object(const char *data, size_t s)
mc_rtc::gui::details::FormDataInput::FormDataInput
FormDataInput(const std::string &name, bool required, const T &def)
Definition: Form.h:232
mc_rtc::gui::FormOneOfInput::write_
void write_(mc_rtc::MessagePackBuilder &builder)
Definition: Form.h:558
mc_rtc::gui::Elements::Rotation
@ Rotation
mc_rtc::gui::details::FormElements
Definition: Form.h:19
mc_rtc::MessagePackBuilder::finish
size_t finish()
mc_rtc::gui::FormComboInput
Definition: Form.h:402
traits.h
mc_rtc::gui::FormGenericArrayInput::FormGenericArrayInput
FormGenericArrayInput(const std::string &name, bool required, Element &&element, T data={})
Definition: Form.h:500
mc_rtc::gui::FormObjectInput::is_dynamic
static constexpr bool is_dynamic()
Definition: Form.h:471
mc_rtc::gui::FormElement::write_size
static constexpr size_t write_size()
Definition: Form.h:148
mc_rtc::gui::details::FormInteractiveDataInput::FormInteractiveDataInput
FormInteractiveDataInput(const std::string &name, bool required, const T &def, bool interactive=true)
Definition: Form.h:249
mc_rtc::gui::FormOneOfInput::is_dynamic
static constexpr bool is_dynamic()
Definition: Form.h:554
mc_rtc::gui::FormObjectInput
Definition: Form.h:463
mc_rtc::gui
Definition: Observer.h:15
mc_rtc::gui::details::Labels
Definition: traits.h:119
mc_rtc::gui::details::FormImpl::write
void write(mc_rtc::MessagePackBuilder &builder)
Definition: Form.h:116
mc_rtc::gui::FormGenericArrayInput::FormGenericArrayInput
FormGenericArrayInput(const std::string &name, bool required, T data={})
Definition: Form.h:494
mc_rtc::gui::details::FormArrayInput::is_dynamic
static constexpr bool is_dynamic()
Definition: Form.h:359
mc_rtc::gui::Element::name
const std::string & name() const
Definition: elements.h:61