summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2025-01-08 11:09:34 +0000
committerKieran Bingham <kieran.bingham@ideasonboard.com>2025-01-08 12:30:58 +0000
commita45de8e81b1b8a8f3ae2bfe531062ee294082a12 (patch)
tree7b9255ea170be81b5da74487fd9f636152ad0eda
parent031a57bcd2bb5b85b8085e25ac7d54cea17f5348 (diff)
ipa: rpi: Add erase()/eraseLocked() to RPiController::Metadata
These functions erase a key/value pair from the metadata object. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--src/ipa/rpi/controller/metadata.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/ipa/rpi/controller/metadata.h b/src/ipa/rpi/controller/metadata.h
index b8844909..77d3b074 100644
--- a/src/ipa/rpi/controller/metadata.h
+++ b/src/ipa/rpi/controller/metadata.h
@@ -91,6 +91,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)
{
@@ -111,6 +117,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.