[v2,0/5] libcamera: controls: Move constructor/assignment + swap
mbox series

Message ID 20250421153556.171192-1-barnabas.pocze@ideasonboard.com
Headers show
Series
  • libcamera: controls: Move constructor/assignment + swap
Related show

Message

Barnabás Pőcze April 21, 2025, 3:35 p.m. UTC
Implement move constructor / assignment operator for `ControlValue`
since the type already has an "empty" state that can be used for
this purpose. Also add `swap()` since that can also be implemented
more efficiently than the default move construction + 2 move assignment
that `std::swap()` implements. And lastly add an rvalue overload
for `ControlList::set()` to make use of move assignment.

changes in v2:
  * remove `numElements_` bit field to simplify swap
  * add `ControlList::set(unsigned int, ControlValue&&)` overload

v1: https://patchwork.libcamera.org/project/libcamera/list/?series=5131

Barnabás Pőcze (5):
  libcamera: controls: Give name to the union containing storage
  libcamera: controls: Replace `numElements_` bit field
  libcamera: controls: Implement move ctor/assignment
  libcamera: controls: Implement `swap()`
  libcamera: controls: Add rvalue overload for `ControlList::set()`

 include/libcamera/controls.h | 54 ++++++++++++++++++++++++++++---
 src/libcamera/controls.cpp   | 62 ++++++++++++++++++++++++++++++------
 2 files changed, 103 insertions(+), 13 deletions(-)

--
2.49.0

Comments

Barnabás Pőcze Sept. 1, 2026, 7:27 a.m. UTC | #1
Hi Laurent

Given that this is a very public facing component, do you consider this
ok to be merged? Or do you see any issues with it?


Thanks,
Barnabás Pőcze

2025. 04. 21. 17:35 keltezéssel, Barnabás Pőcze írta:
> Implement move constructor / assignment operator for `ControlValue`
> since the type already has an "empty" state that can be used for
> this purpose. Also add `swap()` since that can also be implemented
> more efficiently than the default move construction + 2 move assignment
> that `std::swap()` implements. And lastly add an rvalue overload
> for `ControlList::set()` to make use of move assignment.
> 
> changes in v2:
>    * remove `numElements_` bit field to simplify swap
>    * add `ControlList::set(unsigned int, ControlValue&&)` overload
> 
> v1: https://patchwork.libcamera.org/project/libcamera/list/?series=5131
> 
> Barnabás Pőcze (5):
>    libcamera: controls: Give name to the union containing storage
>    libcamera: controls: Replace `numElements_` bit field
>    libcamera: controls: Implement move ctor/assignment
>    libcamera: controls: Implement `swap()`
>    libcamera: controls: Add rvalue overload for `ControlList::set()`
> 
>   include/libcamera/controls.h | 54 ++++++++++++++++++++++++++++---
>   src/libcamera/controls.cpp   | 62 ++++++++++++++++++++++++++++++------
>   2 files changed, 103 insertions(+), 13 deletions(-)
> 
> --
> 2.49.0