[{"id":11596,"web_url":"https://patchwork.libcamera.org/comment/11596/","msgid":"<20200725082519.GG2729799@oden.dyn.berto.se>","date":"2020-07-25T08:25:19","subject":"Re: [libcamera-devel] [PATCH 0/2] libcamera: Add type-safe\n\tenum-based flags","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 work.\n\nOn 2020-07-25 02:08:39 +0300, Laurent Pinchart wrote:\n> Hello,\n> \n> This small series contains two patches that I've carried in my tree for\n> some time, and that I think could be useful. Please see patches for\n> details. The API is influenced by https://doc.qt.io/qt-5/qflags.html but\n> goes a step further by disallowing some invalid usage of the operators\n> that Qt silently allows for internal implementation reasons.\n\nThis gives me a feeling of a solution looking for a problem :-) In my \nview what one gains in type-safety one loses in the extra complexity in \nthe usage of this interface. LIBCAMERA_FLAGS_ENABLE_OPERATORS() is a \nnone obvious thing to do for example :-)\n\nThat being said if you and others find it useful I'm not against it and \nthe code in this series is good and does what it says it should. For the \nwhole series,\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> \n> Laurent Pinchart (2):\n>   libcamera: flags: Add type-safe enum-based flags\n>   test: Add tests for the Flags class\n> \n>  include/libcamera/flags.h     | 195 ++++++++++++++++++++++++++++++++\n>  include/libcamera/meson.build |   1 +\n>  src/libcamera/flags.cpp       | 192 ++++++++++++++++++++++++++++++++\n>  src/libcamera/meson.build     |   1 +\n>  test/flags.cpp                | 204 ++++++++++++++++++++++++++++++++++\n>  test/meson.build              |   1 +\n>  6 files changed, 594 insertions(+)\n>  create mode 100644 include/libcamera/flags.h\n>  create mode 100644 src/libcamera/flags.cpp\n>  create mode 100644 test/flags.cpp\n> \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":"<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 57C79BD878\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 25 Jul 2020 08:25:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B7D5D6123B;\n\tSat, 25 Jul 2020 10:25:23 +0200 (CEST)","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 B69D06053C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 25 Jul 2020 10:25:21 +0200 (CEST)","by mail-lf1-x142.google.com with SMTP id k17so6422705lfg.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 25 Jul 2020 01:25:21 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\te23sm1071491lfj.80.2020.07.25.01.25.19\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSat, 25 Jul 2020 01:25:20 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"lX9YNsSS\"; dkim-atps=neutral","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\tbh=7beGWSQr6NOQGbEChjytnbMX6Kq58KRDfUyLp5fK77w=;\n\tb=lX9YNsSSJXQkvj8uIfcxJr3xpx1pH+7GNH/QdERpPDfWhbLj8nu9yJxR48AQoC/CGZ\n\t6RY/jEauyr+LZPftHYJlCqcT0rxwCVAK6PBIGboxtT12gtGiGcqHiN5FVJgaJOBFDuKT\n\t3ryVd1IRp/BKws2+BWXR8lKRExjElkmVkVjCf3GfCo0ivYR1i0UG69VqU9/DRrEFD5mS\n\tPM2IMO7v67br85f8kvYE0STI9GnEKh8uiaagGFXEg/b3olIaA0aGCpXYlpDmUt/OQsUM\n\tjbclXHsZtwx8RealPbY8K/LNbpUebMQuFo8lC2xSAuXJ6wYRTXGUs6jaPIh2eCAQQQLu\n\tVTJA==","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;\n\tbh=7beGWSQr6NOQGbEChjytnbMX6Kq58KRDfUyLp5fK77w=;\n\tb=r9/2lN4SgtYnqS+8F7j/LHAY+LUJ6VSlqjmaNQrdduXGsz15kLmVQ8ri1loM1blmCl\n\t2v1zNINYJLAJv+XO0uLiFAqSfCXJ8kYb6fk1J/IilPeIYIxC2fyRorV2qQ2te6qvGU4+\n\tgfDmhmkaQIW1REWYxMDioDrUWtsxl8iG8EiRDjQItlmbIMR7W6Lg8t3PjEPZUm9shJwi\n\tDKZisBWOlacnR6YwbFhPVJ8KSFLa8EsnhE28/aUkR/8MopsHsEPsjD90eElgTVfRU0kF\n\t91fvQJsZvkzBnulKlO6x1hjj2A2dxhOtLpzvY+/5QzJhfBaO2+6y3TmDF+TRiNS06qXR\n\tBwSQ==","X-Gm-Message-State":"AOAM530V8Uf51JtAAVYXVmKxqoXgoz1N7aHsNvjjkMMLABx+Q9N/vYv1\n\t1KO1JGEY0+rV7VAbTRKZIRYxv33DDXo=","X-Google-Smtp-Source":"ABdhPJzXoEkY7D+lYa2dsYzcGQ8T2hNuHv1856skhwLNozVi4GQ4/3kYR2WIuFCjkOmIea96QFTX2A==","X-Received":"by 2002:a19:6d1e:: with SMTP id\n\ti30mr7096609lfc.104.1595665520803; \n\tSat, 25 Jul 2020 01:25:20 -0700 (PDT)","Date":"Sat, 25 Jul 2020 10:25:19 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20200725082519.GG2729799@oden.dyn.berto.se>","References":"<20200724230841.27838-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200724230841.27838-1-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 0/2] libcamera: Add type-safe\n\tenum-based flags","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":11598,"web_url":"https://patchwork.libcamera.org/comment/11598/","msgid":"<20200725114951.GA22048@pendragon.ideasonboard.com>","date":"2020-07-25T11:49:51","subject":"Re: [libcamera-devel] [PATCH 0/2] libcamera: Add type-safe\n\tenum-based flags","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nOn Sat, Jul 25, 2020 at 10:25:19AM +0200, Niklas Söderlund wrote:\n> On 2020-07-25 02:08:39 +0300, Laurent Pinchart wrote:\n> > Hello,\n> > \n> > This small series contains two patches that I've carried in my tree for\n> > some time, and that I think could be useful. Please see patches for\n> > details. The API is influenced by https://doc.qt.io/qt-5/qflags.html but\n> > goes a step further by disallowing some invalid usage of the operators\n> > that Qt silently allows for internal implementation reasons.\n> \n> This gives me a feeling of a solution looking for a problem :-) In my \n> view what one gains in type-safety one loses in the extra complexity in \n> the usage of this interface. LIBCAMERA_FLAGS_ENABLE_OPERATORS() is a \n> none obvious thing to do for example :-)\n\nI partly agree with you :-) That's why I'm not pushing for this to get\nmerged, but thought it could be useful.\n\n> That being said if you and others find it useful I'm not against it and \n> the code in this series is good and does what it says it should. For the \n> whole series,\n> \n> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> \n> > Laurent Pinchart (2):\n> >   libcamera: flags: Add type-safe enum-based flags\n> >   test: Add tests for the Flags class\n> > \n> >  include/libcamera/flags.h     | 195 ++++++++++++++++++++++++++++++++\n> >  include/libcamera/meson.build |   1 +\n> >  src/libcamera/flags.cpp       | 192 ++++++++++++++++++++++++++++++++\n> >  src/libcamera/meson.build     |   1 +\n> >  test/flags.cpp                | 204 ++++++++++++++++++++++++++++++++++\n> >  test/meson.build              |   1 +\n> >  6 files changed, 594 insertions(+)\n> >  create mode 100644 include/libcamera/flags.h\n> >  create mode 100644 src/libcamera/flags.cpp\n> >  create mode 100644 test/flags.cpp","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 6B4B3BD86F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 25 Jul 2020 11:50:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D90CA61223;\n\tSat, 25 Jul 2020 13:50:01 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C6B3660399\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 25 Jul 2020 13:49:59 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3E88723D;\n\tSat, 25 Jul 2020 13:49:59 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"iZBQ0qRY\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1595677799;\n\tbh=RotH4NeqaNGLLyiuSMW7B71ybyAhHghY5Mk3bkoD6KE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=iZBQ0qRYXG0CHxQXp2aYYVeKtsvlgUQdX2hTX90oWZHscSdxJF6y2Vapz5KXtCFuE\n\t+N3IIDO5dl/rRMeZogS9miR5bsHCGpeByDdHW//psur8tAjFTK5qs/EKC1HIMBE1FH\n\thWVh0ggPaQFsK3+fwCXA6uyAsrXsazNEnLABeU9k=","Date":"Sat, 25 Jul 2020 14:49:51 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Message-ID":"<20200725114951.GA22048@pendragon.ideasonboard.com>","References":"<20200724230841.27838-1-laurent.pinchart@ideasonboard.com>\n\t<20200725082519.GG2729799@oden.dyn.berto.se>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200725082519.GG2729799@oden.dyn.berto.se>","Subject":"Re: [libcamera-devel] [PATCH 0/2] libcamera: Add type-safe\n\tenum-based flags","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":11601,"web_url":"https://patchwork.libcamera.org/comment/11601/","msgid":"<20200725150806.wvn5mg6x7lsdmq7t@uno.localdomain>","date":"2020-07-25T15:08:06","subject":"Re: [libcamera-devel] [PATCH 0/2] libcamera: Add type-safe\n\tenum-based flags","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hello,\n\nOn Sat, Jul 25, 2020 at 02:49:51PM +0300, Laurent Pinchart wrote:\n> Hi Niklas,\n>\n> On Sat, Jul 25, 2020 at 10:25:19AM +0200, Niklas Söderlund wrote:\n> > On 2020-07-25 02:08:39 +0300, Laurent Pinchart wrote:\n> > > Hello,\n> > >\n> > > This small series contains two patches that I've carried in my tree for\n> > > some time, and that I think could be useful. Please see patches for\n> > > details. The API is influenced by https://doc.qt.io/qt-5/qflags.html but\n> > > goes a step further by disallowing some invalid usage of the operators\n> > > that Qt silently allows for internal implementation reasons.\n> >\n> > This gives me a feeling of a solution looking for a problem :-) In my\n> > view what one gains in type-safety one loses in the extra complexity in\n> > the usage of this interface. LIBCAMERA_FLAGS_ENABLE_OPERATORS() is a\n> > none obvious thing to do for example :-)\n>\n> I partly agree with you :-) That's why I'm not pushing for this to get\n> merged, but thought it could be useful.\n>\n\nI admit the first time I read the test example I had an immediate\nfeeling of \"yes, but why?\".\n\n> > That being said if you and others find it useful I'm not against it and\n> > the code in this series is good and does what it says it should. For the\n> > whole series,\n> >\n> > Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> >\n\nSame for me\n\n> > > Laurent Pinchart (2):\n> > >   libcamera: flags: Add type-safe enum-based flags\n> > >   test: Add tests for the Flags class\n> > >\n> > >  include/libcamera/flags.h     | 195 ++++++++++++++++++++++++++++++++\n> > >  include/libcamera/meson.build |   1 +\n> > >  src/libcamera/flags.cpp       | 192 ++++++++++++++++++++++++++++++++\n> > >  src/libcamera/meson.build     |   1 +\n> > >  test/flags.cpp                | 204 ++++++++++++++++++++++++++++++++++\n> > >  test/meson.build              |   1 +\n> > >  6 files changed, 594 insertions(+)\n> > >  create mode 100644 include/libcamera/flags.h\n> > >  create mode 100644 src/libcamera/flags.cpp\n> > >  create mode 100644 test/flags.cpp\n>\n> --\n> Regards,\n>\n> Laurent Pinchart\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 99E12BD878\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 25 Jul 2020 15:04:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0A00461223;\n\tSat, 25 Jul 2020 17:04:31 +0200 (CEST)","from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 89B0E60399\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 25 Jul 2020 17:04:29 +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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 7EFCD1C0002;\n\tSat, 25 Jul 2020 15:04:28 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Sat, 25 Jul 2020 17:08:06 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20200725150806.wvn5mg6x7lsdmq7t@uno.localdomain>","References":"<20200724230841.27838-1-laurent.pinchart@ideasonboard.com>\n\t<20200725082519.GG2729799@oden.dyn.berto.se>\n\t<20200725114951.GA22048@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200725114951.GA22048@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 0/2] libcamera: Add type-safe\n\tenum-based flags","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]