Message ID | 20220803112150.3040287-4-paul.elder@ideasonboard.com |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi Paul, Thank you for the patch. On Wed, Aug 03, 2022 at 08:21:44PM +0900, Paul Elder via libcamera-devel wrote: > To prepare for the ability to send Flags over IPC, add IPADataSerializer > as a friend class to Flags. > > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> > --- > include/libcamera/base/flags.h | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/include/libcamera/base/flags.h b/include/libcamera/base/flags.h > index a1b404bd..43afdf26 100644 > --- a/include/libcamera/base/flags.h > +++ b/include/libcamera/base/flags.h > @@ -137,6 +137,9 @@ public: > } > > private: > + template<typename> > + friend class IPADataSerializer; I'd rather not do this, to avoid exposing internals in the public API. You can convert a Flags to the raw value with operator Type(), which is called by static_cast<Flags<...>::Type>(flags) I however suspect you need the friend statement for the other way around. I think you can use the Flags(E flag) constructor then, casting the deserialized uint32_t to a E first. > + > Type value_; > }; >
diff --git a/include/libcamera/base/flags.h b/include/libcamera/base/flags.h index a1b404bd..43afdf26 100644 --- a/include/libcamera/base/flags.h +++ b/include/libcamera/base/flags.h @@ -137,6 +137,9 @@ public: } private: + template<typename> + friend class IPADataSerializer; + Type value_; };
To prepare for the ability to send Flags over IPC, add IPADataSerializer as a friend class to Flags. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> --- include/libcamera/base/flags.h | 3 +++ 1 file changed, 3 insertions(+)