LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
FindManyInChainP.h
Go to the documentation of this file.
1 
11 #ifndef LARDATA_UTILITIES_FINDMANYINCHAINP_H
12 #define LARDATA_UTILITIES_FINDMANYINCHAINP_H
13 
14 // framework
17 
18 // C/C++ standard library
19 #include <cstdlib> // std::size_t
20 #include <initializer_list>
21 #include <utility> // std::forward()
22 #include <vector>
23 
24 namespace lar {
25 
26  namespace details {
27 
28  template <typename T, typename R = void>
30 
31  template <typename T, typename R = void>
33 
34  template <typename H, typename R = void>
36 
37  } // namespace details
38 
40  struct SameAsDataTag {};
41 
44 
104  template <typename Target, typename... Intermediate>
106 
107  public:
108  using Target_t = Target;
110 
112  using TargetPtrCollection_t = std::vector<TargetPtr_t>;
113 
129  template <typename Source, typename Event, typename... InputTags>
130  FindManyInChainP(Source&& source, Event const& event, InputTags... tags)
131  : results(find(std::forward<Source>(source), event, tags...))
132  {}
133 
135  std::size_t size() const noexcept;
136 
174  TargetPtrCollection_t const& at(std::size_t i) const;
175 
212  template <typename Source, typename Event, typename... InputTags>
213  static std::vector<TargetPtrCollection_t> find(Source&& source,
214  Event const& event,
215  InputTags... tags);
216 
217  private:
218  std::vector<TargetPtrCollection_t> results;
219 
220  }; // class FindManyInChainP<>
221 
222 } // namespace lar
223 
224 //------------------------------------------------------------------------------
225 //--- template implementation
226 //---
227 #include "FindManyInChainP.tcc" // expected in the same directory as this file
228 
229 //------------------------------------------------------------------------------
230 
231 #endif // LARDATA_UTILITIES_FINDMANYINCHAINP_H
FindManyInChainP(Source &&source, Event const &event, InputTags...tags)
Constructor: extracts target objects associated to all objects under the specified handle...
enable_if_type_exists_t< typename std::decay_t< H >::HandleTag, R > enable_if_is_handle_t
STL namespace.
constexpr SameAsDataTag SameAsData
Value for default tag in FindManyInChainP constructors.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
Type for default tag in FindManyInChainP constructors.
typename enable_if_type_exists< T, R >::type enable_if_type_exists_t
std::vector< TargetPtrCollection_t > results
Stored results.
Query object collecting a list of associated objects.
Target Target_t
Type of the associated objects.
std::vector< TargetPtr_t > TargetPtrCollection_t
Type returned by at() method.
LArSoft-specific namespace.
Definition: fwd.h:26
Event finding and building.