[libcamera-devel] [PATCH v3 2/6] cam: options: Add public method to invalidate options
Niklas Söderlund
niklas.soderlund at ragnatech.se
Fri May 1 04:34:28 CEST 2020
Extend OptionsBase<T> with a public invalidate() method. This allows for
further examination of the options and if found unsuitable be
invalidated. The intended user for this new interface are subclasses of
KeyValueParser.
Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
src/cam/options.cpp | 6 ++++++
src/cam/options.h | 2 ++
2 files changed, 8 insertions(+)
diff --git a/src/cam/options.cpp b/src/cam/options.cpp
index 2c56eacf006e9857..77b3cc1f8c5a59e9 100644
--- a/src/cam/options.cpp
+++ b/src/cam/options.cpp
@@ -64,6 +64,12 @@ const OptionValue &OptionsBase<T>::operator[](const T &opt) const
return values_.find(opt)->second;
}
+template<typename T>
+void OptionsBase<T>::invalidate()
+{
+ valid_ = false;
+}
+
template<typename T>
bool OptionsBase<T>::parseValue(const T &opt, const Option &option,
const char *optarg)
diff --git a/src/cam/options.h b/src/cam/options.h
index ad5c93a4fabd089f..184866195eef990a 100644
--- a/src/cam/options.h
+++ b/src/cam/options.h
@@ -54,6 +54,8 @@ public:
bool isSet(const T &opt) const;
const OptionValue &operator[](const T &opt) const;
+ void invalidate();
+
private:
friend class KeyValueParser;
friend class OptionsParser;
--
2.26.2
More information about the libcamera-devel
mailing list