XYTheta.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 #include <mc_rtc/gui/types.h>
10 
11 namespace mc_rtc::gui
12 {
13 
14 namespace details
15 {
16 
28 template<typename GetT, typename SetT = std::nullptr_t>
29 struct XYThetaImpl : public CommonInputImpl<GetT, SetT>
30 {
31  static constexpr auto type = Elements::XYTheta;
32 
33  XYThetaImpl(const std::string & name, GetT get_fn, SetT set_fn = nullptr)
34  : CommonInputImpl<GetT, SetT>(name, get_fn, set_fn)
35  {
36  }
37 
38  constexpr static size_t write_size() { return CommonInputImpl<GetT, SetT>::write_size() + 1; }
39 
41  {
43  // True for read-only
44  builder.write(std::is_same_v<SetT, std::nullptr_t>);
45  }
46 
49 };
50 
51 } // namespace details
52 
54 template<typename GetT, std::enable_if_t<std::is_invocable_v<GetT>, int> = 0>
55 auto XYTheta(const std::string & name, GetT get_fn)
56 {
57  return details::XYThetaImpl(name, get_fn);
58 }
59 
61 template<typename GetT, typename SetT>
62 auto XYTheta(const std::string & name, GetT get_fn, SetT set_fn)
63 {
64  return details::XYThetaImpl(name, get_fn, set_fn);
65 }
66 
67 } // namespace mc_rtc::gui
mc_rtc::gui::DataElement::write_size
static constexpr size_t write_size()
Definition: elements.h:106
mc_rtc::MessagePackBuilder
Definition: MessagePackBuilder.h:86
types.h
mc_rtc::gui::Elements::XYTheta
@ XYTheta
mc_rtc::gui::details::XYThetaImpl::XYThetaImpl
XYThetaImpl()
Definition: XYTheta.h:48
elements.h
mc_rtc::gui::details::XYThetaImpl::write_size
constexpr static size_t write_size()
Definition: XYTheta.h:38
mc_rtc::gui::XYTheta
auto XYTheta(const std::string &name, GetT get_fn)
Definition: XYTheta.h:55
mc_rtc::MessagePackBuilder::write
void write()
mc_rtc::gui::details::XYThetaImpl::write
void write(mc_rtc::MessagePackBuilder &builder)
Definition: XYTheta.h:40
mc_rtc::gui::details::XYThetaImpl
Definition: XYTheta.h:29
mc_rtc::gui::DataElement::write
void write(mc_rtc::MessagePackBuilder &builder)
Definition: elements.h:108
traits.h
mc_rtc::gui::details::XYThetaImpl::XYThetaImpl
XYThetaImpl(const std::string &name, GetT get_fn, SetT set_fn=nullptr)
Definition: XYTheta.h:33
mc_rtc::gui::CommonInputImpl
Definition: elements.h:166
mc_rtc::gui::details::XYThetaImpl::type
static constexpr auto type
Definition: XYTheta.h:31
mc_rtc::gui
Definition: Observer.h:15
mc_rtc::gui::Element::name
const std::string & name() const
Definition: elements.h:61