Patch Detail
Show a patch.
GET /api/1.1/patches/2043/?format=api
{ "id": 2043, "url": "https://patchwork.libcamera.org/api/1.1/patches/2043/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2043/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20190928152238.23752-2-laurent.pinchart@ideasonboard.com>", "date": "2019-09-28T15:22:27", "name": "[libcamera-devel,01/12] libcamera: controls: Rename ControlValueType to ControlType", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "48b6c4996181c60e523aa7273b04b9978778b193", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/2043/mbox/", "series": [ { "id": 511, "url": "https://patchwork.libcamera.org/api/1.1/series/511/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=511", "date": "2019-09-28T15:22:26", "name": "Improve the application-facing controls API", "version": 1, "mbox": "https://patchwork.libcamera.org/series/511/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2043/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2043/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5391760BBA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 28 Sep 2019 17:22:56 +0200 (CEST)", "from pendragon.bb.dnainternet.fi\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D2078593\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 28 Sep 2019 17:22:55 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1569684176;\n\tbh=siwBytT26BcuPOl2WALvxfhkUpBfAqo3HB7dvKRWgck=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=SMS7WeosJVgHpUb2uJZxgcXxN0LB+Qloo6Cp6N6WRX61BMWzYhlOPcibLj3VnsKh5\n\tzlejZffyod6ZXRA+eSqvbD9iBRyGs8es4k1rSlF3UfHL0Z+f+368qIw6HUVrBgYGrm\n\tmqjLZW0vkT1LHhoiE04u07Pt/blxmq9YKRf1w5No=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sat, 28 Sep 2019 18:22:27 +0300", "Message-Id": "<20190928152238.23752-2-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190928152238.23752-1-laurent.pinchart@ideasonboard.com>", "References": "<20190928152238.23752-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 01/12] 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": "Sat, 28 Sep 2019 15:22:56 -0000" }, "content": "The type of a control value is also the type of the control. Shorten the\nControlValueType enumeration to ControlType, and rename ControlValue* to\nControlType* for better clarity.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\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(-)", "diff": "diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex 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_; }\ndiff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\nindex 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 \ndiff --git a/src/libcamera/gen-controls.awk b/src/libcamera/gen-controls.awk\nindex 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)\ndiff --git a/test/controls/control_info.cpp b/test/controls/control_info.cpp\nindex 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", "prefixes": [ "libcamera-devel", "01/12" ] }