[04/11] ipa: libipa: vector: Drop readYaml() function
diff mbox series

Message ID 20240613013944.23344-5-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • ipa: libipa: Vector and Pwl improvements
Related show

Commit Message

Laurent Pinchart June 13, 2024, 1:39 a.m. UTC
Now that YAML deserialization of Vector instances is supported through
YamlObject::get(), remove the Vector::readYaml() function. It turns out
not be used.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/ipa/libipa/vector.cpp | 13 -------------
 src/ipa/libipa/vector.h   | 23 -----------------------
 2 files changed, 36 deletions(-)

Comments

Paul Elder June 13, 2024, 7:37 a.m. UTC | #1
On Thu, Jun 13, 2024 at 04:39:37AM +0300, Laurent Pinchart wrote:
> Now that YAML deserialization of Vector instances is supported through
> YamlObject::get(), remove the Vector::readYaml() function. It turns out
> not be used.

s/not/to not/

> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  src/ipa/libipa/vector.cpp | 13 -------------
>  src/ipa/libipa/vector.h   | 23 -----------------------
>  2 files changed, 36 deletions(-)
> 
> diff --git a/src/ipa/libipa/vector.cpp b/src/ipa/libipa/vector.cpp
> index 4e987d82fa70..b071b261b9c4 100644
> --- a/src/ipa/libipa/vector.cpp
> +++ b/src/ipa/libipa/vector.cpp
> @@ -40,19 +40,6 @@ namespace ipa {
>   * The size of \a data must be equal to the dimension size Rows of the vector.
>   */
>  
> -/**
> - * \fn Vector::readYaml
> - * \brief Populate the vector with yaml data
> - * \param yaml Yaml data to populate the vector with
> - *
> - * Any existing data in the vector will be overwritten. The size of the data
> - * read from \a yaml must be equal to the dimension size Rows of the vector.
> - *
> - * The yaml data is expected to be a list with elements of type T.
> - *
> - * \return 0 on success, negative error code otherwise
> - */
> -
>  /**
>   * \fn T Vector::operator[](size_t i) const
>   * \brief Index to an element in the vector
> diff --git a/src/ipa/libipa/vector.h b/src/ipa/libipa/vector.h
> index 4b2fe581ecc2..2a2906202ce4 100644
> --- a/src/ipa/libipa/vector.h
> +++ b/src/ipa/libipa/vector.h
> @@ -39,29 +39,6 @@ public:
>  			data_[i] = data[i];
>  	}
>  
> -	int readYaml(const libcamera::YamlObject &yaml)
> -	{
> -		if (yaml.size() != Rows) {
> -			LOG(Vector, Error)
> -				<< "Wrong number of values in vector: expected "
> -				<< Rows << ", got " << yaml.size();
> -			return -EINVAL;
> -		}
> -
> -		unsigned int i = 0;
> -		for (const auto &x : yaml.asList()) {
> -			auto value = x.get<T>();
> -			if (!value) {
> -				LOG(Vector, Error) << "Failed to read vector value";
> -				return -EINVAL;
> -			}
> -
> -			data_[i++] = *value;
> -		}
> -
> -		return 0;
> -	}
> -
>  	const T &operator[](size_t i) const
>  	{
>  		ASSERT(i < data_.size());
> -- 
> Regards,
> 
> Laurent Pinchart
>
Kieran Bingham June 13, 2024, 11:08 a.m. UTC | #2
Quoting Laurent Pinchart (2024-06-13 02:39:37)
> Now that YAML deserialization of Vector instances is supported through
> YamlObject::get(), remove the Vector::readYaml() function. It turns out
> not be used.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

I think the 'not used' is not yet - as this was added as a dependency
for Pauls other series, so I'm curious how the rebasing goes on top of
this for that work...


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  src/ipa/libipa/vector.cpp | 13 -------------
>  src/ipa/libipa/vector.h   | 23 -----------------------
>  2 files changed, 36 deletions(-)
> 
> diff --git a/src/ipa/libipa/vector.cpp b/src/ipa/libipa/vector.cpp
> index 4e987d82fa70..b071b261b9c4 100644
> --- a/src/ipa/libipa/vector.cpp
> +++ b/src/ipa/libipa/vector.cpp
> @@ -40,19 +40,6 @@ namespace ipa {
>   * The size of \a data must be equal to the dimension size Rows of the vector.
>   */
>  
> -/**
> - * \fn Vector::readYaml
> - * \brief Populate the vector with yaml data
> - * \param yaml Yaml data to populate the vector with
> - *
> - * Any existing data in the vector will be overwritten. The size of the data
> - * read from \a yaml must be equal to the dimension size Rows of the vector.
> - *
> - * The yaml data is expected to be a list with elements of type T.
> - *
> - * \return 0 on success, negative error code otherwise
> - */
> -
>  /**
>   * \fn T Vector::operator[](size_t i) const
>   * \brief Index to an element in the vector
> diff --git a/src/ipa/libipa/vector.h b/src/ipa/libipa/vector.h
> index 4b2fe581ecc2..2a2906202ce4 100644
> --- a/src/ipa/libipa/vector.h
> +++ b/src/ipa/libipa/vector.h
> @@ -39,29 +39,6 @@ public:
>                         data_[i] = data[i];
>         }
>  
> -       int readYaml(const libcamera::YamlObject &yaml)
> -       {
> -               if (yaml.size() != Rows) {
> -                       LOG(Vector, Error)
> -                               << "Wrong number of values in vector: expected "
> -                               << Rows << ", got " << yaml.size();
> -                       return -EINVAL;
> -               }
> -
> -               unsigned int i = 0;
> -               for (const auto &x : yaml.asList()) {
> -                       auto value = x.get<T>();
> -                       if (!value) {
> -                               LOG(Vector, Error) << "Failed to read vector value";
> -                               return -EINVAL;
> -                       }
> -
> -                       data_[i++] = *value;
> -               }
> -
> -               return 0;
> -       }
> -
>         const T &operator[](size_t i) const
>         {
>                 ASSERT(i < data_.size());
> -- 
> Regards,
> 
> Laurent Pinchart
>
Laurent Pinchart June 13, 2024, 11:18 a.m. UTC | #3
On Thu, Jun 13, 2024 at 12:08:26PM +0100, Kieran Bingham wrote:
> Quoting Laurent Pinchart (2024-06-13 02:39:37)
> > Now that YAML deserialization of Vector instances is supported through
> > YamlObject::get(), remove the Vector::readYaml() function. It turns out
> > not be used.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> I think the 'not used' is not yet - as this was added as a dependency
> for Pauls other series, so I'm curious how the rebasing goes on top of
> this for that work...

Unless I missed some patches, Vector::readYaml() isn't used there
either.

> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> > ---
> >  src/ipa/libipa/vector.cpp | 13 -------------
> >  src/ipa/libipa/vector.h   | 23 -----------------------
> >  2 files changed, 36 deletions(-)
> > 
> > diff --git a/src/ipa/libipa/vector.cpp b/src/ipa/libipa/vector.cpp
> > index 4e987d82fa70..b071b261b9c4 100644
> > --- a/src/ipa/libipa/vector.cpp
> > +++ b/src/ipa/libipa/vector.cpp
> > @@ -40,19 +40,6 @@ namespace ipa {
> >   * The size of \a data must be equal to the dimension size Rows of the vector.
> >   */
> >  
> > -/**
> > - * \fn Vector::readYaml
> > - * \brief Populate the vector with yaml data
> > - * \param yaml Yaml data to populate the vector with
> > - *
> > - * Any existing data in the vector will be overwritten. The size of the data
> > - * read from \a yaml must be equal to the dimension size Rows of the vector.
> > - *
> > - * The yaml data is expected to be a list with elements of type T.
> > - *
> > - * \return 0 on success, negative error code otherwise
> > - */
> > -
> >  /**
> >   * \fn T Vector::operator[](size_t i) const
> >   * \brief Index to an element in the vector
> > diff --git a/src/ipa/libipa/vector.h b/src/ipa/libipa/vector.h
> > index 4b2fe581ecc2..2a2906202ce4 100644
> > --- a/src/ipa/libipa/vector.h
> > +++ b/src/ipa/libipa/vector.h
> > @@ -39,29 +39,6 @@ public:
> >                         data_[i] = data[i];
> >         }
> >  
> > -       int readYaml(const libcamera::YamlObject &yaml)
> > -       {
> > -               if (yaml.size() != Rows) {
> > -                       LOG(Vector, Error)
> > -                               << "Wrong number of values in vector: expected "
> > -                               << Rows << ", got " << yaml.size();
> > -                       return -EINVAL;
> > -               }
> > -
> > -               unsigned int i = 0;
> > -               for (const auto &x : yaml.asList()) {
> > -                       auto value = x.get<T>();
> > -                       if (!value) {
> > -                               LOG(Vector, Error) << "Failed to read vector value";
> > -                               return -EINVAL;
> > -                       }
> > -
> > -                       data_[i++] = *value;
> > -               }
> > -
> > -               return 0;
> > -       }
> > -
> >         const T &operator[](size_t i) const
> >         {
> >                 ASSERT(i < data_.size());

Patch
diff mbox series

diff --git a/src/ipa/libipa/vector.cpp b/src/ipa/libipa/vector.cpp
index 4e987d82fa70..b071b261b9c4 100644
--- a/src/ipa/libipa/vector.cpp
+++ b/src/ipa/libipa/vector.cpp
@@ -40,19 +40,6 @@  namespace ipa {
  * The size of \a data must be equal to the dimension size Rows of the vector.
  */
 
-/**
- * \fn Vector::readYaml
- * \brief Populate the vector with yaml data
- * \param yaml Yaml data to populate the vector with
- *
- * Any existing data in the vector will be overwritten. The size of the data
- * read from \a yaml must be equal to the dimension size Rows of the vector.
- *
- * The yaml data is expected to be a list with elements of type T.
- *
- * \return 0 on success, negative error code otherwise
- */
-
 /**
  * \fn T Vector::operator[](size_t i) const
  * \brief Index to an element in the vector
diff --git a/src/ipa/libipa/vector.h b/src/ipa/libipa/vector.h
index 4b2fe581ecc2..2a2906202ce4 100644
--- a/src/ipa/libipa/vector.h
+++ b/src/ipa/libipa/vector.h
@@ -39,29 +39,6 @@  public:
 			data_[i] = data[i];
 	}
 
-	int readYaml(const libcamera::YamlObject &yaml)
-	{
-		if (yaml.size() != Rows) {
-			LOG(Vector, Error)
-				<< "Wrong number of values in vector: expected "
-				<< Rows << ", got " << yaml.size();
-			return -EINVAL;
-		}
-
-		unsigned int i = 0;
-		for (const auto &x : yaml.asList()) {
-			auto value = x.get<T>();
-			if (!value) {
-				LOG(Vector, Error) << "Failed to read vector value";
-				return -EINVAL;
-			}
-
-			data_[i++] = *value;
-		}
-
-		return 0;
-	}
-
 	const T &operator[](size_t i) const
 	{
 		ASSERT(i < data_.size());