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>
This commit is contained in:
Laurent Pinchart
2020-03-06 18:10:21 +02:00
parent 5eaf4fed19
commit 300f6e4434
2 changed files with 29 additions and 1 deletions
+1 -1
View File
@@ -881,7 +881,7 @@ EXCLUDE_SYMBOLS = libcamera::BoundMethodArgs \
libcamera::BoundMethodStatic \
libcamera::SignalBase \
libcamera::*::Private \
libcamera::*::details::* \
*::details::* \
std::*
# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+28
View File
@@ -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: