LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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 
21 
22 namespace proxy {
23 
24  //----------------------------------------------------------------------------
25  namespace details {
26 
27  //--------------------------------------------------------------------------
28  //--- stuff for the main collection
29  //--------------------------------------------------------------------------
39  template <typename MainColl>
41 
43  using main_collection_t = MainColl;
44 
47 
50 
52  main_collection_t const& main() const { return mainRef(); }
53 
55  main_collection_t const& mainRef() const { return *fMain; }
56 
58  main_collection_t const* mainPtr() const { return fMain; }
59 
60 
61  protected:
64 
66  this_t& mainProxy() { return *this; }
67 
69  this_t const& mainProxy() const { return *this; }
70 
72  auto getMainAt(std::size_t i) const -> decltype(auto)
73  { return fMain->operator[](i); }
74 
75  private:
77 
78  }; // struct MainCollectionProxy<>
79 
80 
81  //--------------------------------------------------------------------------
82 
83  } // namespace details
84 
85 } // namespace proxy
86 
87 
88 #endif // LARDATA_RECOBASEPROXY_PROXYBASE_MAINCOLLECTIONPROXY_H
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.
auto getMainAt(std::size_t i) const -> decltype(auto)
Returns the specified item in the original 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:65
C++ metaprogramming utilities for dealing with containers.