@@ -19,6 +19,21 @@ namespace RPiController {
class Metadata
{
public:
+ Metadata() = default;
+
+ Metadata(Metadata const &other)
+ {
+ std::lock_guard<std::mutex> other_lock(other.mutex_);
+ data_ = other.data_;
+ }
+
+ Metadata(Metadata &&other)
+ {
+ std::lock_guard<std::mutex> other_lock(other.mutex_);
+ data_ = std::move(other.data_);
+ other.data_.clear();
+ }
+
template<typename T>
void Set(std::string const &tag, T const &value)
{
@@ -51,6 +66,15 @@ public:
return *this;
}
+ Metadata &operator=(Metadata &&other)
+ {
+ std::lock_guard<std::mutex> lock(mutex_);
+ std::lock_guard<std::mutex> other_lock(other.mutex_);
+ data_ = std::move(other.data_);
+ other.data_.clear();
+ return *this;
+ }
+
template<typename T>
T *GetLocked(std::string const &tag)
{