[{"id":2881,"web_url":"https://patchwork.libcamera.org/comment/2881/","msgid":"<20191013152832.GM23166@bigcity.dyn.berto.se>","date":"2019-10-13T15:28:32","subject":"Re: [libcamera-devel] [PATCH v2 04/14] libcamera: controls: Add\n\tcomparison operators for ControlValue","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 2019-10-12 21:43:57 +0300, Laurent Pinchart wrote:\n> Add equality and non equality comparison operators for the ControlValue\n> class. This simplifies code that deals with control values.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  include/libcamera/controls.h |  6 ++++++\n>  src/libcamera/controls.cpp   | 27 +++++++++++++++++++++++++++\n>  2 files changed, 33 insertions(+)\n> \n> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\n> index d8acd800b143..342251c21018 100644\n> --- a/include/libcamera/controls.h\n> +++ b/include/libcamera/controls.h\n> @@ -40,6 +40,12 @@ public:\n>  \n>  \tstd::string toString() const;\n>  \n> +\tbool operator==(const ControlValue &other) const;\n> +\tbool operator!=(const ControlValue &other) const\n> +\t{\n> +\t\treturn !(*this == other);\n> +\t}\n> +\n>  private:\n>  \tControlType type_;\n>  \n> diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\n> index 70c1af481af2..bfab177fc508 100644\n> --- a/src/libcamera/controls.cpp\n> +++ b/src/libcamera/controls.cpp\n> @@ -194,6 +194,33 @@ std::string ControlValue::toString() const\n>  \treturn \"<ValueType Error>\";\n>  }\n>  \n> +/**\n> + * \\brief Compare ControlValue instances for equality\n> + * \\return True if the values have identical types and values, false otherwise\n> + */\n> +bool ControlValue::operator==(const ControlValue &other) const\n> +{\n> +\tif (type_ != other.type_)\n> +\t\treturn false;\n> +\n> +\tswitch (type_) {\n> +\tcase ControlTypeBool:\n> +\t\treturn bool_ == other.bool_;\n> +\tcase ControlTypeInteger32:\n> +\t\treturn integer32_ == other.integer32_;\n> +\tcase ControlTypeInteger64:\n> +\t\treturn integer64_ == other.integer64_;\n> +\tdefault:\n> +\t\treturn false;\n> +\t}\n> +}\n> +\n> +/**\n> + * \\fn bool ControlValue::operator!=()\n> + * \\brief Compare ControlValue instances for non equality\n> + * \\return False if the values have identical types and values, true otherwise\n> + */\n> +\n>  /**\n>   * \\class ControlId\n>   * \\brief Control static metadata\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-x143.google.com (mail-lf1-x143.google.com\n\t[IPv6:2a00:1450:4864:20::143])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9E84D61562\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 13 Oct 2019 17:28:33 +0200 (CEST)","by mail-lf1-x143.google.com with SMTP id q12so10068302lfc.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 13 Oct 2019 08:28:33 -0700 (PDT)","from localhost (h-93-159.A463.priv.bahnhof.se. [46.59.93.159])\n\tby smtp.gmail.com with ESMTPSA id\n\tx17sm3458771lji.62.2019.10.13.08.28.32\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 13 Oct 2019 08:28:32 -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=lM9uuIEpSZ1v7GI2KII900dN/hNXPBP2ugOuTsAte2U=;\n\tb=GlM4LCya/K+leL8DN5iQySwv0DSHZXVCE3UOnGiurxuSt7TncEAQO3O2Hddz3VwvuJ\n\tDImxM1hV067iLTqz97tTl1PCayO/JhECor4+JHn9u5DK4DbMTnnsREvHbO93T7c5+JtN\n\tusBSX0vLf1Mpi4vWCpLKhfase+k9JYeWH/P3S1EtMNiALFJTCDJXPeQJDkNIJnUk3xcQ\n\tR6ssxqWpD3GVXkWIoiYfuHnt0+mKnWfRlOo0dnm4kE6t4WpN7JO51C9+Ykk/TCnjp629\n\t7xTXnQwmaSdSleM26UCnYBBQ8O8BoKoEwFULxQ3XgR0yJHpUXD9B1wzD4V5Sw+2hByP2\n\tbBig==","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=lM9uuIEpSZ1v7GI2KII900dN/hNXPBP2ugOuTsAte2U=;\n\tb=s6CcB8+fYYnyn8vT5gyNIIIwtPSxX08ACzJxustwGU5nb/LPnb82S11f1yKSLv3ibA\n\tEEefA0ZHXK1Kt8ySjHcJuZsmmiLM3rUGVBhJpQinovYvlgUDZGQa8g/kCpimZx264zG+\n\tApyDvOE9u2tNa/inxMfW9tJmkqZ5eDn8PSfP8q4nZCTm2GwOjyay8d+wEv5DME/CsH4q\n\tkSaNyZfJmnXyn55px3oCgDsHifRexRjMnIWa9s/7GiYO+xWNpe8S6FSzlhfJObQS7Soi\n\tnDXtDBl3kzG121Wqu2Xdg/sFvffj1J9+wqpttejpYwu9zErX/TgJ6ZqkjRAfT0CgmXzk\n\tGehQ==","X-Gm-Message-State":"APjAAAXCay42Efxyzb4CXyNbIrlj4MiuVRn/aOpIWcwt3BnR0tsTCFwR\n\t5xUCshIRingBuMt+nSKwVqUSTMBaYPI=","X-Google-Smtp-Source":"APXvYqwbgSr6GMRnfA+V0sdTLayYcJh0xr7QLvP73+h5aUUS5M6N+MJg+RVXHYkrJ5XP2KQn6Ay+Uw==","X-Received":"by 2002:a19:f813:: with SMTP id\n\ta19mr14920728lff.154.1570980513109; \n\tSun, 13 Oct 2019 08:28:33 -0700 (PDT)","Date":"Sun, 13 Oct 2019 17:28:32 +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":"<20191013152832.GM23166@bigcity.dyn.berto.se>","References":"<20191012184407.31684-1-laurent.pinchart@ideasonboard.com>\n\t<20191012184407.31684-5-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":"<20191012184407.31684-5-laurent.pinchart@ideasonboard.com>","User-Agent":"Mutt/1.12.1 (2019-06-15)","Subject":"Re: [libcamera-devel] [PATCH v2 04/14] libcamera: controls: Add\n\tcomparison operators for ControlValue","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":"Sun, 13 Oct 2019 15:28:33 -0000"}}]