[libcamera-devel,02/10] libcamera: pipeline_handler: Declare factory children classes as final

Message ID 20190124101651.9993-3-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • Hotplug support and object lifetime management
Related show

Commit Message

Laurent Pinchart Jan. 24, 2019, 10:16 a.m. UTC
Nothing should inherit from the factory classes created by the
REGISTER_PIPELINE_HANDLER() macro. Declare them as final instead of only
declaring their create() method final.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/include/pipeline_handler.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Niklas Söderlund Jan. 24, 2019, 4:38 p.m. UTC | #1
Hi Laurent,

Thanks for your work.

On 2019-01-24 12:16:43 +0200, Laurent Pinchart wrote:
> Nothing should inherit from the factory classes created by the
> REGISTER_PIPELINE_HANDLER() macro. Declare them as final instead of only
> declaring their create() method final.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  src/libcamera/include/pipeline_handler.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h
> index 7bb07d1ec5c7..1da6dc758ca6 100644
> --- a/src/libcamera/include/pipeline_handler.h
> +++ b/src/libcamera/include/pipeline_handler.h
> @@ -46,11 +46,11 @@ private:
>  };
>  
>  #define REGISTER_PIPELINE_HANDLER(handler)				\
> -class handler##Factory : public PipelineHandlerFactory			\
> +class handler##Factory final : public PipelineHandlerFactory		\
>  {									\
>  public:									\
>  	handler##Factory() : PipelineHandlerFactory(#handler) {}	\
> -	PipelineHandler *create(CameraManager *manager) final		\
> +	PipelineHandler *create(CameraManager *manager) 		\
>  	{								\
>  		return new handler(manager);				\
>  	}								\
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h
index 7bb07d1ec5c7..1da6dc758ca6 100644
--- a/src/libcamera/include/pipeline_handler.h
+++ b/src/libcamera/include/pipeline_handler.h
@@ -46,11 +46,11 @@  private:
 };
 
 #define REGISTER_PIPELINE_HANDLER(handler)				\
-class handler##Factory : public PipelineHandlerFactory			\
+class handler##Factory final : public PipelineHandlerFactory		\
 {									\
 public:									\
 	handler##Factory() : PipelineHandlerFactory(#handler) {}	\
-	PipelineHandler *create(CameraManager *manager) final		\
+	PipelineHandler *create(CameraManager *manager) 		\
 	{								\
 		return new handler(manager);				\
 	}								\