From 224ef9776ac5be51f984780c761713027f2c6102 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 28 Sep 2019 00:40:51 +0300 Subject: libcamera: controls: Make ControlValue get/set accessors template methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ControlValue get accessors are implemented with functions of different names, whlie the set accessors use polymorphism to support different control types. This isn't very consistent and intuitive. Make the API clearer by using template methods. This will also have the added advantage that support for the new types will only require adding template specialisations, without adding new methods. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Reviewed-by: Niklas Söderlund --- include/libcamera/controls.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'include/libcamera') diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index ffba880a..0886370f 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -36,13 +36,10 @@ public: ControlType type() const { return type_; }; bool isNone() const { return type_ == ControlTypeNone; }; - void set(bool value); - void set(int value); - void set(int64_t value); - - bool getBool() const; - int getInt() const; - int64_t getInt64() const; + template + const T &get() const; + template + void set(const T &value); std::string toString() const; -- cgit v1.2.1