[libcamera-devel] [PATCH] libcamera: fix odd include file hierarchy

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Jan 23 16:51:26 CET 2019


Hi Niklas,

Thank you for the patch.

On Wed, Jan 23, 2019 at 12:29:57PM +0100, Niklas Söderlund wrote:
> There is no need for pipeline_handler.h to include camera.h, instead it
> should be included in the source file which needs it;
> camera_manager.cpp. Fix this by adding a forward declaration of Camera
> in pipeline_handler.h and include the header in the correct file.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> ---
>  src/libcamera/camera_manager.cpp         | 1 +
>  src/libcamera/include/pipeline_handler.h | 3 +--
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
> index 37ccbd533790856a..4ea7ed44cc31f747 100644
> --- a/src/libcamera/camera_manager.cpp
> +++ b/src/libcamera/camera_manager.cpp
> @@ -5,6 +5,7 @@
>   * camera_manager.h - Camera management
>   */
>  
> +#include <libcamera/camera.h>
>  #include <libcamera/camera_manager.h>
>  #include <libcamera/event_dispatcher.h>
>  
> diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h
> index f05f201f7ca824eb..87dc3debd795eb3e 100644
> --- a/src/libcamera/include/pipeline_handler.h
> +++ b/src/libcamera/include/pipeline_handler.h
> @@ -11,10 +11,9 @@
>  #include <string>
>  #include <vector>
>  
> -#include <libcamera/camera.h>
> -
>  namespace libcamera {
>  
> +class Camera;

In the master branch this isn't needed, you can drop the forward
declaration (please make sure everything compiles :-))..

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

>  class CameraManager;
>  class DeviceEnumerator;
>  

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list