libcamera: Include header related to source file first

Include the header file corresponding to the source file in the very
first position. This complies with the Google C++ coding style
guideliens, and helps ensuring that the headers are self-contained.

Three bugs are already caught by this change (missing includes or
forward declarations) in device_enumerator.h, event_dispatcher_poll.h
and pipeline_handler.h. Fix them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Laurent Pinchart 2019-04-18 18:39:57 +03:00
parent 0af0fb9ca9
commit 1ba441cae6
23 changed files with 45 additions and 22 deletions

View file

@ -5,13 +5,13 @@
* buffer.cpp - Buffer handling * buffer.cpp - Buffer handling
*/ */
#include <libcamera/buffer.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <unistd.h> #include <unistd.h>
#include <libcamera/buffer.h>
#include "log.h" #include "log.h"
/** /**

View file

@ -5,9 +5,10 @@
* camera.cpp - Camera device * camera.cpp - Camera device
*/ */
#include <libcamera/camera.h>
#include <iomanip> #include <iomanip>
#include <libcamera/camera.h>
#include <libcamera/request.h> #include <libcamera/request.h>
#include <libcamera/stream.h> #include <libcamera/stream.h>

View file

@ -5,8 +5,9 @@
* camera_manager.h - Camera management * camera_manager.h - Camera management
*/ */
#include <libcamera/camera.h>
#include <libcamera/camera_manager.h> #include <libcamera/camera_manager.h>
#include <libcamera/camera.h>
#include <libcamera/event_dispatcher.h> #include <libcamera/event_dispatcher.h>
#include "device_enumerator.h" #include "device_enumerator.h"

View file

@ -5,13 +5,14 @@
* camera_sensor.cpp - A camera sensor * camera_sensor.cpp - A camera sensor
*/ */
#include "camera_sensor.h"
#include <algorithm> #include <algorithm>
#include <float.h> #include <float.h>
#include <iomanip> #include <iomanip>
#include <limits.h> #include <limits.h>
#include <math.h> #include <math.h>
#include "camera_sensor.h"
#include "formats.h" #include "formats.h"
#include "v4l2_subdevice.h" #include "v4l2_subdevice.h"

View file

@ -5,6 +5,8 @@
* device_enumerator.cpp - Enumeration and matching * device_enumerator.cpp - Enumeration and matching
*/ */
#include "device_enumerator.h"
#include <fcntl.h> #include <fcntl.h>
#include <libudev.h> #include <libudev.h>
#include <string.h> #include <string.h>
@ -13,7 +15,6 @@
#include <libcamera/event_notifier.h> #include <libcamera/event_notifier.h>
#include "device_enumerator.h"
#include "log.h" #include "log.h"
#include "media_device.h" #include "media_device.h"
#include "utils.h" #include "utils.h"

View file

@ -5,6 +5,8 @@
* event_dispatcher_poll.cpp - Poll-based event dispatcher * event_dispatcher_poll.cpp - Poll-based event dispatcher
*/ */
#include "event_dispatcher_poll.h"
#include <algorithm> #include <algorithm>
#include <iomanip> #include <iomanip>
#include <poll.h> #include <poll.h>
@ -16,7 +18,6 @@
#include <libcamera/event_notifier.h> #include <libcamera/event_notifier.h>
#include <libcamera/timer.h> #include <libcamera/timer.h>
#include "event_dispatcher_poll.h"
#include "log.h" #include "log.h"
/** /**

View file

@ -5,9 +5,10 @@
* event_notifier.cpp - File descriptor event notifier * event_notifier.cpp - File descriptor event notifier
*/ */
#include <libcamera/event_notifier.h>
#include <libcamera/camera_manager.h> #include <libcamera/camera_manager.h>
#include <libcamera/event_dispatcher.h> #include <libcamera/event_dispatcher.h>
#include <libcamera/event_notifier.h>
/** /**
* \file event_notifier.h * \file event_notifier.h

View file

@ -5,11 +5,11 @@
* geometry.cpp - Geometry-related structures * geometry.cpp - Geometry-related structures
*/ */
#include <libcamera/geometry.h>
#include <sstream> #include <sstream>
#include <stdint.h> #include <stdint.h>
#include <libcamera/geometry.h>
/** /**
* \file geometry.h * \file geometry.h
* \brief Data structures related to geometric objects * \brief Data structures related to geometric objects

View file

@ -14,6 +14,9 @@
#include <linux/media.h> #include <linux/media.h>
struct udev;
struct udev_monitor;
namespace libcamera { namespace libcamera {
class EventNotifier; class EventNotifier;

View file

@ -13,6 +13,8 @@
#include <map> #include <map>
#include <vector> #include <vector>
struct pollfd;
namespace libcamera { namespace libcamera {
class EventNotifier; class EventNotifier;

View file

@ -10,6 +10,7 @@
#include <list> #include <list>
#include <map> #include <map>
#include <memory> #include <memory>
#include <set>
#include <string> #include <string>
#include <vector> #include <vector>

View file

@ -5,6 +5,8 @@
* log.cpp - Logging infrastructure * log.cpp - Logging infrastructure
*/ */
#include "log.h"
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <ctime> #include <ctime>
@ -15,7 +17,6 @@
#include <string.h> #include <string.h>
#include <unordered_set> #include <unordered_set>
#include "log.h"
#include "utils.h" #include "utils.h"
/** /**

View file

@ -5,6 +5,8 @@
* media_device.cpp - Media device handler * media_device.cpp - Media device handler
*/ */
#include "media_device.h"
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
@ -17,7 +19,6 @@
#include <linux/media.h> #include <linux/media.h>
#include "log.h" #include "log.h"
#include "media_device.h"
/** /**
* \file media_device.h * \file media_device.h

View file

@ -5,6 +5,8 @@
* media_object.cpp - Media device objects: entities, pads and links * media_object.cpp - Media device objects: entities, pads and links
*/ */
#include "media_object.h"
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
@ -16,7 +18,6 @@
#include "log.h" #include "log.h"
#include "media_device.h" #include "media_device.h"
#include "media_object.h"
/** /**
* \file media_object.h * \file media_object.h

View file

@ -6,6 +6,7 @@
*/ */
#include <libcamera/object.h> #include <libcamera/object.h>
#include <libcamera/signal.h> #include <libcamera/signal.h>
/** /**

View file

@ -5,13 +5,14 @@
* pipeline_handler.cpp - Pipeline handler infrastructure * pipeline_handler.cpp - Pipeline handler infrastructure
*/ */
#include "pipeline_handler.h"
#include <libcamera/buffer.h> #include <libcamera/buffer.h>
#include <libcamera/camera.h> #include <libcamera/camera.h>
#include <libcamera/camera_manager.h> #include <libcamera/camera_manager.h>
#include "log.h" #include "log.h"
#include "media_device.h" #include "media_device.h"
#include "pipeline_handler.h"
#include "utils.h" #include "utils.h"
/** /**

View file

@ -5,11 +5,12 @@
* request.cpp - Capture request handling * request.cpp - Capture request handling
*/ */
#include <libcamera/request.h>
#include <map> #include <map>
#include <libcamera/buffer.h> #include <libcamera/buffer.h>
#include <libcamera/camera.h> #include <libcamera/camera.h>
#include <libcamera/request.h>
#include <libcamera/stream.h> #include <libcamera/stream.h>
#include "log.h" #include "log.h"

