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-02-14 17:02:18 +02:00
parent 5eaf4fed19
commit 300f6e4434
2 changed files with 29 additions and 1 deletions

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: