summaryrefslogtreecommitdiff
path: root/src/ipa/raspberrypi/controller
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2022-11-15 09:07:52 +0000
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-11-29 17:16:47 +0200
commit087f0c3c42d3f350c193f03e6141f16b6f41f70c (patch)
tree46884265db72edbbc5d1da934585a35e9cfd40c9 /src/ipa/raspberrypi/controller
parent33abc2b31e9fa53eb903fe5408c81255dfdd3953 (diff)
ipa: raspberrypi: Add RPiController::Metadata::mergeCopy
Add a new member function to RPiController::Metadata that copies unique key/value pairs from one object to the other. This is different from std::map::merge that would remove the key/value pairs from the source object. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/ipa/raspberrypi/controller')
-rw-r--r--src/ipa/raspberrypi/controller/metadata.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ipa/raspberrypi/controller/metadata.h b/src/ipa/raspberrypi/controller/metadata.h
index 870b6e26..bf8a2393 100644
--- a/src/ipa/raspberrypi/controller/metadata.h
+++ b/src/ipa/raspberrypi/controller/metadata.h
@@ -80,6 +80,16 @@ public:
data_.merge(other.data_);
}
+ void mergeCopy(const Metadata &other)
+ {
+ std::scoped_lock lock(mutex_, other.mutex_);
+ /*
+ * If the metadata key exists, ignore this item and copy only
+ * unique key/value pairs.
+ */
+ data_.insert(other.data_.begin(), other.data_.end());
+ }
+
template<typename T>
T *getLocked(std::string const &tag)
{