NumberInput.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 
7 #include <mc_rtc/gui/elements.h>
8 
9 namespace mc_rtc::gui
10 {
11 
12 namespace details
13 {
14 
16 template<typename GetT, typename SetT>
17 struct NumberInputImpl : public CommonInputImpl<GetT, SetT>
18 {
19  static constexpr auto type = Elements::NumberInput;
20 
21  NumberInputImpl(const std::string & name, GetT get_fn, SetT set_fn)
22  : CommonInputImpl<GetT, SetT>(name, get_fn, set_fn)
23  {
24  }
25 
28 };
29 
30 } // namespace details
31 
33 template<typename GetT, typename SetT>
34 auto NumberInput(const std::string & name, GetT get_fn, SetT set_fn)
35 {
36  return details::NumberInputImpl(name, get_fn, set_fn);
37 }
38 
40 template<typename T>
41 auto NumberInput(const std::string & name, T & value)
42 {
43  return details::NumberInputImpl(name, details::read(value), details::write(value));
44 }
45 
46 } // namespace mc_rtc::gui
auto read(const T &&value)
Definition: traits.h:188
auto write(T &value)
Definition: traits.h:224
Definition: Observer.h:16
auto NumberInput(const std::string &name, GetT get_fn, SetT set_fn)
Definition: NumberInput.h:34
Definition: elements.h:167
const std::string & name() const
Definition: elements.h:61
Definition: NumberInput.h:18
NumberInputImpl(const std::string &name, GetT get_fn, SetT set_fn)
Definition: NumberInput.h:21
static constexpr auto type
Definition: NumberInput.h:19
NumberInputImpl()
Definition: NumberInput.h:27