-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it possible to store components in UserData collections #525
Conversation
include/podio/UserDataCollection.h
Outdated
*/ | ||
template <typename T> | ||
using EnableIfSupportedUserType = std::enable_if_t<detail::isInTuple<T, SupportedUserDataTypes>>; | ||
using EnableIfSupportedUserType = | ||
std::enable_if_t<detail::isInTuple<T, SupportedUserDataTypes> || detail::isComponent<T>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any chance this could be exposed as a public compile-time boolean? I can use the detail
namespace of course, but would be nice to use public API only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean the isComponent
, or the whole expression in the enable_if
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally the whole expression. The type tuple is already public so with my own isInTuple
I can use it, but there's no good way to check if a type is a component from the outside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. We also do the same in our GenericParameters
so I don't see a reason to not do this here as well. Plus in this way we can keep the isComponent
bit in detail
and not expose that directly.
21b38f1
to
948393e
Compare
Closing this for now, as we don't have plans for really implementing this as it is more or less possible to do a similar thing with a normal datatype. In your case I suppose the major point was the interoperability with |
I suppose the main difference is how to discover if a data type is valid for writing like this. If I add another mechanism to flag other types as being available in the edm, then indeed it should be possible to add them in the required way. The other benefit of |
Really? That is probably a bug then, as it's at least not intended to be able to mutate objects after they have been read / obtained from a Frame. |
No the mutable references are just available for non-const references to What I was referring to is the interface restriction of datatypes, which allow getting a const reference via |
BEGINRELEASENOTES
component
s inUserDataCollection
s.ENDRELEASENOTES
This is a sort of compromise between being very strict and allowing only a few builtin types to be stored in UserData collections and opening them up for more or less arbitrary (POD) structs. It gives us a bit of control and we can pretty easily generate the necessary I/O code for things that are not just builtin types.
@paulgessinger this would be a prototype version of the functionality that we discussed briefly.