[libcamera-devel] [PATCH v2 5/6] libcamera: formats: Expose std::map::value_type

Laurent Pinchart laurent.pinchart at ideasonboard.com
Fri Jun 26 03:38:41 CEST 2020


Hi Jacopo,

Thank you for the patch.

On Tue, Jun 09, 2020 at 01:28:43AM +0200, Jacopo Mondi wrote:
> In order to prepare to replace usage of custom map in pipeline handlers,
> expose the formats map value_type type definition, to allow pipeline
> handlers to use STL functions to iterate the class.
> 
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>

So we're already starting to extend the std::map API being exposed.
Didn't take long :-) Let's discuss that as part of 3/6. I would squash
3/6 and 5/6 together.

> ---
>  include/libcamera/internal/formats.h | 2 ++
>  src/libcamera/formats.cpp            | 5 +++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h
> index 914fdde27d0c..1361b55d63d2 100644
> --- a/include/libcamera/internal/formats.h
> +++ b/include/libcamera/internal/formats.h
> @@ -22,6 +22,8 @@ template<typename T>
>  class ImageFormats
>  {
>  public:
> +	using value_type = typename std::map<T, std::vector<SizeRange>>::value_type;
> +
>  	using iterator = typename std::map<T, std::vector<SizeRange>>::iterator;
>  	using const_iterator = typename std::map<T, std::vector<SizeRange>>::const_iterator;
>  
> diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
> index 9f46f82c9059..5037c5928669 100644
> --- a/src/libcamera/formats.cpp
> +++ b/src/libcamera/formats.cpp
> @@ -34,6 +34,11 @@ LOG_DEFINE_CATEGORY(Formats)
>   * Sizes are stored as a list of SizeRange.
>   */
>  
> +/**
> + * \typedef ImageFormats::value_type
> + * \brief Value type of the entries in the formats map
> + */
> +
>  /**
>   * \typedef ImageFormats::iterator
>   * \brief Iterator for the formats map

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list