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_ */
lvr2::BaseOptionalHandle::setIdx
void setIdx(IdxT idx)
lvr2::BaseOptionalHandle::operator!
bool operator!() const
lvr2::BaseHandle::operator<
bool operator<(const BaseHandle &other) const
lvr2::BaseHandle
Interface for all kinds of handles. Handles are basically a key to refer to something.
Definition: BaseHandle.hpp:54
lvr2::BaseHandle::m_idx
IdxT m_idx
Definition: BaseHandle.hpp:67
lvr2::BaseHandle::operator==
bool operator==(const BaseHandle &other) const
lvr2::BaseOptionalHandle::m_idx
IdxT m_idx
Definition: BaseHandle.hpp:102
lvr2::BaseOptionalHandle::unwrap
NonOptionalT unwrap() const
Extracts the handle. If this doesn't hold a handle (is "None"), this method panics.
lvr2::BaseHandle::BaseHandle
BaseHandle(IdxT idx)
lvr2::BaseOptionalHandle
Base class for optional handles (handles that can be "null" or "None").
Definition: BaseHandle.hpp:79
lvr2::BaseOptionalHandle::operator!=
bool operator!=(const BaseOptionalHandle &other) const
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::BaseHandle::setIdx
void setIdx(IdxT idx)
lvr2::BaseOptionalHandle::operator==
bool operator==(const BaseOptionalHandle &other) const
lvr2::BaseHandle::operator!=
bool operator!=(const BaseHandle &other) const
lvr2::BaseHandle::idx
IdxT idx() const
lvr2::BaseOptionalHandle::BaseOptionalHandle
BaseOptionalHandle()


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 Wed Mar 2 2022 00:37:22