11 #ifndef LARDATA_RECOBASEPROXY_PROXYBASE_COLLECTIONPROXY_H 12 #define LARDATA_RECOBASEPROXY_PROXYBASE_COLLECTIONPROXY_H 32 template <
typename Cont>
35 template <
template <
typename,
typename...>
class F,
typename...>
113 template <
typename CollProxy>
class Element,
174 return details::makeCollectionProxyElement<element_proxy_t>
175 (i, getMainAt(i), aux<AuxColls>().
operator[](i)...);
192 template <
typename AuxTag>
193 auto get()
const -> decltype(
auto) {
return auxByTag<AuxTag>(); }
246 template <
typename Tag,
typename T = std::vector<Tag> const&>
247 auto getIf()
const -> decltype(
auto);
251 template <
typename Tag>
252 static constexpr
bool has()
253 {
return util::has_tag_v<Tag, aux_collections_t>; }
258 using main_collection_proxy_t::mainProxy;
259 using main_collection_proxy_t::getMainAt;
262 template <
typename AuxColl>
263 AuxColl
const&
aux()
const {
return static_cast<AuxColl const&
>(*this); }
266 template <
typename AuxTag>
268 {
return aux<util::type_with_tag_t<AuxTag, aux_collections_t>>(); }
271 template <
typename Tag,
typename>
273 template <
typename Tag,
typename T>
281 "Some auxiliary data collections share the same tag. They should not.");
296 template <
typename MainColl,
typename... AuxColls>
303 template <
typename... Args>
317 template <
typename...>
class CollProxy,
318 typename MainColl,
typename... AuxColl
322 return CollProxy<MainColl, AuxColl...>
323 (
main, std::forward<AuxColl>(aux)...);
328 template <
typename MainColl,
typename... AuxColl>
331 return createCollectionProxy<CollectionProxy>
332 (
main, std::forward<AuxColl>(aux)...);
342 template <
typename Cont>
356 : fCont(&cont), fIndex(index) {}
360 {
return fCont->operator[](fIndex); }
367 {
return (other.
fIndex != fIndex) || (other.
fCont != fCont); }
391 template <
typename,
typename...>
class F,
392 typename First,
typename... Others
395 {
using type = F<First, Others...>; };
404 template <
typename CollProxy>
class Element,
408 template <
typename Tag,
typename T>
415 template <
typename CollProxy>
class Element,
419 template <
typename Tag,
typename>
422 {
return get<Tag>(); }
425 template <
typename CollProxy>
class Element,
429 template <
typename Tag,
typename T>
433 throw std::logic_error
434 (
"Tag '" + lar::debug::demangle<Tag>() +
"' not available.");
443 #endif // LARDATA_RECOBASEPROXY_PROXYBASE_COLLECTIONPROXY_H const_iterator begin() const
Returns an iterator to the first element of the collection.
std::tuple< AuxColls... > aux_collections_t
Tuple of all auxiliary data collections (wrappers).
util::collection_value_t< MainColl > main_element_t
Type of the elements in the original collection.
std::size_t fIndex
Current index in the main collection.
CollectionProxyBase< CollectionProxyElement, MainColl, AuxColls... > CollectionProxy
Base representation of a collection of proxied objects.
typename details::TemplateAdaptorOnePlus< CollectionProxy, Args... >::type CollectionProxyFromArgs
int main(int argc, char **argv)
CollectionProxyBase(main_collection_t const &main, AuxColls &&...aux)
Constructor: uses the specified data.
auto auxByTag() const -> decltype(auto)
Returns the auxiliary data specified by type.
Iterator to random access collection storing a current index.
Base representation of a collection of proxied objects.
Wrapper for the main collection of a proxy.
auto makeCollectionProxy(MainColl const &main, AuxColl &&...aux)
Creates a CollectionProxy object with the given arguments.
auto createCollectionProxy(MainColl const &main, AuxColl &&...aux)
Creates a collection proxy of a specified type with the given arguments.
const_iterator makeIterator(std::size_t i) const
Returns an iterator pointing to the specified index of this collection.
Proxy class for charged space point proxy elements.
bool empty() const
Returns whether this collection is empty.
Utilities for the main collection of a collection proxy.
Utilities for a single element of a collection proxy.
Encloses LArSoft data product proxy objects and utilities.See this doxygen module for an introduction...
auto getIfHas(util::bool_constant< true >) const -> decltype(auto)
MainColl main_collection_t
Type of the original collection.
bool operator!=(AssnsNode< ArtAssnsIterValue > const &A, typename AssnsNode< ArtAssnsIterValue >::valueptr_t const &B)
const_iterator end() const
Returns an iterator past the last element of the collection.
container_t const * fCont
Pointer to the original container.
IndexBasedIterator(container_t const &cont, std::size_t index=0)
Constructor: initializes from an iterator of the proxy main collection.
std::size_t size() const
Returns the size of this collection.
static constexpr bool has()
Returns whether this class knowns about the specified type (Tag).
An element of a collection proxy.
Utilities to address elements of a tuple-like class by tag.
util::collection_value_t< container_t > value_type
F< First, Others... > type
AuxColl const & aux() const
Returns the auxiliary data specified by type.
QuadExpr operator*(double v, const QuadExpr &e)
auto getIf() const -> decltype(auto)
Returns the auxiliary data specified by type (Tag).