summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-02-14 17:02:18 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-06 18:10:21 +0200
commit300f6e44345f5cb7bfe9aece6c6c5b5c0894487b (patch)
tree9beb8eb98ffef5303cacd379424519442c2fe0b6 /include
parent5eaf4fed19909a954281a8b37bf5297b3cb2815f (diff)
libcamera: controls: Add templates to convert a type T to a ControlType
These will be used to implement ControlValue::get() and set() as template functions. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/controls.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
index 3b6b231c..429f01b0 100644
--- a/include/libcamera/controls.h
+++ b/include/libcamera/controls.h
@@ -22,6 +22,34 @@ enum ControlType {
ControlTypeInteger64,
};
+namespace details {
+
+template<typename T>
+struct control_type {
+};
+
+template<>
+struct control_type<void> {
+ static constexpr ControlType value = ControlTypeNone;
+};
+
+template<>
+struct control_type<bool> {
+ static constexpr ControlType value = ControlTypeBool;
+};
+
+template<>
+struct control_type<int32_t> {
+ static constexpr ControlType value = ControlTypeInteger32;
+};
+
+template<>
+struct control_type<int64_t> {
+ static constexpr ControlType value = ControlTypeInteger64;
+};
+
+} /* namespace details */
+
class ControlValue
{
public: