Rotation.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 
27 template<typename GetT, typename SetT = std::nullptr_t>
28 struct RotationImpl : public CommonInputImpl<GetT, SetT>
29 {
30  static constexpr auto type = Elements::Rotation;
31 
32  RotationImpl(const std::string & name, GetT get_fn, SetT set_fn = nullptr)
33  : CommonInputImpl<GetT, SetT>(name, get_fn, set_fn)
34  {
36  "RotationImpl getter should return an sva::PTransformd");
37  }
38 
39  constexpr static size_t write_size() { return CommonInputImpl<GetT, SetT>::write_size() + 1; }
40 
42  {
44  // True for read-only
45  builder.write(std::is_same_v<SetT, std::nullptr_t>);
46  }
47 
50 };
51 
52 } // namespace details
53 
55 template<typename GetT>
56 auto Rotation(const std::string & name, GetT get_fn)
57 {
58  return details::RotationImpl(name, get_fn);
59 }
60 
62 template<typename GetT, typename SetT>
63 auto Rotation(const std::string & name, GetT get_fn, SetT set_fn)
64 {
65  return details::RotationImpl(name, get_fn, set_fn);
66 }
67 
68 } // namespace mc_rtc::gui
Definition: Observer.h:16
auto Rotation(const std::string &name, GetT get_fn)
Definition: Rotation.h:56
Definition: MessagePackBuilder.h:87
Definition: elements.h:167
void write(mc_rtc::MessagePackBuilder &builder)
Definition: elements.h:108
static constexpr size_t write_size()
Definition: elements.h:106
Definition: Rotation.h:29
RotationImpl(const std::string &name, GetT get_fn, SetT set_fn=nullptr)
Definition: Rotation.h:32
void write(mc_rtc::MessagePackBuilder &builder)
Definition: Rotation.h:41
constexpr static size_t write_size()
Definition: Rotation.h:39
RotationImpl()
Definition: Rotation.h:49
static constexpr auto type
Definition: Rotation.h:30