libcamera: controls: Add policy parameter to ControlList::merge()

This is useful in many cases although not included in the stl.

Note: This is an ABI incompatible change.

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
This commit is contained in:
Stefan Klug
2024-03-12 17:04:28 +01:00
parent 2e2ba223f3
commit d54abd32af
3 changed files with 73 additions and 4 deletions
+6 -1
View File
@@ -352,6 +352,11 @@ private:
using ControlListMap = std::unordered_map<unsigned int, ControlValue>;
public:
enum class MergePolicy {
KeepExisting = 0,
OverwriteExisting,
};
ControlList();
ControlList(const ControlIdMap &idmap, const ControlValidator *validator = nullptr);
ControlList(const ControlInfoMap &infoMap, const ControlValidator *validator = nullptr);
@@ -368,7 +373,7 @@ public:
std::size_t size() const { return controls_.size(); }
void clear() { controls_.clear(); }
void merge(const ControlList &source);
void merge(const ControlList &source, MergePolicy policy = MergePolicy::KeepExisting);
bool contains(unsigned int id) const;