@@ -14,6 +14,7 @@
#include <stdint.h>
#include <string>
#include <unordered_map>
+#include <utility>
#include <vector>
#include <libcamera/base/class.h>
@@ -165,6 +166,31 @@ public:
ControlValue(const ControlValue &other);
ControlValue &operator=(const ControlValue &other);
+ ControlValue(ControlValue &&other) noexcept
+ : type_(other.type_),
+ isArray_(std::exchange(other.isArray_, false)),
+ numElements_(std::exchange(other.numElements_, 0)),
+ storage_(std::exchange(other.storage_, {}))
+ {
+ other.type_ = ControlTypeNone;
+ }
+
+ ControlValue &operator=(ControlValue &&other) noexcept
+ {
+ if (this != &other) {
+ release();
+
+ type_ = other.type_;
+ isArray_ = std::exchange(other.isArray_, false);
+ numElements_ = std::exchange(other.numElements_, 0);
+ storage_ = std::exchange(other.storage_, {});
+
+ other.type_ = ControlTypeNone;
+ }
+
+ return *this;
+ }
+
ControlType type() const { return type_; }
bool isNone() const { return type_ == ControlTypeNone; }
bool isArray() const { return isArray_; }
@@ -155,6 +155,24 @@ ControlValue &ControlValue::operator=(const ControlValue &other)
return *this;
}
+/**
+ * \fn ControlValue::ControlValue(ControlValue &&other) noexcept
+ * \brief Move constructor for ControlValue
+ * \param[in] other The ControlValue object to move from
+ *
+ * Move constructs a ControlValue instance from \a other.
+ * After this operation \a other will be in the same state
+ * as a default constructed ControlValue instance.
+ */
+
+/**
+ * \fn ControlValue &ControlValue::operator=(ControlValue &&other) noexcept
+ * \brief Move assignment operator for ControlValue
+ * \param[in] other The ControlValue object to move from
+ *
+ * \sa ControlValue::ControlValue(ControlValue &&other)
+ */
+
/**
* \fn ControlValue::type()
* \brief Retrieve the data type of the value