[{"id":25112,"web_url":"https://patchwork.libcamera.org/comment/25112/","msgid":"<CAHW6GYJ=2nMSfuVkfUmMjsVRi-FYNRL_Q=LeWiuy7NDgHUHNug@mail.gmail.com>","date":"2022-09-23T09:19:24","subject":"Re: [libcamera-devel] [PATCH v2 1/7] delayed_controls: Template the\n\tControlRingBuffer class","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Hi Naush\n\nThanks for the patch!\n\nOn Mon, 5 Sept 2022 at 08:40, Naushir Patuck via libcamera-devel\n<libcamera-devel@lists.libcamera.org> wrote:\n>\n> Convert ControlRingBuffer to a templated class to allow arbitrary ring buffer\n> array types to be defined.\n>\n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\nTested-by: David Plowman <david.plowman@raspberrypi.com>\n\nOnly tested on the Raspberry Pi, of course!\n\nThanks\nDavid\n\n> ---\n>  include/libcamera/internal/delayed_controls.h | 13 +++++++------\n>  1 file changed, 7 insertions(+), 6 deletions(-)\n>\n> diff --git a/include/libcamera/internal/delayed_controls.h b/include/libcamera/internal/delayed_controls.h\n> index aef37077103c..f6e622f1dfba 100644\n> --- a/include/libcamera/internal/delayed_controls.h\n> +++ b/include/libcamera/internal/delayed_controls.h\n> @@ -53,17 +53,18 @@ private:\n>\n>         /* \\todo Make the listSize configurable at instance creation time. */\n>         static constexpr int listSize = 16;\n> -       class ControlRingBuffer : public std::array<Info, listSize>\n> +       template<typename T>\n> +       class ControlRingBuffer : public std::array<T, listSize>\n>         {\n>         public:\n> -               Info &operator[](unsigned int index)\n> +               T &operator[](unsigned int index)\n>                 {\n> -                       return std::array<Info, listSize>::operator[](index % listSize);\n> +                       return std::array<T, listSize>::operator[](index % listSize);\n>                 }\n>\n> -               const Info &operator[](unsigned int index) const\n> +               const T &operator[](unsigned int index) const\n>                 {\n> -                       return std::array<Info, listSize>::operator[](index % listSize);\n> +                       return std::array<T, listSize>::operator[](index % listSize);\n>                 }\n>         };\n>\n> @@ -75,7 +76,7 @@ private:\n>         uint32_t queueCount_;\n>         uint32_t writeCount_;\n>         /* \\todo Evaluate if we should index on ControlId * or unsigned int */\n> -       std::unordered_map<const ControlId *, ControlRingBuffer> values_;\n> +       std::unordered_map<const ControlId *, ControlRingBuffer<Info>> values_;\n>  };\n>\n>  } /* namespace libcamera */\n> --\n> 2.25.1\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id F2AD4C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 23 Sep 2022 09:19:38 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6223A6222F;\n\tFri, 23 Sep 2022 11:19:38 +0200 (CEST)","from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com\n\t[IPv6:2a00:1450:4864:20::22b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0EAC6621BC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 23 Sep 2022 11:19:36 +0200 (CEST)","by mail-lj1-x22b.google.com with SMTP id x29so13971155ljq.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 23 Sep 2022 02:19:35 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1663924778;\n\tbh=9GW+bslZQE+LhFZe9fkJL5hmheOf4YVtrIRvjm/ebr8=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=VuV5pvGwP/0d3K9eNgsTUAyoWJstvGgzB856EYGlF23ozmCiFn44UNVuZfyVQ5t0k\n\trut3zvV+Sm+vVZpIM4x7u5zw6699yOV1M+MQpYvNJCkdfeLAP2TC/IQJHOcvi+xDVK\n\tGwTSUFFy+1IEv/iZa2R3ENDqTZec2Gk+m2mxF5iAcdPwWWXoNieXHRb1+09jLUokRL\n\tEtHvetaROGsoJmQjHvy+FWBiXsRj8+/kPDm8voGMW+Ix5U/miPSh8pGYJe/RAb7Z43\n\tIZEYvwSpwMX4q5vPIuF0FaxwzvV1rnUo7U6xzyut2k5m5l9rHUnr3h2ZlzsHIRLDA6\n\t1yhwTWU1tb8oA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date;\n\tbh=ivD+Z7CGbVbOE0QaPz1GIU0E8StLoW+LS5249zmtQXA=;\n\tb=po/tqWkN+F0z+NQ0r+DRc6CHsStAeX1wUoatlgUcxPqWTRdN0kFUvPrKkz0HSTC+My\n\t1VUIb/2AMlco9xLTVfYcOgkALdCJ/so93fj6cRAeREP37a+BMxxs3QhMOyniawr9WWnV\n\trSwvd09LcQVoKnt4A81Yac5ZPWBQ3q3Jd9yIp+SVWm9pXmGJ4nuEXjGsCirF9yZjoFs0\n\tR6xlDKVI7BQyeJ41DbZNT2ZRCxSkn+qTvFkZVTUCENPKROQ3pJxWo2pKKv8cKNUZpJgu\n\tVUIuq89+iX2ksC/8Zx34ED+09TlFy4ZvMARIK7p0zITFix7SyimTqrKGfUKdez5qIvM2\n\trgdQ=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"po/tqWkN\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date;\n\tbh=ivD+Z7CGbVbOE0QaPz1GIU0E8StLoW+LS5249zmtQXA=;\n\tb=nqX2FqmEzKlmUn+RMbm6yJub1BJxKhjH7kimXSwaYcxolcx+WJ3tn8n2u2HRCth5v9\n\tqpHcSyisTaOskSfnZ88qUEwNDRuN+DRCvBfWc6EZze6dVjnz+5YBP203jkOppmITjgXY\n\tls6NKAQruaNKJk4PjPyXJ9TS738MTxA8mTr9tk4O8vxR335nXLOAiyuHekAT8qgZexzN\n\tbNm5knkXlH7j1Vevny2An5+ubklpJz5b8HIS1z+pvrwoW+UebqjeqeXNgEsYiqvHlgyZ\n\tfuVSkTFNXDAOA74efLkNUK5rQ+lsXJHjB5I/VNlKrN1n8dLHIkzRFPvvD6JwIczejVLf\n\twhiQ==","X-Gm-Message-State":"ACrzQf3q3U5zAYHfpZt7VUUUIuKCsoESx/k4BAbEyb4roctge2KQXch6\n\tABNf/CD2ZPDgdIsRRjKBJl5prK1l3j6EjG/QJ8Op3bEgvtLe/g==","X-Google-Smtp-Source":"AMsMyM7EYeFde88NMXL4VBmD3n9X7OvH1pJLzHwC0RS44Yq0JmR8pRgik3niaIFAYEk1yO2oGH/gU/RnUS7sCVoGE1s=","X-Received":"by 2002:a05:651c:1543:b0:26c:6a48:444f with SMTP id\n\ty3-20020a05651c154300b0026c6a48444fmr2324560ljp.185.1663924775380;\n\tFri, 23 Sep 2022 02:19:35 -0700 (PDT)","MIME-Version":"1.0","References":"<20220905073956.7342-1-naush@raspberrypi.com>\n\t<20220905073956.7342-2-naush@raspberrypi.com>","In-Reply-To":"<20220905073956.7342-2-naush@raspberrypi.com>","Date":"Fri, 23 Sep 2022 10:19:24 +0100","Message-ID":"<CAHW6GYJ=2nMSfuVkfUmMjsVRi-FYNRL_Q=LeWiuy7NDgHUHNug@mail.gmail.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v2 1/7] delayed_controls: Template the\n\tControlRingBuffer class","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>","From":"David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"David Plowman <david.plowman@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]