[{"id":2749,"web_url":"https://patchwork.libcamera.org/comment/2749/","msgid":"<20191003185512.GD1322@bigcity.dyn.berto.se>","date":"2019-10-03T18:55:12","subject":"Re: [libcamera-devel] [PATCH v2 01/13] libcamera: controls: Rename\n\tControlValueType to ControlType","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-09-29 22:02:42 +0300, Laurent Pinchart wrote:\n> The type of a control value is also the type of the control. Shorten the\n> ControlValueType enumeration to ControlType, and rename ControlValue* to\n> ControlType* for better clarity.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  include/libcamera/controls.h   | 20 +++++++-------\n>  src/libcamera/controls.cpp     | 50 +++++++++++++++++-----------------\n>  src/libcamera/gen-controls.awk |  2 +-\n>  test/controls/control_info.cpp |  4 +--\n>  4 files changed, 38 insertions(+), 38 deletions(-)\n> \n> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\n> index fbb3a62274c6..ffba880a66ff 100644\n> --- a/include/libcamera/controls.h\n> +++ b/include/libcamera/controls.h\n> @@ -18,11 +18,11 @@ namespace libcamera {\n>  \n>  class Camera;\n>  \n> -enum ControlValueType {\n> -\tControlValueNone,\n> -\tControlValueBool,\n> -\tControlValueInteger,\n> -\tControlValueInteger64,\n> +enum ControlType {\n> +\tControlTypeNone,\n> +\tControlTypeBool,\n> +\tControlTypeInteger,\n> +\tControlTypeInteger64,\n>  };\n>  \n>  class ControlValue\n> @@ -33,8 +33,8 @@ public:\n>  \tControlValue(int value);\n>  \tControlValue(int64_t value);\n>  \n> -\tControlValueType type() const { return type_; };\n> -\tbool isNone() const { return type_ == ControlValueNone; };\n> +\tControlType type() const { return type_; };\n> +\tbool isNone() const { return type_ == ControlTypeNone; };\n>  \n>  \tvoid set(bool value);\n>  \tvoid set(int value);\n> @@ -47,7 +47,7 @@ public:\n>  \tstd::string toString() const;\n>  \n>  private:\n> -\tControlValueType type_;\n> +\tControlType type_;\n>  \n>  \tunion {\n>  \t\tbool bool_;\n> @@ -59,7 +59,7 @@ private:\n>  struct ControlIdentifier {\n>  \tControlId id;\n>  \tconst char *name;\n> -\tControlValueType type;\n> +\tControlType type;\n>  };\n>  \n>  class ControlInfo\n> @@ -70,7 +70,7 @@ public:\n>  \n>  \tControlId id() const { return ident_->id; }\n>  \tconst char *name() const { return ident_->name; }\n> -\tControlValueType type() const { return ident_->type; }\n> +\tControlType type() const { return ident_->type; }\n>  \n>  \tconst ControlValue &min() const { return min_; }\n>  \tconst ControlValue &max() const { return max_; }\n> diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\n> index 727fdbd9450d..9960a30dfa03 100644\n> --- a/src/libcamera/controls.cpp\n> +++ b/src/libcamera/controls.cpp\n> @@ -25,16 +25,16 @@ namespace libcamera {\n>  LOG_DEFINE_CATEGORY(Controls)\n>  \n>  /**\n> - * \\enum ControlValueType\n> - * \\brief Define the data type of value represented by a ControlValue\n> - * \\var ControlValueNone\n> - * Identifies an unset control value\n> - * \\var ControlValueBool\n> - * Identifies controls storing a boolean value\n> - * \\var ControlValueInteger\n> - * Identifies controls storing an integer value\n> - * \\var ControlValueInteger64\n> - * Identifies controls storing a 64-bit integer value\n> + * \\enum ControlType\n> + * \\brief Define the data type of a Control\n> + * \\var ControlTypeNone\n> + * Invalid type, for empty values\n> + * \\var ControlTypeBool\n> + * The control stores a boolean value\n> + * \\var ControlTypeInteger\n> + * The control stores an integer value\n> + * \\var ControlTypeInteger64\n> + * The control stores a 64-bit integer value\n>   */\n>  \n>  /**\n> @@ -46,7 +46,7 @@ LOG_DEFINE_CATEGORY(Controls)\n>   * \\brief Construct an empty ControlValue.\n>   */\n>  ControlValue::ControlValue()\n> -\t: type_(ControlValueNone)\n> +\t: type_(ControlTypeNone)\n>  {\n>  }\n>  \n> @@ -55,7 +55,7 @@ ControlValue::ControlValue()\n>   * \\param[in] value Boolean value to store\n>   */\n>  ControlValue::ControlValue(bool value)\n> -\t: type_(ControlValueBool), bool_(value)\n> +\t: type_(ControlTypeBool), bool_(value)\n>  {\n>  }\n>  \n> @@ -64,7 +64,7 @@ ControlValue::ControlValue(bool value)\n>   * \\param[in] value Integer value to store\n>   */\n>  ControlValue::ControlValue(int value)\n> -\t: type_(ControlValueInteger), integer_(value)\n> +\t: type_(ControlTypeInteger), integer_(value)\n>  {\n>  }\n>  \n> @@ -73,7 +73,7 @@ ControlValue::ControlValue(int value)\n>   * \\param[in] value Integer value to store\n>   */\n>  ControlValue::ControlValue(int64_t value)\n> -\t: type_(ControlValueInteger64), integer64_(value)\n> +\t: type_(ControlTypeInteger64), integer64_(value)\n>  {\n>  }\n>  \n> @@ -86,7 +86,7 @@ ControlValue::ControlValue(int64_t value)\n>  /**\n>   * \\fn ControlValue::isNone()\n>   * \\brief Determine if the value is not initialised\n> - * \\return True if the value type is ControlValueNone, false otherwise\n> + * \\return True if the value type is ControlTypeNone, false otherwise\n>   */\n>  \n>  /**\n> @@ -95,7 +95,7 @@ ControlValue::ControlValue(int64_t value)\n>   */\n>  void ControlValue::set(bool value)\n>  {\n> -\ttype_ = ControlValueBool;\n> +\ttype_ = ControlTypeBool;\n>  \tbool_ = value;\n>  }\n>  \n> @@ -105,7 +105,7 @@ void ControlValue::set(bool value)\n>   */\n>  void ControlValue::set(int value)\n>  {\n> -\ttype_ = ControlValueInteger;\n> +\ttype_ = ControlTypeInteger;\n>  \tinteger_ = value;\n>  }\n>  \n> @@ -115,7 +115,7 @@ void ControlValue::set(int value)\n>   */\n>  void ControlValue::set(int64_t value)\n>  {\n> -\ttype_ = ControlValueInteger64;\n> +\ttype_ = ControlTypeInteger64;\n>  \tinteger64_ = value;\n>  }\n>  \n> @@ -128,7 +128,7 @@ void ControlValue::set(int64_t value)\n>   */\n>  bool ControlValue::getBool() const\n>  {\n> -\tASSERT(type_ == ControlValueBool);\n> +\tASSERT(type_ == ControlTypeBool);\n>  \n>  \treturn bool_;\n>  }\n> @@ -142,7 +142,7 @@ bool ControlValue::getBool() const\n>   */\n>  int ControlValue::getInt() const\n>  {\n> -\tASSERT(type_ == ControlValueInteger || type_ == ControlValueInteger64);\n> +\tASSERT(type_ == ControlTypeInteger || type_ == ControlTypeInteger64);\n>  \n>  \treturn integer_;\n>  }\n> @@ -156,7 +156,7 @@ int ControlValue::getInt() const\n>   */\n>  int64_t ControlValue::getInt64() const\n>  {\n> -\tASSERT(type_ == ControlValueInteger || type_ == ControlValueInteger64);\n> +\tASSERT(type_ == ControlTypeInteger || type_ == ControlTypeInteger64);\n>  \n>  \treturn integer64_;\n>  }\n> @@ -168,13 +168,13 @@ int64_t ControlValue::getInt64() const\n>  std::string ControlValue::toString() const\n>  {\n>  \tswitch (type_) {\n> -\tcase ControlValueNone:\n> +\tcase ControlTypeNone:\n>  \t\treturn \"<None>\";\n> -\tcase ControlValueBool:\n> +\tcase ControlTypeBool:\n>  \t\treturn bool_ ? \"True\" : \"False\";\n> -\tcase ControlValueInteger:\n> +\tcase ControlTypeInteger:\n>  \t\treturn std::to_string(integer_);\n> -\tcase ControlValueInteger64:\n> +\tcase ControlTypeInteger64:\n>  \t\treturn std::to_string(integer64_);\n>  \t}\n>  \n> diff --git a/src/libcamera/gen-controls.awk b/src/libcamera/gen-controls.awk\n> index f3d068123012..a3f291e7071c 100755\n> --- a/src/libcamera/gen-controls.awk\n> +++ b/src/libcamera/gen-controls.awk\n> @@ -92,7 +92,7 @@ function GenerateTable(file) {\n>  \tprint \"extern const std::unordered_map<ControlId, ControlIdentifier>\" > file\n>  \tprint \"controlTypes {\" > file\n>  \tfor (i=1; i <= id; ++i) {\n> -\t\tprintf \"\\t{ %s, { %s, \\\"%s\\\", ControlValue%s } },\\n\", names[i], names[i], names[i], types[i] > file\n> +\t\tprintf \"\\t{ %s, { %s, \\\"%s\\\", ControlType%s } },\\n\", names[i], names[i], names[i], types[i] > file\n>  \t}\n>  \tprint \"};\" > file\n>  \tExitNameSpace(file)\n> diff --git a/test/controls/control_info.cpp b/test/controls/control_info.cpp\n> index aa3a65b1e5ef..8cda860b9fe9 100644\n> --- a/test/controls/control_info.cpp\n> +++ b/test/controls/control_info.cpp\n> @@ -26,7 +26,7 @@ protected:\n>  \t\tControlInfo info(Brightness);\n>  \n>  \t\tif (info.id() != Brightness ||\n> -\t\t    info.type() != ControlValueInteger ||\n> +\t\t    info.type() != ControlTypeInteger ||\n>  \t\t    info.name() != std::string(\"Brightness\")) {\n>  \t\t\tcout << \"Invalid control identification for Brightness\" << endl;\n>  \t\t\treturn TestFail;\n> @@ -44,7 +44,7 @@ protected:\n>  \t\tinfo = ControlInfo(Contrast, 10, 200);\n>  \n>  \t\tif (info.id() != Contrast ||\n> -\t\t    info.type() != ControlValueInteger ||\n> +\t\t    info.type() != ControlTypeInteger ||\n>  \t\t    info.name() != std::string(\"Contrast\")) {\n>  \t\t\tcout << \"Invalid control identification for Contrast\" << endl;\n>  \t\t\treturn TestFail;\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-x144.google.com (mail-lf1-x144.google.com\n\t[IPv6:2a00:1450:4864:20::144])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4A40760BE8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  3 Oct 2019 20:55:14 +0200 (CEST)","by mail-lf1-x144.google.com with SMTP id x80so2657984lff.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 03 Oct 2019 11:55:14 -0700 (PDT)","from localhost (h-93-159.A463.priv.bahnhof.se. [46.59.93.159])\n\tby smtp.gmail.com with ESMTPSA id\n\tr6sm599811lfn.29.2019.10.03.11.55.12\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 03 Oct 2019 11:55:12 -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=YG6XNWdn/MFrnDhXYgdHqVVBDHt5fqegZCXhTud14pE=;\n\tb=EbS5X2u1SdNcX/NuPQeog7C+pVCqlBwyoPn0UZNejLR0L23hDec1f36MjWvMKDgyIC\n\t7S8JPCpStKFpDjBniFBJV/pOUnw3DTWQyqP74g4GMuVe5x4OT0RFR/mPA2TNPJkgqVSO\n\t0UjukK/Mg2pgiJm/6nt1AnQ9jK9g8r6HqTkrTuXo+rtp0RRROSetHy6U2MIuqSW2G38N\n\teZcnXnun+5+lxqV8QGym7FnhXIrT5Qsvvp4J+ryVqFzUDvHlMR2biu7Vwcp266xSbT0q\n\torukS477Il3MvgbkAPcOSWhDdiNrMj257bODRzFicHjUBnmnAq7FyLOUAQ4Bu8Y2iav1\n\t25lw==","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=YG6XNWdn/MFrnDhXYgdHqVVBDHt5fqegZCXhTud14pE=;\n\tb=lYYwoRe8kGJ0P2BPpjfQHRj+StMFc4hLuV/iuO7b/6YN77F813oKsHy7dFSieIKhhu\n\t9e2OsfWRUChiFMasD88ozk4qzcnwrcQM70UaoxwlKu07xdjeg7HbhxjAzofv8Lrj10PB\n\t+dGPutGRku6hm338sK0n+HJix5DVm9ke2HjYZzrFu+tDD/hBDzKi0R+fnP8PhPJlvBmw\n\tw7yo8L5kZCw3jNCftSwYRlVEDuOrXGfMB8t7EIHaX53yeD7Ja62T7AwC1iv+m87mv/ff\n\tX8+TRO8e+2eFi6DudEHu3w6/ibm6K4LOMCei7DLHIApjQBzVkfzZfQPNsBpJcqZepFhN\n\tt7sw==","X-Gm-Message-State":"APjAAAUvO47G2g6m9WzMz/xfpWFMdqNHfq7dnzcPyi2YeEWNRMfRcgE2\n\tKX5Ci2fvpaJUwjjhCR2PKr78ZQ==","X-Google-Smtp-Source":"APXvYqy/CcS0Xf8cRNOdFJRd/b+kA0s5NhIyh51IXSEzQ4Un19lQ5UKYu8TKkC9cl25cgma6aZ3BVw==","X-Received":"by 2002:a19:431e:: with SMTP id\n\tq30mr6537221lfa.171.1570128913200; \n\tThu, 03 Oct 2019 11:55:13 -0700 (PDT)","Date":"Thu, 3 Oct 2019 20:55:12 +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":"<20191003185512.GD1322@bigcity.dyn.berto.se>","References":"<20190929190254.18920-1-laurent.pinchart@ideasonboard.com>\n\t<20190929190254.18920-2-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":"<20190929190254.18920-2-laurent.pinchart@ideasonboard.com>","User-Agent":"Mutt/1.12.1 (2019-06-15)","Subject":"Re: [libcamera-devel] [PATCH v2 01/13] libcamera: controls: Rename\n\tControlValueType to ControlType","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":"Thu, 03 Oct 2019 18:55:14 -0000"}}]