From 030c8f1a7ea5e58e2a155b2fda19c6a72ccb310f Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 19 Oct 2021 17:17:52 +0530 Subject: android: camera_request: Turn struct into a class The Camera3RequestDescriptor structure is growing into an object with member functions. Turn it into a class, uninline the destructor to reduce code size, explicitly disable copy as requests are not copyable, and delete the default constructor to force all instances to be fully constructed. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Reviewed-by: Hirokazu Honda Signed-off-by: Umang Jain --- src/android/camera_request.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/android/camera_request.h') diff --git a/src/android/camera_request.h b/src/android/camera_request.h index 1346f6fa..79dfdb58 100644 --- a/src/android/camera_request.h +++ b/src/android/camera_request.h @@ -10,6 +10,8 @@ #include #include +#include + #include #include @@ -18,18 +20,18 @@ #include "camera_metadata.h" #include "camera_worker.h" -struct Camera3RequestDescriptor { +class Camera3RequestDescriptor +{ +public: enum class Status { Pending, Success, Error, }; - Camera3RequestDescriptor() = default; - ~Camera3RequestDescriptor() = default; Camera3RequestDescriptor(libcamera::Camera *camera, const camera3_capture_request_t *camera3Request); - Camera3RequestDescriptor &operator=(Camera3RequestDescriptor &&) = default; + ~Camera3RequestDescriptor(); bool isPending() const { return status_ == Status::Pending; } @@ -41,6 +43,9 @@ struct Camera3RequestDescriptor { camera3_capture_result_t captureResult_ = {}; Status status_ = Status::Pending; + +private: + LIBCAMERA_DISABLE_COPY(Camera3RequestDescriptor) }; #endif /* __ANDROID_CAMERA_REQUEST_H__ */ -- cgit v1.2.1