mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-15 16:35:06 +03:00
ipa: raspberrypi: Add move/copy ctors and operators to Metadata class
Add a default, move and copy constructor as well as a move operator implementation RPiController::Metadata class. 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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
7de2bbed9b
commit
2bbd1e4766
1 changed files with 23 additions and 0 deletions
|
@ -19,6 +19,21 @@ namespace RPiController {
|
|||
class Metadata
|
||||
{
|
||||
public:
|
||||
Metadata() = default;
|
||||
|
||||
Metadata(Metadata const &other)
|
||||
{
|
||||
std::scoped_lock other_lock(other.mutex_);
|
||||
data_ = other.data_;
|
||||
}
|
||||
|
||||
Metadata(Metadata &&other)
|
||||
{
|
||||
std::scoped_lock other_lock(other.mutex_);
|
||||
data_ = std::move(other.data_);
|
||||
other.data_.clear();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void Set(std::string const &tag, T const &value)
|
||||
{
|
||||
|
@ -50,6 +65,14 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
Metadata &operator=(Metadata &&other)
|
||||
{
|
||||
std::scoped_lock lock(mutex_, other.mutex_);
|
||||
data_ = std::move(other.data_);
|
||||
other.data_.clear();
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T *GetLocked(std::string const &tag)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue