Skip to content

Commit

Permalink
Provide static bool to check for user data support
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Dec 5, 2023
1 parent d72b971 commit 9366ad5
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions include/podio/UserDataCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,19 @@ using SupportedUserDataTypes =
std::tuple<float, double, int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t>;

/**
* Alias template to be used to enable template specializations only for the
* types listed in the SupportedUserDataTypes list or if they are components
* that were generated by podio
* Static bool for determining whether a type T is a supported user data type.
* Effectively boils down to being listed in SupportedUserDataTypes or being a
* component of an EDM generated by podio.
*/
template <typename T>
using EnableIfSupportedUserType =
std::enable_if_t<detail::isInTuple<T, SupportedUserDataTypes> || detail::isComponent<T>>;
constexpr static bool isSupportedUserDataType = detail::isInTuple<T, SupportedUserDataTypes> || detail::isComponent<T>;

/**
* Alias template to be used to enable template specializations only for types
* that are actually supported user data types
*/
template <typename T>
using EnableIfSupportedUserType = std::enable_if_t<isSupportedUserDataType<T>>;

/** helper template to provide readable type names for basic types with macro PODIO_ADD_USER_TYPE(type)
*/
Expand Down

0 comments on commit 9366ad5

Please sign in to comment.