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

Niklas Söderlund niklas.soderlund at ragnatech.se
Wed Jan 23 17:03:08 CET 2019


Hi Laurent,

On 2019-01-23 17:51:26 +0200, Laurent Pinchart wrote:
> 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 :-))..

You are correct, I guess that is what I get by writing fix-up patches on 
top of my devel branches :-)

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

Thanks, with the forward declaration removed (code+commit message) and 
making sure everything compiles pushed to master.

> 
> >  class CameraManager;
> >  class DeviceEnumerator;
> >  
> 
> -- 
> Regards,
> 
> Laurent Pinchart

-- 
Regards,
Niklas Söderlund


More information about the libcamera-devel mailing list