{"id":1794,"url":"https://patchwork.libcamera.org/api/1.1/patches/1794/?format=json","web_url":"https://patchwork.libcamera.org/patch/1794/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190812124642.24287-17-laurent.pinchart@ideasonboard.com>","date":"2019-08-12T12:46:40","name":"[libcamera-devel,16/18] libcamera: Add parent argument to constructors of Object-derived classes","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"f5a4c6a9365939292cc669c27c0088e7b6934b69","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/1794/mbox/","series":[{"id":455,"url":"https://patchwork.libcamera.org/api/1.1/series/455/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=455","date":"2019-08-12T12:46:24","name":"Object & Thread enhancements","version":1,"mbox":"https://patchwork.libcamera.org/series/455/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1794/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1794/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2B1EF6195A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Aug 2019 14:46:55 +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 BC2DE594\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Aug 2019 14:46:54 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1565614014;\n\tbh=M0+wN8yq297lrDRjgJjjSAmy51AbU9mkRLAcXzzjGDI=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=ZMiOx9O+uTHXCJR96vQ8ra6snEW25jW1fHCuJ0PLs/44s+o0FWhSGp/aYDgOcY/NQ\n\tEL1YBnJxzTk16yWC47Y9ZNqCbVYG9Wc5jHMqmVhSPCid2bIVncYQJod8KcIt/+0kVK\n\t2NCpiEii3U4pdkWNciVew9ckGD1oTnRsAEcxqVCE=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 12 Aug 2019 15:46:40 +0300","Message-Id":"<20190812124642.24287-17-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20190812124642.24287-1-laurent.pinchart@ideasonboard.com>","References":"<20190812124642.24287-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 16/18] libcamera: Add parent argument to\n\tconstructors of Object-derived classes","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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":"Mon, 12 Aug 2019 12:46:56 -0000"},"content":"Now that the Object class implements parent-child relationships, make it\npossible to create EventNotifier and Timer instances with a parent by\nadding a parent argument to their constructors.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/event_notifier.h | 2 +-\n include/libcamera/timer.h          | 2 +-\n src/libcamera/event_notifier.cpp   | 5 +++--\n src/libcamera/timer.cpp            | 5 +++--\n 4 files changed, 8 insertions(+), 6 deletions(-)","diff":"diff --git a/include/libcamera/event_notifier.h b/include/libcamera/event_notifier.h\nindex f80945c743dc..a37b02eee4b7 100644\n--- a/include/libcamera/event_notifier.h\n+++ b/include/libcamera/event_notifier.h\n@@ -23,7 +23,7 @@ public:\n \t\tException,\n \t};\n \n-\tEventNotifier(int fd, Type type);\n+\tEventNotifier(int fd, Type type, Object *parent = nullptr);\n \tvirtual ~EventNotifier();\n \n \tType type() const { return type_; }\ndiff --git a/include/libcamera/timer.h b/include/libcamera/timer.h\nindex 853808e07da8..f47b6a58404f 100644\n--- a/include/libcamera/timer.h\n+++ b/include/libcamera/timer.h\n@@ -19,7 +19,7 @@ class Message;\n class Timer : public Object\n {\n public:\n-\tTimer();\n+\tTimer(Object *parent = nullptr);\n \t~Timer();\n \n \tvoid start(unsigned int msec);\ndiff --git a/src/libcamera/event_notifier.cpp b/src/libcamera/event_notifier.cpp\nindex 96be27601982..687969b0a8d1 100644\n--- a/src/libcamera/event_notifier.cpp\n+++ b/src/libcamera/event_notifier.cpp\n@@ -61,9 +61,10 @@ namespace libcamera {\n  * \\brief Construct an event notifier with a file descriptor and event type\n  * \\param[in] fd The file descriptor to monitor\n  * \\param[in] type The event type to monitor\n+ * \\param[in] parent The parent Object\n  */\n-EventNotifier::EventNotifier(int fd, Type type)\n-\t: fd_(fd), type_(type), enabled_(false)\n+EventNotifier::EventNotifier(int fd, Type type, Object *parent)\n+\t: Object(parent), fd_(fd), type_(type), enabled_(false)\n {\n \tsetEnabled(true);\n }\ndiff --git a/src/libcamera/timer.cpp b/src/libcamera/timer.cpp\nindex f45061d4c6f6..c61d77e5128f 100644\n--- a/src/libcamera/timer.cpp\n+++ b/src/libcamera/timer.cpp\n@@ -39,9 +39,10 @@ LOG_DEFINE_CATEGORY(Timer)\n \n /**\n  * \\brief Construct a timer\n+ * \\param[in] parent The parent Object\n  */\n-Timer::Timer()\n-\t: interval_(0), deadline_(0)\n+Timer::Timer(Object *parent)\n+\t: Object(parent), interval_(0), deadline_(0)\n {\n }\n \n","prefixes":["libcamera-devel","16/18"]}