[{"id":32217,"web_url":"https://patchwork.libcamera.org/comment/32217/","msgid":"<87o72civdh.fsf@redhat.com>","date":"2024-11-18T12:23:06","subject":"Re: [RFC PATCH v2 03/12] ipa: libipa: vector: Add copy constructor\n\tand assignment operator","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Laurent Pinchart <laurent.pinchart@ideasonboard.com> writes:\n\n> It is useful to assign a value to an existing vector. Define a copy\n> constructor and a copy assignment operator.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/ipa/libipa/vector.cpp | 13 +++++++++++++\n>  src/ipa/libipa/vector.h   | 13 +++++++++++++\n>  2 files changed, 26 insertions(+)\n>\n> diff --git a/src/ipa/libipa/vector.cpp b/src/ipa/libipa/vector.cpp\n> index f14f155216f3..df089f8aed9f 100644\n> --- a/src/ipa/libipa/vector.cpp\n> +++ b/src/ipa/libipa/vector.cpp\n> @@ -40,6 +40,19 @@ namespace ipa {\n>   * The size of \\a data must be equal to the dimension size Rows of the vector.\n>   */\n>  \n> +/**\n> + * \\fn Vector::Vector(const Vector &other)\n> + * \\brief Construct a Vector by copying \\a other\n> + * \\param[in] other The other Vector value\n> + */\n> +\n> +/**\n> + * \\fn Vector &Vector::operator=(const Vector &other)\n> + * \\brief Replace the content of the Vector with a copy of the content of \\a other\n> + * \\param[in] other The other Vector value\n> + * \\return This Vector value\n> + */\n> +\n>  /**\n>   * \\fn T Vector::operator[](size_t i) const\n>   * \\brief Index to an element in the vector\n> diff --git a/src/ipa/libipa/vector.h b/src/ipa/libipa/vector.h\n> index b72ab9851aa3..50e16250acfd 100644\n> --- a/src/ipa/libipa/vector.h\n> +++ b/src/ipa/libipa/vector.h\n> @@ -6,6 +6,7 @@\n>   */\n>  #pragma once\n>  \n> +#include <algorithm>\n\nIs this needed for copying the array?\n\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\n\n>  #include <array>\n>  #include <cmath>\n>  #include <optional>\n> @@ -41,6 +42,18 @@ public:\n>  \t\t\tdata_[i] = data[i];\n>  \t}\n>  \n> +\tVector(const Vector &other)\n> +\t\t: data_(other.data_)\n> +\t{\n> +\t}\n> +\n> +\tVector &operator=(const Vector &other)\n> +\t{\n> +\t\tdata_ = other.data_;\n> +\n> +\t\treturn *this;\n> +\t}\n> +\n>  \tconst T &operator[](size_t i) const\n>  \t{\n>  \t\tASSERT(i < data_.size());","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 10E59C32DD\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 18 Nov 2024 12:23:16 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 52B76658C4;\n\tMon, 18 Nov 2024 13:23:15 +0100 (CET)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1311A60532\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Nov 2024 13:23:12 +0100 (CET)","from mail-wm1-f70.google.com (mail-wm1-f70.google.com\n\t[209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-646-sbEoiU6pN8uzsFveKE-ENw-1; Mon, 18 Nov 2024 07:23:10 -0500","by mail-wm1-f70.google.com with SMTP id\n\t5b1f17b1804b1-4315e8e9b1cso23356245e9.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Nov 2024 04:23:10 -0800 (PST)","from nuthatch ([2a00:102a:400a:489a:ffe9:aa41:63cd:fc2b])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-432da28ce85sm155755275e9.33.2024.11.18.04.23.07\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 18 Nov 2024 04:23:08 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"RzrZ4rRk\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1731932591;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=TT1tyxHN2DQouO8S2uEVSypd19gghLyX1Pol5RTAjkA=;\n\tb=RzrZ4rRkhLH9cSylvAcpOYQXtpPZYLpD2moJNtp/Ue5qs8zoMYIIHD8sadILzuVBp74Qbz\n\tKLwMcc0CBFwxrswnCVpEeo9ROdPgYlIueP7H8Ppse3llZnHBTODbgXZcCiJyc59pVIRxA5\n\tQO7EilHW7uPgOiNb4EUYwO/LPRa8gc0=","X-MC-Unique":"sbEoiU6pN8uzsFveKE-ENw-1","X-Mimecast-MFC-AGG-ID":"sbEoiU6pN8uzsFveKE-ENw","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1731932589; x=1732537389;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=TT1tyxHN2DQouO8S2uEVSypd19gghLyX1Pol5RTAjkA=;\n\tb=iWfSKs4nXXYWOc49wM1jvXANIO+uU8fcrPct+KOOHyIe3PJkXrPTq+/OLMv582jRCs\n\tlaWXPaTtB5++NBMU/cTOfYBjf3tfezxsZ7TfD8i10RuOf/yjY6lcOCD6J+b0NMCgPqJW\n\t0btP32OI5eywdqijx2pOgkMT8G6lNkzR6BRZsf21FVeE22I/k4NguDWi6y/JPys1tAEM\n\tSBQoOcyo66mMkp+DrbksQ+Sz4ghTbvXwS5fvUUUI1Kb7nT+32s0l8rm2AdZiLwwDUPRk\n\tORrVLVcaQSDzynQHTOSun/e/OMSDA/UuPnZ23F6xc6BmCPSBri3ZyxS32qLrADgJ98Ss\n\tIy4g==","X-Gm-Message-State":"AOJu0YyDycyGkX6ENgIPJStBf8N3BCwifEdfq0qhRGMsRsgNIMQ/sT+W\n\tkZec9sIwmUU+T7w3bG1JIPG9ZVBXZHKcPuuU9FFiCOXMEidzC5vH72eHFkF3ID+7FtbXDNaUY22\n\tK57boaY8VVS/so8dRFhX7QF5baANuG55T7RYabQIZ8RPOmpPVyzg8GQU2uzsD2RhiBaZGvv4pU/\n\t0VW0gscsK2wt9wd6+Jyj58WIJzi2FqejEDdlbkkeaszLmx6+f/+lSwLl0=","X-Received":["by 2002:a05:600c:35ce:b0:428:b4a:7001 with SMTP id\n\t5b1f17b1804b1-432d9767769mr150168695e9.15.1731932589156; \n\tMon, 18 Nov 2024 04:23:09 -0800 (PST)","by 2002:a05:600c:35ce:b0:428:b4a:7001 with SMTP id\n\t5b1f17b1804b1-432d9767769mr150168395e9.15.1731932588749; \n\tMon, 18 Nov 2024 04:23:08 -0800 (PST)"],"X-Google-Smtp-Source":"AGHT+IHai5B4MXJAsxpq5IM2y7lHBndoNAxRTJ3izqF6NUP9EE42jZ9KVhTn73hCitYNwZeHPFjvPw==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [RFC PATCH v2 03/12] ipa: libipa: vector: Add copy constructor\n\tand assignment operator","In-Reply-To":"<20241118000738.18977-4-laurent.pinchart@ideasonboard.com>\n\t(Laurent Pinchart's message of \"Mon, 18 Nov 2024 02:07:29 +0200\")","References":"<20241118000738.18977-1-laurent.pinchart@ideasonboard.com>\n\t<20241118000738.18977-4-laurent.pinchart@ideasonboard.com>","Date":"Mon, 18 Nov 2024 13:23:06 +0100","Message-ID":"<87o72civdh.fsf@redhat.com>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"jSDcJqL1C5llvtkSILBa0bktSg49yFwoPXHEbF9aY9g_1731932589","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":32220,"web_url":"https://patchwork.libcamera.org/comment/32220/","msgid":"<20241118130937.GN31681@pendragon.ideasonboard.com>","date":"2024-11-18T13:09:37","subject":"Re: [RFC PATCH v2 03/12] ipa: libipa: vector: Add copy constructor\n\tand assignment operator","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Mon, Nov 18, 2024 at 01:23:06PM +0100, Milan Zamazal wrote:\n> Laurent Pinchart <laurent.pinchart@ideasonboard.com> writes:\n> \n> > It is useful to assign a value to an existing vector. Define a copy\n> > constructor and a copy assignment operator.\n> >\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  src/ipa/libipa/vector.cpp | 13 +++++++++++++\n> >  src/ipa/libipa/vector.h   | 13 +++++++++++++\n> >  2 files changed, 26 insertions(+)\n> >\n> > diff --git a/src/ipa/libipa/vector.cpp b/src/ipa/libipa/vector.cpp\n> > index f14f155216f3..df089f8aed9f 100644\n> > --- a/src/ipa/libipa/vector.cpp\n> > +++ b/src/ipa/libipa/vector.cpp\n> > @@ -40,6 +40,19 @@ namespace ipa {\n> >   * The size of \\a data must be equal to the dimension size Rows of the vector.\n> >   */\n> >  \n> > +/**\n> > + * \\fn Vector::Vector(const Vector &other)\n> > + * \\brief Construct a Vector by copying \\a other\n> > + * \\param[in] other The other Vector value\n> > + */\n> > +\n> > +/**\n> > + * \\fn Vector &Vector::operator=(const Vector &other)\n> > + * \\brief Replace the content of the Vector with a copy of the content of \\a other\n> > + * \\param[in] other The other Vector value\n> > + * \\return This Vector value\n> > + */\n> > +\n> >  /**\n> >   * \\fn T Vector::operator[](size_t i) const\n> >   * \\brief Index to an element in the vector\n> > diff --git a/src/ipa/libipa/vector.h b/src/ipa/libipa/vector.h\n> > index b72ab9851aa3..50e16250acfd 100644\n> > --- a/src/ipa/libipa/vector.h\n> > +++ b/src/ipa/libipa/vector.h\n> > @@ -6,6 +6,7 @@\n> >   */\n> >  #pragma once\n> >  \n> > +#include <algorithm>\n> \n> Is this needed for copying the array?\n\nNo, it's not needed. It belongs to patch 05/12. I'll move it there.\n\n> Reviewed-by: Milan Zamazal <mzamazal@redhat.com>\n> \n> >  #include <array>\n> >  #include <cmath>\n> >  #include <optional>\n> > @@ -41,6 +42,18 @@ public:\n> >  \t\t\tdata_[i] = data[i];\n> >  \t}\n> >  \n> > +\tVector(const Vector &other)\n> > +\t\t: data_(other.data_)\n> > +\t{\n> > +\t}\n> > +\n> > +\tVector &operator=(const Vector &other)\n> > +\t{\n> > +\t\tdata_ = other.data_;\n> > +\n> > +\t\treturn *this;\n> > +\t}\n> > +\n> >  \tconst T &operator[](size_t i) const\n> >  \t{\n> >  \t\tASSERT(i < data_.size());","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 1EDC1C32EA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 18 Nov 2024 13:09:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ED49E658CD;\n\tMon, 18 Nov 2024 14:09:47 +0100 (CET)","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 84A5C60532\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Nov 2024 14:09:46 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 68CB44C9;\n\tMon, 18 Nov 2024 14:09:29 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"nSNRYgfu\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1731935369;\n\tbh=NjnJBMwCS88TFTlOaFwfqZvWFRZj+TL5BpvQqKRCsyA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=nSNRYgfuVRfErJb6aMmtdNdJOSQhS9MP/QL4YxoqvHBZvUT4uC+KucGuBBZNHwvjl\n\tTl1CTcR2hLJ9kgLt6yB/hQj/ezYVKuTbXw3xx7GlG1qvf9q9toex4o5GSnaZeXYWb/\n\tzBUSCJG6C2D1kVU7EP7TF1chfXELUsRemY6hKiKE=","Date":"Mon, 18 Nov 2024 15:09:37 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Milan Zamazal <mzamazal@redhat.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [RFC PATCH v2 03/12] ipa: libipa: vector: Add copy constructor\n\tand assignment operator","Message-ID":"<20241118130937.GN31681@pendragon.ideasonboard.com>","References":"<20241118000738.18977-1-laurent.pinchart@ideasonboard.com>\n\t<20241118000738.18977-4-laurent.pinchart@ideasonboard.com>\n\t<87o72civdh.fsf@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<87o72civdh.fsf@redhat.com>","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]