View file

@ -5,6 +5,8 @@
* signal.cpp - Signal & slot implementation * signal.cpp - Signal & slot implementation
*/ */
#include <libcamera/signal.h>
/** /**
* \file signal.h * \file signal.h
* \brief Signal & slot implementation * \brief Signal & slot implementation

View file

@ -5,11 +5,11 @@
* stream.cpp - Video stream for a Camera * stream.cpp - Video stream for a Camera
*/ */
#include <libcamera/stream.h>
#include <iomanip> #include <iomanip>
#include <sstream> #include <sstream>
#include <libcamera/stream.h>
/** /**
* \file stream.h * \file stream.h
* \brief Video stream for a Camera * \brief Video stream for a Camera

View file

@ -5,11 +5,12 @@
* timer.cpp - Generic timer * timer.cpp - Generic timer
*/ */
#include <libcamera/timer.h>
#include <time.h> #include <time.h>
#include <libcamera/camera_manager.h> #include <libcamera/camera_manager.h>
#include <libcamera/event_dispatcher.h> #include <libcamera/event_dispatcher.h>
#include <libcamera/timer.h>
#include "log.h" #include "log.h"

View file

@ -5,11 +5,11 @@
* utils.cpp - Miscellaneous utility functions * utils.cpp - Miscellaneous utility functions
*/ */
#include "utils.h"
#include <string.h> #include <string.h>
#include <sys/auxv.h> #include <sys/auxv.h>
#include "utils.h"
/** /**
* \file utils.h * \file utils.h
* \brief Miscellaneous utility functions * \brief Miscellaneous utility functions

View file

@ -5,6 +5,8 @@
* v4l2_device.cpp - V4L2 Device * v4l2_device.cpp - V4L2 Device
*/ */
#include "v4l2_device.h"
#include <fcntl.h> #include <fcntl.h>
#include <iomanip> #include <iomanip>
#include <sstream> #include <sstream>
@ -21,7 +23,6 @@
#include "log.h" #include "log.h"
#include "media_device.h" #include "media_device.h"
#include "media_object.h" #include "media_object.h"
#include "v4l2_device.h"
/** /**
* \file v4l2_device.h * \file v4l2_device.h

View file

@ -5,6 +5,8 @@
* v4l2_subdevice.cpp - V4L2 Subdevice * v4l2_subdevice.cpp - V4L2 Subdevice
*/ */
#include "v4l2_subdevice.h"
#include <fcntl.h> #include <fcntl.h>
#include <iomanip> #include <iomanip>
#include <sstream> #include <sstream>
@ -19,7 +21,6 @@
#include "log.h" #include "log.h"
#include "media_device.h" #include "media_device.h"
#include "media_object.h" #include "media_object.h"
#include "v4l2_subdevice.h"
/** /**
* \file v4l2_subdevice.h * \file v4l2_subdevice.h