LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
MainCollectionProxy.h
Go to the documentation of this file.
1 
11 #ifndef LARDATA_RECOBASEPROXY_PROXYBASE_MAINCOLLECTIONPROXY_H
12 #define LARDATA_RECOBASEPROXY_PROXYBASE_MAINCOLLECTIONPROXY_H
13 
14 // LArSoft libraries
15 #include "larcorealg/CoreUtils/ContainerMeta.h" // util::collection_value_t, ...
16 
17 // C/C++ standard
18 #include <cstdlib> // std::size_t
19 
20 namespace proxy {
21 
22  //----------------------------------------------------------------------------
23  namespace details {
24 
25  //--------------------------------------------------------------------------
26  //--- stuff for the main collection
27  //--------------------------------------------------------------------------
37  template <typename MainColl>
39 
41  using main_collection_t = MainColl;
42 
45 
48 
50  main_collection_t const& main() const { return mainRef(); }
51 
53  main_collection_t const& mainRef() const { return *fMain; }
54 
56  main_collection_t const* mainPtr() const { return fMain; }
57 
58  protected:
61 
63  this_t& mainProxy() { return *this; }
64 
66  this_t const& mainProxy() const { return *this; }
67 
69  auto getMainAt(std::size_t i) const -> decltype(auto) { return fMain->operator[](i); }
70 
71  private:
73 
74  }; // struct MainCollectionProxy<>
75 
76  //--------------------------------------------------------------------------
77 
78  } // namespace details
79 
80 } // namespace proxy
81 
82 #endif // LARDATA_RECOBASEPROXY_PROXYBASE_MAINCOLLECTIONPROXY_H
auto getMainAt(std::size_t i) const -> decltype(auto)
Returns the specified item in the original collection.
util::collection_value_t< MainColl > main_element_t
Type of the elements in the original collection.
main_collection_t const & main() const
Returns the wrapped collection.
main_collection_t const * mainPtr() const
Returns a pointer to the wrapped collection.
Wrapper for the main collection of a proxy.
Encloses LArSoft data product proxy objects and utilities.See this doxygen module for an introduction...
this_t & mainProxy()
Return this object as main collection proxy.
MainColl main_collection_t
Type of the original collection.
this_t const & mainProxy() const
Return this object as main collection proxy.
MainCollectionProxy(main_collection_t const &main)
Constructor: wraps the specified collection.
main_collection_t const & mainRef() const
Returns a reference to the wrapped collection.
typename collection_value_type< Coll >::type collection_value_t
Type contained in the collection Coll.
Definition: ContainerMeta.h:62
C++ metaprogramming utilities for dealing with containers.