ipa: libipa: pwl: Add a constructor that moves a Point vector
The Pwl::Pwl(const std::vector<Point> &) constructor is inefficient as it makes a copy of the given points vector. Add a second constructor that takes an rvalue reference to a points vector to provide move semantics. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
@@ -114,6 +114,17 @@ Pwl::Pwl(const std::vector<Point> &points)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* \copydoc Pwl::Pwl(const std::vector<Point> &points)
|
||||
*
|
||||
* The contents of the \a points vector is moved to the newly constructed Pwl
|
||||
* instance.
|
||||
*/
|
||||
Pwl::Pwl(std::vector<Point> &&points)
|
||||
: points_(std::move(points))
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Populate the piecewise linear function from yaml data
|
||||
* \param[in] params Yaml data to populate the piecewise linear function with
|
||||
|
||||
@@ -47,6 +47,8 @@ public:
|
||||
|
||||
Pwl();
|
||||
Pwl(const std::vector<Point> &points);
|
||||
Pwl(std::vector<Point> &&points);
|
||||
|
||||
int readYaml(const libcamera::YamlObject ¶ms);
|
||||
|
||||
void append(double x, double y, double eps = 1e-6);
|
||||
|
||||
Reference in New Issue
Block a user