Skip to content

Commit 087f0c3

Browse files
naushirpinchartl
authored andcommitted
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 <[email protected]> Reviewed-by: Kieran Bingham <[email protected]> Reviewed-by: David Plowman <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]>
1 parent 33abc2b commit 087f0c3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/ipa/raspberrypi/controller/metadata.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ class LIBCAMERA_TSA_CAPABILITY("mutex") Metadata
8080
data_.merge(other.data_);
8181
}
8282

83+
void mergeCopy(const Metadata &other)
84+
{
85+
std::scoped_lock lock(mutex_, other.mutex_);
86+
/*
87+
* If the metadata key exists, ignore this item and copy only
88+
* unique key/value pairs.
89+
*/
90+
data_.insert(other.data_.begin(), other.data_.end());
91+
}
92+
8393
template<typename T>
8494
T *getLocked(std::string const &tag)
8595
{

0 commit comments

Comments
 (0)