BaseHandle.hpp
Go to the documentation of this file.
1 
28 /*
29  * BaseHandle.hpp
30  *
31  * @date 02.06.2017
32  * @author Lukas Kalbertodt <lukas.kalbertodt@gmail.com>
33  */
34 
35 #ifndef LVR2_UTIL_BASEHANDLE_H_
36 #define LVR2_UTIL_BASEHANDLE_H_
37 
38 #include <boost/optional.hpp>
39 
40 namespace lvr2
41 {
42 
53 template<typename IdxT=uint32_t >
55 {
56 public:
57  explicit BaseHandle(IdxT idx);
58 
59  IdxT idx() const;
60  void setIdx(IdxT idx);
61 
62  bool operator==(const BaseHandle& other) const;
63  bool operator!=(const BaseHandle& other) const;
64  bool operator<(const BaseHandle& other) const;
65 
66 protected:
67  IdxT m_idx;
68 };
69 
78 template <typename IdxT, typename NonOptionalT>
80 {
81 public:
84  BaseOptionalHandle(boost::optional<BaseHandle<IdxT>> handle);
85  explicit BaseOptionalHandle(IdxT idx);
86 
87  explicit operator bool() const;
88 
89  bool operator!() const;
90 
91  bool operator==(const BaseOptionalHandle& other) const;
92  bool operator!=(const BaseOptionalHandle& other) const;
93 
98  NonOptionalT unwrap() const;
99  void setIdx(IdxT idx);
100 
101 private:
102  IdxT m_idx;
103 };
104 
105 } // namespace lvr2
106 
107 #include "lvr2/util/BaseHandle.tcc"
108 
109 #endif /* LVR2_UTIL_BASEHANDLE_H_ */
Interface for all kinds of handles. Handles are basically a key to refer to something.
Definition: BaseHandle.hpp:54
bool operator<(const BaseHandle &other) const
bool operator!=(const BaseHandle &other) const
BaseHandle(IdxT idx)
bool operator==(const BaseHandle &other) const
void setIdx(IdxT idx)
IdxT idx() const
Base class for optional handles (handles that can be "null" or "None").
Definition: BaseHandle.hpp:79


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:06