HEBI C++ API  3.9.0
util.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 
5 // clang-format off
6 #define HEBI_DISABLE_COPY_MOVE(Class) \
7 /* Disable copy constructor. */ \
8 Class(const Class& other) = delete; \
9 /* Disable move constructor. */ \
10 Class(Class&& other) = delete; \
11 /* Disable copy assigment operator. */ \
12 Class& operator= (const Class& other) = delete; \
13 /* Disable move assigment operator. */ \
14 Class& operator= (Class&& other) = delete;
15 
16 #define HEBI_DISABLE_COPY(Class) \
17 /* Disable copy constructor. */ \
18 Class(const Class& other) = delete; \
19 /* Disable copy assigment operator. */ \
20 Class& operator= (const Class& other) = delete;
21 // clang-format on
22 
23 namespace hebi {
24 
29 public:
30  explicit FunctionCallResult(bool success) : ok_(success), failure_message_("") {}
31  FunctionCallResult(bool success, const std::string& failure) : ok_(success), failure_message_(failure) {}
34 
35  operator bool() const { return ok_; }
36  bool success() const { return ok_; }
37 
43  const std::string& failureMessage() const { return failure_message_; }
44 private:
45  bool ok_;
46  std::string failure_message_;
47 };
48 
49 }
Definition: arm.cpp:8
FunctionCallResult(bool success)
Definition: util.hpp:30
Used as a return.
Definition: util.hpp:28
FunctionCallResult(bool success, const std::string &failure)
Definition: util.hpp:31
bool success() const
Definition: util.hpp:36
const std::string & failureMessage() const
Definition: util.hpp:43
FunctionCallResult & operator=(FunctionCallResult &&)=default