[PATCH 2/6] ipa: rpi: Add erase()/eraseLocked() to RPiController::Metadata
David Plowman
david.plowman at raspberrypi.com
Fri Dec 13 11:05:05 CET 2024
Hi Naush
Thanks for the patch.
On Fri, 13 Dec 2024 at 09:46, Naushir Patuck <naush at raspberrypi.com> wrote:
>
> These function erases a key/value pair from the metadata object.
At the risk of nit-picking horribly...
s/These function erases/These functions erase/
But otherwise
Reviewed-by: David Plowman <david.plowman at raspberrypi.com>
Thanks!
David
>
> Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
> ---
> src/ipa/rpi/controller/metadata.h | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/src/ipa/rpi/controller/metadata.h b/src/ipa/rpi/controller/metadata.h
> index eda4b59bca9a..62e54051f8f4 100644
> --- a/src/ipa/rpi/controller/metadata.h
> +++ b/src/ipa/rpi/controller/metadata.h
> @@ -90,6 +90,12 @@ public:
> data_.insert(other.data_.begin(), other.data_.end());
> }
>
> + void erase(std::string const &tag)
> + {
> + std::scoped_lock lock(mutex_);
> + eraseLocked(tag);
> + }
> +
> template<typename T>
> T *getLocked(std::string const &tag)
> {
> @@ -110,6 +116,14 @@ public:
> data_[tag] = std::forward<T>(value);
> }
>
> + void eraseLocked(std::string const &tag)
> + {
> + auto it = data_.find(tag);
> + if (it == data_.end())
> + return;
> + data_.erase(it);
> + }
> +
> /*
> * Note: use of (lowercase) lock and unlock means you can create scoped
> * locks with the standard lock classes.
> --
> 2.43.0
>
More information about the libcamera-devel
mailing list