IntegerInput.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2022 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 IntegerInputImpl : public CommonInputImpl<GetT, SetT>
18 {
19  static constexpr auto type = Elements::IntegerInput;
20 
21  IntegerInputImpl(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 IntegerInput(const std::string & name, GetT get_fn, SetT set_fn)
35 {
36  return details::IntegerInputImpl(name, get_fn, set_fn);
37 }
38 
40 template<typename T>
41 auto IntegerInput(const std::string & name, T & value)
42 {
43  return details::IntegerInputImpl(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 IntegerInput(const std::string &name, GetT get_fn, SetT set_fn)
Definition: IntegerInput.h:34
Definition: elements.h:167
const std::string & name() const
Definition: elements.h:61
Definition: IntegerInput.h:18
static constexpr auto type
Definition: IntegerInput.h:19
IntegerInputImpl(const std::string &name, GetT get_fn, SetT set_fn)
Definition: IntegerInput.h:21
IntegerInputImpl()
Definition: IntegerInput.h:27