11 #ifndef LARDATA_RECOBASEPROXY_PROXYBASE_COLLECTIONPROXYELEMENT_H 12 #define LARDATA_RECOBASEPROXY_PROXYBASE_COLLECTIONPROXYELEMENT_H 23 #include <type_traits> 30 template <
typename AuxCollTuple>
157 template <
typename CollProxy>
171 : fIndex(index), fMain(&main), fAuxData(
std::move(auxData))
181 std::size_t
index()
const {
return fIndex; };
184 template <
typename Tag>
185 auto get()
const -> decltype(
auto)
187 return std::get<util::index_of_tag_v<Tag, aux_elements_t>>(fAuxData);
260 template <
typename Tag,
typename T = Tag const&>
261 [[deprecated(
"Use C++17 constexpr if instead and get() instead")]]
auto getIf()
const 265 template <
typename Tag>
266 static constexpr
bool has()
268 return util::has_tag_v<Tag, aux_elements_t>;
279 template <
typename Tag,
typename>
280 auto getIfHas(std::bool_constant<true>) const -> decltype(auto);
282 template <typename Tag, typename T>
305 template <
typename ProxyElement,
typename... AuxData>
307 typename ProxyElement::main_element_t
const&
main,
308 AuxData&&... auxData)
311 index, main,
typename ProxyElement::aux_elements_t(std::forward<AuxData>(auxData)...));
332 template <
typename Tuple>
337 template <
typename... T>
339 using type = std::tuple<
typename T::auxiliary_data_t...>;
349 template <
typename CollProxy>
350 template <
typename Tag,
typename T>
353 return getIfHas<Tag, T>(std::bool_constant<has<Tag>()>{});
357 template <
typename CollProxy>
358 template <
typename Tag,
typename>
364 template <
typename CollProxy>
365 template <
typename Tag,
typename T>
368 throw std::logic_error(
"Tag '" + lar::debug::demangle<Tag>() +
"' not available.");
375 #endif // LARDATA_RECOBASEPROXY_PROXYBASE_COLLECTIONPROXYELEMENT_H main_element_t const * operator->() const
Returns a pointer to the main element.
auto makeCollectionProxyElement(std::size_t index, typename ProxyElement::main_element_t const &main, AuxData &&...auxData)
Creates a collection proxy element object from data structures.
typename collection_proxy_t::main_element_t main_element_t
std::integral_constant< bool, Value > bool_constant
auto getIfHas(std::bool_constant< true >) const -> decltype(auto)
aux_elements_t fAuxData
Data associated to the main object.
typename details::SubstituteWithAuxList< typename collection_proxy_t::aux_collections_t >::type aux_elements_t
Tuple of elements (expected to be tagged types).
static constexpr bool has()
Returns whether this class knowns about the specified type (Tag).
main_element_t const * fMain
Pointer to the main object of the element.
CollProxy collection_proxy_t
Encloses LArSoft data product proxy objects and utilities.See this doxygen module for an introduction...
std::size_t index() const
Returns the index of this element in the collection.
std::size_t fIndex
Index of this element in the proxy.
A std::true_type with a template argument.
An element of a collection proxy.
Functions to help debugging by instrumenting code.
Utilities to address elements of a tuple-like class by tag.
auto getIf() const -> decltype(auto)
Returns the auxiliary data specified by type (Tag).
main_element_t const & operator*() const
Returns a reference to the main element.
CollectionProxyElement(std::size_t index, main_element_t const &main, aux_elements_t &&auxData)