HEBI C++ API  3.9.0
group_message_wrapper.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "hebi.h"
4 
5 namespace hebi {
6 
7 class GroupFeedbackWrapper final {
8 public:
9 #ifndef DOXYGEN_OMIT_INTERNAL
10 
14  HebiGroupFeedbackPtr internal_;
15 #endif // DOXYGEN_OMIT_INTERNAL
16 private:
21  const bool manage_pointer_lifetime_;
22 
23 public:
27  GroupFeedbackWrapper(size_t number_of_modules)
28  : internal_(hebiGroupFeedbackCreate(number_of_modules)), manage_pointer_lifetime_(true) {}
29 #ifndef DOXYGEN_OMIT_INTERNAL
30 
35  GroupFeedbackWrapper(HebiGroupFeedbackPtr group_feedback)
36  : internal_(group_feedback), manage_pointer_lifetime_(false) {}
37 #endif // DOXYGEN_OMIT_INTERNAL
38 
41  ~GroupFeedbackWrapper() noexcept {
42  if (manage_pointer_lifetime_ && internal_ != nullptr)
43  hebiGroupFeedbackRelease(internal_);
44  }
45 
46  // Delete copy (and implied delete of move) constructors/operators
49 };
50 
51 class GroupCommandWrapper final {
52 public:
53 #ifndef DOXYGEN_OMIT_INTERNAL
54 
58  HebiGroupCommandPtr internal_;
59 #endif // DOXYGEN_OMIT_INTERNAL
60 
63  GroupCommandWrapper(size_t number_of_modules) : internal_(hebiGroupCommandCreate(number_of_modules)) {}
67  ~GroupCommandWrapper() noexcept {
68  if (internal_ != nullptr)
69  hebiGroupCommandRelease(internal_);
70  }
71 
72  // Delete copy (and implied delete of move) constructors/operators
75 };
76 
77 class GroupInfoWrapper final {
78 public:
79 #ifndef DOXYGEN_OMIT_INTERNAL
80 
84  HebiGroupInfoPtr internal_;
85 #endif // DOXYGEN_OMIT_INTERNAL
86 
89  GroupInfoWrapper(size_t number_of_modules) : internal_(hebiGroupInfoCreate(number_of_modules)) {}
93  ~GroupInfoWrapper() noexcept {
94  if (internal_ != nullptr)
95  hebiGroupInfoRelease(internal_);
96  }
97 
98  // Delete copy (and implied delete of move) constructors/operators
99  GroupInfoWrapper(const GroupInfoWrapper&) = delete;
100  GroupInfoWrapper& operator=(const GroupInfoWrapper&) = delete;
101 };
102 
103 } // namespace hebi
Definition: group_message_wrapper.hpp:77
GroupFeedbackWrapper(size_t number_of_modules)
Create a group feedback with the specified number of modules.
Definition: group_message_wrapper.hpp:27
~GroupInfoWrapper() noexcept
Destructor cleans up group command object as necessary.
Definition: group_message_wrapper.hpp:93
Definition: arm.cpp:8
Definition: group_message_wrapper.hpp:7
GroupCommandWrapper(size_t number_of_modules)
Create a group command with the specified number of modules.
Definition: group_message_wrapper.hpp:63
GroupInfoWrapper(size_t number_of_modules)
Create a group command with the specified number of modules.
Definition: group_message_wrapper.hpp:89
Definition: group_message_wrapper.hpp:51
~GroupCommandWrapper() noexcept
Destructor cleans up group command object as necessary.
Definition: group_message_wrapper.hpp:67
GroupFeedbackWrapper & operator=(const GroupFeedbackWrapper &)=delete
GroupInfoWrapper & operator=(const GroupInfoWrapper &)=delete
~GroupFeedbackWrapper() noexcept
Destructor cleans up group feedback object as necessary.
Definition: group_message_wrapper.hpp:41
GroupCommandWrapper & operator=(const GroupCommandWrapper &)=delete