diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/libcamera/controls.h | 81 |
1 files changed, 68 insertions, 13 deletions
diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 4538be06..1e24ae30 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -9,6 +9,7 @@ #define __LIBCAMERA_CONTROLS_H__ #include <assert.h> +#include <stdint.h> #include <string> #include <unordered_map> @@ -51,6 +52,10 @@ struct control_type<int64_t> { static constexpr ControlType value = ControlTypeInteger64; }; +template<typename T, std::size_t N> +struct control_type<Span<T, N>> : public control_type<std::remove_cv_t<T>> { +}; + } /* namespace details */ class ControlValue @@ -58,15 +63,35 @@ class ControlValue public: ControlValue(); +#ifndef __DOXYGEN__ + template<typename T, typename std::enable_if_t<!details::is_span<T>::value, std::nullptr_t> = nullptr> + ControlValue(const T &value) + : type_(ControlTypeNone), numElements_(0) + { + set(details::control_type<std::remove_cv_t<T>>::value, false, + &value, 1, sizeof(T)); + } + + template<typename T, typename std::enable_if_t<details::is_span<T>::value, std::nullptr_t> = nullptr> +#else template<typename T> - ControlValue(T value) - : type_(details::control_type<std::remove_cv_t<T>>::value) +#endif + ControlValue(const T &value) + : type_(ControlTypeNone), numElements_(0) { - *reinterpret_cast<T *>(&bool_) = value; + set(details::control_type<std::remove_cv_t<T>>::value, true, + value.data(), value.size(), sizeof(typename T::value_type)); } + ~ControlValue(); + + ControlValue(const ControlValue &other); + ControlValue &operator=(const ControlValue &
['timer-thread', 'timer-thread.cpp'],
['utils', 'utils.cpp'],
]
foreach t : public_tests
exe = executable(t[0], t[1],
dependencies : libcamera_public,
link_with : test_libraries,
include_directories : test_includes_public)
test(t[0], exe)
endforeach
foreach t : internal_tests
exe = executable(t[0], t[1],
dependencies : libcamera_private,
link_with : test_libraries,
include_directories : test_includes_internal)
test(t[0], exe)
endforeach
|