summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2021-02-08 17:07:32 +0000
committerKieran Bingham <kieran.bingham@ideasonboard.com>2021-02-12 14:34:04 +0000
commit41b6d83e6a0c39b31464fce67e69f0d4c5c905cc (patch)
treec087fca1ce930769127b64a3d5e93ad1840d59fa /src
parent1473add188f7a11fb8f5e17d21659a3b30a7063f (diff)
libcamera: class: Provide move and copy disablers
It can be difficult to correctly parse the syntax for copy/move and the associated assignment operators. Provide helpers as syntactic sugar to facilitate disabling either the copy constructor, and copy assignment operator, and the move constructor and move assignment operator in a way which is explicit and clear. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/class.cpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/libcamera/class.cpp b/src/libcamera/class.cpp
index ce230be9..340b7de7 100644
--- a/src/libcamera/class.cpp
+++ b/src/libcamera/class.cpp
@@ -18,6 +18,63 @@
namespace libcamera {
/**
+ * \def LIBCAMERA_DISABLE_COPY
+ * \brief Disable copy construction and assignment of the \a klass
+ * \param klass The name of the class
+ *
+ * Example usage:
+ * \code{.cpp}
+ * class NonCopyable
+ * {
+ * public:
+ * NonCopyable();
+ * ...
+ *
+ * private:
+ * LIBCAMERA_DISABLE_COPY(NonCopyable)
+ * };
+ * \endcode
+ */
+
+/**
+ * \def LIBCAMERA_DISABLE_MOVE
+ * \brief Disable move construction and assignment of the \a klass
+ * \param klass The name of the class
+ *
+ * Example usage:
+ * \code{.cpp}
+ * class NonMoveable
+ * {
+ * public:
+ * NonMoveable();
+ * ...
+ *
+ * private:
+ * LIBCAMERA_DISABLE_MOVE(NonMoveable)
+ * };
+ * \endcode
+ */
+
+/**
+ * \def LIBCAMERA_DISABLE_COPY_AND_MOVE
+ * \brief Disable copy and move construction and assignment of the \a klass
+ * \param klass The name of the class
+ *
+ * Example usage:
+ * \code{.cpp}
+ * class NonCopyableNonMoveable
+ * {
+ * public:
+ * NonCopyableNonMoveable();
+ * ...
+ *
+ * private:
+ * LIBCAMERA_DISABLE_COPY_AND_MOVE(NonCopyableNonMoveable)
+ * };
+ * \endcode
+ */
+
+/**
* \def LIBCAMERA_DECLARE_PRIVATE
* \brief Declare private data for a public class
* \param klass The public class name