Message ID | 20241213094602.2083174-3-naush@raspberrypi.com |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi Naush Thanks for the patch. On Fri, 13 Dec 2024 at 09:46, Naushir Patuck <naush@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@raspberrypi.com> Thanks! David > > Signed-off-by: Naushir Patuck <naush@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 >
On Fri, Dec 13, 2024 at 10:05:05AM +0000, David Plowman wrote: > Hi Naush > > Thanks for the patch. > > On Fri, 13 Dec 2024 at 09:46, Naushir Patuck <naush@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@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > > > Signed-off-by: Naushir Patuck <naush@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.
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.
These function erases a key/value pair from the metadata object. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> --- src/ipa/rpi/controller/metadata.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)