[{"id":2902,"web_url":"https://patchwork.libcamera.org/comment/2902/","msgid":"<20191015003008.GH5976@bigcity.dyn.berto.se>","date":"2019-10-15T00:30:08","subject":"Re: [libcamera-devel] [PATCH 08/10] libcamera: v4l2_controls:\n\tDerive V4L2ControlInfoMap from ControlInfoMap","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your patch.\n\nOn 2019-10-14 02:27:54 +0300, Laurent Pinchart wrote:\n> Replace the std::map<> used as the base type for V4L2ControlInfoMap by\n> ControlInfoMap, which is an alias for an std::unsorted_map<> with the\n> same key and value types. This shortens the code.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/libcamera/include/v4l2_controls.h | 34 +++++++++++++--------------\n>  src/libcamera/v4l2_controls.cpp       |  6 ++---\n>  src/libcamera/v4l2_device.cpp         |  2 +-\n>  3 files changed, 21 insertions(+), 21 deletions(-)\n> \n> diff --git a/src/libcamera/include/v4l2_controls.h b/src/libcamera/include/v4l2_controls.h\n> index 7d3528b07f94..c427b845d8b4 100644\n> --- a/src/libcamera/include/v4l2_controls.h\n> +++ b/src/libcamera/include/v4l2_controls.h\n> @@ -31,27 +31,27 @@ public:\n>  \tV4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl);\n>  };\n>  \n> -class V4L2ControlInfoMap : private std::map<const ControlId *, ControlRange>\n> +class V4L2ControlInfoMap : private ControlInfoMap\n>  {\n>  public:\n> -\tV4L2ControlInfoMap &operator=(std::map<const ControlId *, ControlRange> &&info);\n> +\tV4L2ControlInfoMap &operator=(ControlInfoMap &&info);\n>  \n> -\tusing std::map<const ControlId *, ControlRange>::key_type;\n> -\tusing std::map<const ControlId *, ControlRange>::mapped_type;\n> -\tusing std::map<const ControlId *, ControlRange>::value_type;\n> -\tusing std::map<const ControlId *, ControlRange>::size_type;\n> -\tusing std::map<const ControlId *, ControlRange>::iterator;\n> -\tusing std::map<const ControlId *, ControlRange>::const_iterator;\n> +\tusing ControlInfoMap::key_type;\n> +\tusing ControlInfoMap::mapped_type;\n> +\tusing ControlInfoMap::value_type;\n> +\tusing ControlInfoMap::size_type;\n> +\tusing ControlInfoMap::iterator;\n> +\tusing ControlInfoMap::const_iterator;\n>  \n> -\tusing std::map<const ControlId *, ControlRange>::begin;\n> -\tusing std::map<const ControlId *, ControlRange>::cbegin;\n> -\tusing std::map<const ControlId *, ControlRange>::end;\n> -\tusing std::map<const ControlId *, ControlRange>::cend;\n> -\tusing std::map<const ControlId *, ControlRange>::at;\n> -\tusing std::map<const ControlId *, ControlRange>::empty;\n> -\tusing std::map<const ControlId *, ControlRange>::size;\n> -\tusing std::map<const ControlId *, ControlRange>::count;\n> -\tusing std::map<const ControlId *, ControlRange>::find;\n> +\tusing ControlInfoMap::begin;\n> +\tusing ControlInfoMap::cbegin;\n> +\tusing ControlInfoMap::end;\n> +\tusing ControlInfoMap::cend;\n> +\tusing ControlInfoMap::at;\n> +\tusing ControlInfoMap::empty;\n> +\tusing ControlInfoMap::size;\n> +\tusing ControlInfoMap::count;\n> +\tusing ControlInfoMap::find;\n>  \n>  \tmapped_type &at(unsigned int key);\n>  \tconst mapped_type &at(unsigned int key) const;\n> diff --git a/src/libcamera/v4l2_controls.cpp b/src/libcamera/v4l2_controls.cpp\n> index e27c70eeec87..e783457caf94 100644\n> --- a/src/libcamera/v4l2_controls.cpp\n> +++ b/src/libcamera/v4l2_controls.cpp\n> @@ -140,7 +140,7 @@ V4L2ControlRange::V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl)\n>   */\n>  \n>  /**\n> - * \\brief Move assignment operator from plain map\n> + * \\brief Move assignment operator from a ControlInfoMap\n>   * \\param[in] info The control info map\n>   *\n>   * Populate the map by replacing its contents with those of \\a info using move\n> @@ -150,9 +150,9 @@ V4L2ControlRange::V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl)\n>   *\n>   * \\return The populated V4L2ControlInfoMap\n>   */\n> -V4L2ControlInfoMap &V4L2ControlInfoMap::operator=(std::map<const ControlId *, ControlRange> &&info)\n> +V4L2ControlInfoMap &V4L2ControlInfoMap::operator=(ControlInfoMap &&info)\n>  {\n> -\tstd::map<const ControlId *, ControlRange>::operator=(std::move(info));\n> +\tControlInfoMap::operator=(std::move(info));\n>  \n>  \tidmap_.clear();\n>  \tfor (const auto &ctrl : *this)\n> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> index 47999e70073c..06155eb51c03 100644\n> --- a/src/libcamera/v4l2_device.cpp\n> +++ b/src/libcamera/v4l2_device.cpp\n> @@ -342,7 +342,7 @@ int V4L2Device::ioctl(unsigned long request, void *argp)\n>   */\n>  void V4L2Device::listControls()\n>  {\n> -\tstd::map<const ControlId *, ControlRange> ctrls;\n> +\tControlInfoMap ctrls;\n>  \tstruct v4l2_query_ext_ctrl ctrl = {};\n>  \n>  \t/* \\todo Add support for menu and compound controls. */\n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lf1-x142.google.com (mail-lf1-x142.google.com\n\t[IPv6:2a00:1450:4864:20::142])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 38F27600F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 15 Oct 2019 02:30:10 +0200 (CEST)","by mail-lf1-x142.google.com with SMTP id w67so13059313lff.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Oct 2019 17:30:10 -0700 (PDT)","from localhost (h-93-159.A463.priv.bahnhof.se. [46.59.93.159])\n\tby smtp.gmail.com with ESMTPSA id\n\tx3sm4501070ljm.103.2019.10.14.17.30.09\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 14 Oct 2019 17:30:09 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=INZ7KeAqCZANm06/gKPRg2aphAjlhPBJgEkjSR9FOF8=;\n\tb=yV51yuNfpDS9ZPZTSnd+8IhxDhBrDrIuN3NbG8a0rjBxEcgLSqAW9E/RVr9zc1SNyj\n\tgBVzLPR0FC15hvJJbudnhnybX/OpXtF7wC5dFRH5nUxFsSPpwuiHHfBZjkzQSQGd3WGz\n\tRsm3B7Rsq4+1LPX51Eea4QbcDZLVGhKnEXlxYl8pQ04To6MCegGM6HGbkvQYW1ajtUH7\n\tJqERZ7pWV3BqC50glFLZUsE8JqkAGCu4mAhTJ3rhrK1VwkfJGjXvleOk9vPjlqBXqKvs\n\tEGTkiLdxtnUurOGjKpuJwcrovM2fhIh9EvUswt5ZGTlkQrHjrgbaC7cAqra8QlQVAkvp\n\tgO7w==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=INZ7KeAqCZANm06/gKPRg2aphAjlhPBJgEkjSR9FOF8=;\n\tb=PV4cnGPirvKnR/y20lJN9VyUwPQQo/UzKYGQz3VygZ6zEHqm0OUqpIISeAFpWhmO2R\n\tE7/+AAkaexByRvuZFuCNMvfQy5F+9IthiD1we4GYl+Sp9Azus+fvyHK/bnZPWiZvIyUJ\n\t6P+YnYJtN2+bUfVcLwOMBDK7+Frqmpb8hWir6b0su61YRUN8KTQB8vnfHI/oK70jnWKP\n\tavQ2If90xpFZ5jMLiytEW0cdRSwefSrK37RVOBQ/fSxrmg9YhAePv93DOZK2yGD+nZoU\n\twp1K/iSxW68L5jeKIMK9jhgPK1Icq59fYqwnBOqL5hNfSpYR7rp9t8amXv0y2u750ayG\n\tWyIA==","X-Gm-Message-State":"APjAAAVNVQefk8nC8g44H0TzYtqkh6YhG70cVG3GMK6EDgfhU0fNmHah\n\tbH6FRxeD3N6V6T2OCVWse6dLJMlirt8=","X-Google-Smtp-Source":"APXvYqzI3g6xLXOYvGroU8RO+PGbq+vOv0gr+irzJ/vPKRL7mrLQMqojNjgK6HzUXbhuhlb7zTjZKQ==","X-Received":"by 2002:a19:640c:: with SMTP id\n\ty12mr20023206lfb.78.1571099409660; \n\tMon, 14 Oct 2019 17:30:09 -0700 (PDT)","Date":"Tue, 15 Oct 2019 02:30:08 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20191015003008.GH5976@bigcity.dyn.berto.se>","References":"<20191013232755.3292-1-laurent.pinchart@ideasonboard.com>\n\t<20191013232755.3292-9-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20191013232755.3292-9-laurent.pinchart@ideasonboard.com>","User-Agent":"Mutt/1.12.1 (2019-06-15)","Subject":"Re: [libcamera-devel] [PATCH 08/10] libcamera: v4l2_controls:\n\tDerive V4L2ControlInfoMap from ControlInfoMap","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Tue, 15 Oct 2019 00:30:10 -0000"}},{"id":2921,"web_url":"https://patchwork.libcamera.org/comment/2921/","msgid":"<20191015180341.esmhjcun76qi35pe@uno.localdomain>","date":"2019-10-15T18:03:41","subject":"Re: [libcamera-devel] [PATCH 08/10] libcamera: v4l2_controls:\n\tDerive V4L2ControlInfoMap from ControlInfoMap","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Mon, Oct 14, 2019 at 02:27:54AM +0300, Laurent Pinchart wrote:\n> Replace the std::map<> used as the base type for V4L2ControlInfoMap by\n> ControlInfoMap, which is an alias for an std::unsorted_map<> with the\n> same key and value types. This shortens the code.\n\nLooks good!\n\nThanks\n  j\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/libcamera/include/v4l2_controls.h | 34 +++++++++++++--------------\n>  src/libcamera/v4l2_controls.cpp       |  6 ++---\n>  src/libcamera/v4l2_device.cpp         |  2 +-\n>  3 files changed, 21 insertions(+), 21 deletions(-)\n>\n> diff --git a/src/libcamera/include/v4l2_controls.h b/src/libcamera/include/v4l2_controls.h\n> index 7d3528b07f94..c427b845d8b4 100644\n> --- a/src/libcamera/include/v4l2_controls.h\n> +++ b/src/libcamera/include/v4l2_controls.h\n> @@ -31,27 +31,27 @@ public:\n>  \tV4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl);\n>  };\n>\n> -class V4L2ControlInfoMap : private std::map<const ControlId *, ControlRange>\n> +class V4L2ControlInfoMap : private ControlInfoMap\n>  {\n>  public:\n> -\tV4L2ControlInfoMap &operator=(std::map<const ControlId *, ControlRange> &&info);\n> +\tV4L2ControlInfoMap &operator=(ControlInfoMap &&info);\n>\n> -\tusing std::map<const ControlId *, ControlRange>::key_type;\n> -\tusing std::map<const ControlId *, ControlRange>::mapped_type;\n> -\tusing std::map<const ControlId *, ControlRange>::value_type;\n> -\tusing std::map<const ControlId *, ControlRange>::size_type;\n> -\tusing std::map<const ControlId *, ControlRange>::iterator;\n> -\tusing std::map<const ControlId *, ControlRange>::const_iterator;\n> +\tusing ControlInfoMap::key_type;\n> +\tusing ControlInfoMap::mapped_type;\n> +\tusing ControlInfoMap::value_type;\n> +\tusing ControlInfoMap::size_type;\n> +\tusing ControlInfoMap::iterator;\n> +\tusing ControlInfoMap::const_iterator;\n>\n> -\tusing std::map<const ControlId *, ControlRange>::begin;\n> -\tusing std::map<const ControlId *, ControlRange>::cbegin;\n> -\tusing std::map<const ControlId *, ControlRange>::end;\n> -\tusing std::map<const ControlId *, ControlRange>::cend;\n> -\tusing std::map<const ControlId *, ControlRange>::at;\n> -\tusing std::map<const ControlId *, ControlRange>::empty;\n> -\tusing std::map<const ControlId *, ControlRange>::size;\n> -\tusing std::map<const ControlId *, ControlRange>::count;\n> -\tusing std::map<const ControlId *, ControlRange>::find;\n> +\tusing ControlInfoMap::begin;\n> +\tusing ControlInfoMap::cbegin;\n> +\tusing ControlInfoMap::end;\n> +\tusing ControlInfoMap::cend;\n> +\tusing ControlInfoMap::at;\n> +\tusing ControlInfoMap::empty;\n> +\tusing ControlInfoMap::size;\n> +\tusing ControlInfoMap::count;\n> +\tusing ControlInfoMap::find;\n>\n>  \tmapped_type &at(unsigned int key);\n>  \tconst mapped_type &at(unsigned int key) const;\n> diff --git a/src/libcamera/v4l2_controls.cpp b/src/libcamera/v4l2_controls.cpp\n> index e27c70eeec87..e783457caf94 100644\n> --- a/src/libcamera/v4l2_controls.cpp\n> +++ b/src/libcamera/v4l2_controls.cpp\n> @@ -140,7 +140,7 @@ V4L2ControlRange::V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl)\n>   */\n>\n>  /**\n> - * \\brief Move assignment operator from plain map\n> + * \\brief Move assignment operator from a ControlInfoMap\n>   * \\param[in] info The control info map\n>   *\n>   * Populate the map by replacing its contents with those of \\a info using move\n> @@ -150,9 +150,9 @@ V4L2ControlRange::V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl)\n>   *\n>   * \\return The populated V4L2ControlInfoMap\n>   */\n> -V4L2ControlInfoMap &V4L2ControlInfoMap::operator=(std::map<const ControlId *, ControlRange> &&info)\n> +V4L2ControlInfoMap &V4L2ControlInfoMap::operator=(ControlInfoMap &&info)\n>  {\n> -\tstd::map<const ControlId *, ControlRange>::operator=(std::move(info));\n> +\tControlInfoMap::operator=(std::move(info));\n>\n>  \tidmap_.clear();\n>  \tfor (const auto &ctrl : *this)\n> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> index 47999e70073c..06155eb51c03 100644\n> --- a/src/libcamera/v4l2_device.cpp\n> +++ b/src/libcamera/v4l2_device.cpp\n> @@ -342,7 +342,7 @@ int V4L2Device::ioctl(unsigned long request, void *argp)\n>   */\n>  void V4L2Device::listControls()\n>  {\n> -\tstd::map<const ControlId *, ControlRange> ctrls;\n> +\tControlInfoMap ctrls;\n>  \tstruct v4l2_query_ext_ctrl ctrl = {};\n>\n>  \t/* \\todo Add support for menu and compound controls. */\n> --\n> Regards,\n>\n> Laurent Pinchart\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net\n\t[217.70.183.198])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9E06461562\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 15 Oct 2019 20:01:53 +0200 (CEST)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 3615FC0003;\n\tTue, 15 Oct 2019 18:01:53 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Tue, 15 Oct 2019 20:03:41 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20191015180341.esmhjcun76qi35pe@uno.localdomain>","References":"<20191013232755.3292-1-laurent.pinchart@ideasonboard.com>\n\t<20191013232755.3292-9-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"dkqdteigrlsk3owp\"","Content-Disposition":"inline","In-Reply-To":"<20191013232755.3292-9-laurent.pinchart@ideasonboard.com>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH 08/10] libcamera: v4l2_controls:\n\tDerive V4L2ControlInfoMap from ControlInfoMap","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Tue, 15 Oct 2019 18:01:53 -0000"}}]