diff options
author | Paul Elder <paul.elder@ideasonboard.com> | 2022-08-03 19:51:06 +0900 |
---|---|---|
committer | Paul Elder <paul.elder@ideasonboard.com> | 2022-10-18 18:51:33 +0900 |
commit | 207c9e1c1d73dc062d68bf0dbb27a0b58c7581a2 (patch) | |
tree | d6c56ad0476363441d95bfba80dd5f4e848b68ab /include | |
parent | fc6b5f49e176b7b8750175e2eb37825f5919b6d9 (diff) |
utils: ipc: Add support for Flags
Add Flags<E> as a supported type in the IPA interface.
It is used in mojom with the [flags] attribute. Any field or parameter
type E that is prefixed with the [flags] attribute will direct the code
generator to generate the type name "Flags<E>" and appropriate
serialization/deserialization code for Flags<E> instead of for E.
It is usable and has been tested in struct members, function input and
output parameters, and Signal parameters. This does not add support for
returning Flags as direct return values.
Additionally, the [scopedEnum] attribute can be used on enum
definitions, which will instruct the code generator to convert it to an
enum class instead of a raw enum.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/libcamera/ipa/core.mojom | 9 | ||||
-rw-r--r-- | include/libcamera/ipa/ipa_interface.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/include/libcamera/ipa/core.mojom b/include/libcamera/ipa/core.mojom index 2bc3028c..33b8abed 100644 --- a/include/libcamera/ipa/core.mojom +++ b/include/libcamera/ipa/core.mojom @@ -33,6 +33,15 @@ module libcamera; * available for the type and there's no need to generate one * - hasFd - struct fields or empty structs only * - Designate that this field or empty struct contains a SharedFD + * - scopedEnum - enum definitions + * - Designate that this enum should be an enum class, as opposed to a pure + * enum + * - flags - struct fields or function parameters that are enums + * - Designate that this enum type E should be Flags<E> in the generated C++ + * code + * - For example, if a struct field is defined as `[flags] ErrorFlag f;` + * (where ErrorFlag is defined as an enum elsewhere in mojom), then the + * generated code for this field will be `Flags<ErrorFlag> f` * * Rules: * - If the type is defined in a libcamera C++ header *and* a (de)serializer is diff --git a/include/libcamera/ipa/ipa_interface.h b/include/libcamera/ipa/ipa_interface.h index 50ca0e7b..8afcfe21 100644 --- a/include/libcamera/ipa/ipa_interface.h +++ b/include/libcamera/ipa/ipa_interface.h @@ -13,6 +13,7 @@ #include <map> #include <vector> +#include <libcamera/base/flags.h> #include <libcamera/base/signal.h> #include <libcamera/controls.h> |