LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/

Classes

class  assns_node_iterator
 
struct  AssnsIterTraits
 Traits for a association iterator. More...
 
class  AssnsNode
 This type extends the interface of the art pointer to Assns right side. More...
 
class  AssociatedData
 Object to draft associated data interface. More...
 
struct  AssociatedDataProxyMakerWrapper
 
class  BoundaryList
 Builds and keeps track of internal boundaries in a sequence. More...
 
class  BoundaryListRange
 A BoundaryListRangeBase with a full container interface. More...
 
class  BoundaryListRangeBase
 
class  BoundaryListRangeIterator
 Iterator exposing elements of a boundary list as ranges. More...
 
struct  CollectionProxyImplFromTraitsImpl
 
struct  CollectionProxyImplFromTraitsImpl< Traits, std::enable_if_t< util::always_true_v< typename Traits::template collection_proxy_impl_t< Args... > > >, Args... >
 
class  IndexBasedIterator
 Iterator to random access collection storing a current index. More...
 
struct  isTrackProxy
 
struct  isTrackProxy< Track< TrackCollProxy > >
 
class  IteratorWrapperBase
 Simple iterator wrapper for manipulation of dereferenced result. More...
 
struct  MainCollectionProxy
 Wrapper for the main collection of a proxy. More...
 
class  OneTo01Data
 Object for one-to-zero/or/one associated data interface. More...
 
struct  OneTo01DataProxyMakerWrapper
 
class  ParallelData
 Object to draft parallel data interface. More...
 
struct  ParallelDataProxyMakerWrapper
 
struct  ParallelDataProxyMakerWrapper< Aux, AuxTag, void >
 
struct  ProxyAsParallelData
 Object presenting a proxy as parallel data for another one. More...
 
struct  StaticAsserts
 
struct  StaticAsserts< TrackPointWrapper< Data > >
 
struct  SubstituteWithAuxList
 
struct  SubstituteWithAuxList< std::tuple< T... > >
 
struct  TemplateAdaptorOnePlus
 
struct  TemplateAdaptorOnePlus< F, First, Others... >
 
struct  TrackPointIteratorBox
 Structure for range-for iteration. More...
 
class  WithAssociatedStructBase
 Helper to create associated data proxy. More...
 
class  WithProxyAsAuxStructBase
 Helper to create a proxy as auxiliary data for another proxy. More...
 

Typedefs

template<typename Traits , typename... Args>
using CollectionProxyImplFromTraits_t = typename CollectionProxyImplFromTraitsImpl< Traits, void, Args... >::type
 
template<typename Aux , typename Metadata , typename ArgTuple , typename AuxTag = Aux>
using WithAssociatedStruct = WithAssociatedStructBase< Aux, Metadata, ArgTuple, AssociatedDataProxyMakerWrapper< Aux, Metadata, AuxTag >::template maker_t, AuxTag >
 
template<typename Aux , typename ArgTuple , typename AuxTag = Aux>
using WithParallelCollectionStruct = WithAssociatedStructBase< Aux, void, ArgTuple, ParallelDataProxyMakerWrapper< Aux, AuxTag >::template maker_t, AuxTag >
 
template<typename Aux , typename ArgTuple , typename AuxColl , typename AuxTag = Aux>
using WithWrappedParallelCollectionStruct = WithAssociatedStructBase< Aux, void, ArgTuple, ParallelDataProxyMakerWrapper< Aux, AuxTag, AuxColl >::template maker_t, AuxTag >
 
template<typename Aux , typename Metadata , typename ArgTuple , typename AuxTag = Aux>
using WithOneTo01AssociatedStruct = WithAssociatedStructBase< Aux, Metadata, ArgTuple, OneTo01DataProxyMakerWrapper< Aux, Metadata, AuxTag >::template maker_t, AuxTag >
 

Functions

template<typename ArtAssnsIterValue >
bool operator== (AssnsNode< ArtAssnsIterValue > const &A, typename AssnsNode< ArtAssnsIterValue >::valueptr_t const &B)
 
template<typename ArtAssnsIterValue >
bool operator== (typename AssnsNode< ArtAssnsIterValue >::valueptr_t const &A, AssnsNode< ArtAssnsIterValue > const &B)
 
template<typename ArtAssnsIterValue >
bool operator!= (AssnsNode< ArtAssnsIterValue > const &A, typename AssnsNode< ArtAssnsIterValue >::valueptr_t const &B)
 
template<typename ArtAssnsIterValue >
bool operator!= (typename AssnsNode< ArtAssnsIterValue >::valueptr_t const &A, AssnsNode< ArtAssnsIterValue > const &B)
 
template<typename ArtAssnsIterValue >
AssnsNode< ArtAssnsIterValue > const & makeAssnsNode (ArtAssnsIterValue const &from)
 Reinterprets the specified association node as a AssnsNode. More...
 
template<typename BoundaryIter >
BoundaryListRange< BoundaryIter > makeBoundaryListRange (BoundaryIter const &iBegin)
 Reinterprets a iterator to boundaries list as a range collection. More...
 
template<std::size_t GroupKey, typename Iter >
BoundaryList< Iter >::boundaries_t associationRangesImpl (Iter begin, Iter end, std::size_t expectedSize)
 
template<std::size_t GroupKey, typename Iter >
auto associationRangeBoundaries (Iter begin, Iter end)
 
template<std::size_t GroupKey, typename Iter >
auto associationRangeBoundaries (Iter begin, Iter end, std::size_t n)
 
template<std::size_t GroupKey, typename Iter >
BoundaryList< Iter > associationRanges (Iter begin, Iter end)
 Groups associations by the first key. More...
 
template<std::size_t GroupKey, typename Iter >
BoundaryList< Iter > associationRanges (Iter begin, Iter end, std::size_t n)
 Groups associations by the first key. More...
 
template<template< typename... > class CollProxy, typename MainColl , typename... AuxColl>
auto createCollectionProxy (MainColl const &main, AuxColl &&...aux)
 Creates a collection proxy of a specified type with the given arguments. More...
 
template<typename MainColl , typename... AuxColl>
auto makeCollectionProxy (MainColl const &main, AuxColl &&...aux)
 Creates a CollectionProxy object with the given arguments. More...
 
template<typename ProxyElement , typename... AuxData>
auto makeCollectionProxyElement (std::size_t index, typename ProxyElement::main_element_t const &main, AuxData &&...auxData)
 Creates a collection proxy element object from data structures. More...
 
template<typename Traits , typename... Args>
auto createCollectionProxyFromTraits (Args &&...args)
 
template<typename T >
void extendAndAssign (std::vector< T > &v, typename std::vector< T >::size_type index, typename std::vector< T >::value_type const &value)
 
template<typename T >
void extendAndAssign (std::vector< T > &v, typename std::vector< T >::size_type index, typename std::vector< T >::value_type &&value)
 
template<std::size_t Key, std::size_t Data, typename Iter >
auto associationOneToOneFullSequence (Iter begin, Iter end, std::size_t n)
 

Detailed Description

— END Infrastructure for proxies as auxiliary data ------------------—

Typedef Documentation

template<typename Traits , typename... Args>
using proxy::details::CollectionProxyImplFromTraits_t = typedef typename CollectionProxyImplFromTraitsImpl<Traits, void, Args...>::type

Traits::collection_proxy_impl_t if that (template) type exists, proxy::CollectionProxy otherwise.

Definition at line 242 of file CollectionProxyMaker.h.

template<typename Aux , typename Metadata , typename ArgTuple , typename AuxTag = Aux>
using proxy::details::WithAssociatedStruct = typedef WithAssociatedStructBase< Aux, Metadata, ArgTuple, AssociatedDataProxyMakerWrapper<Aux, Metadata, AuxTag>::template maker_t, AuxTag>

Definition at line 58 of file withAssociated.h.

template<typename Aux , typename Metadata , typename ArgTuple , typename AuxTag = Aux>
using proxy::details::WithOneTo01AssociatedStruct = typedef WithAssociatedStructBase< Aux, Metadata, ArgTuple, OneTo01DataProxyMakerWrapper<Aux, Metadata, AuxTag>::template maker_t, AuxTag>

Definition at line 32 of file withZeroOrOne.h.

template<typename Aux , typename ArgTuple , typename AuxTag = Aux>
using proxy::details::WithParallelCollectionStruct = typedef WithAssociatedStructBase<Aux, void, ArgTuple, ParallelDataProxyMakerWrapper<Aux, AuxTag>::template maker_t, AuxTag>

Definition at line 34 of file withParallelData.h.

template<typename Aux , typename ArgTuple , typename AuxColl , typename AuxTag = Aux>
using proxy::details::WithWrappedParallelCollectionStruct = typedef WithAssociatedStructBase< Aux, void, ArgTuple, ParallelDataProxyMakerWrapper<Aux, AuxTag, AuxColl>::template maker_t, AuxTag>

Definition at line 42 of file withParallelData.h.

Function Documentation

template<std::size_t Key, std::size_t Data, typename Iter >
auto proxy::details::associationOneToOneFullSequence ( Iter  begin,
Iter  end,
std::size_t  n 
)

Definition at line 240 of file OneTo01Data.h.

References util::end(), and extendAndAssign().

241  {
242  //
243  // Here we are actually not using the assumption that the keys are in
244  // increasing order; which is just as good as long as we use a fast random
245  // access container as STL vector.
246  // We do assume the key side of the association to be valid, though.
247  //
248  using value_type = typename Iter::value_type;
249  using data_t = std::tuple_element_t<Data, value_type>;
250  std::vector<data_t> data(n); // all default-constructed
251  for (auto it = begin; it != end; ++it) {
252  auto const& keyPtr = std::get<Key>(*it);
253  extendAndAssign(data, keyPtr.key(), std::get<Data>(*it));
254  }
255  return data;
256  } // associationOneToOneFullSequence(Iter, Iter, std::size_t)
void extendAndAssign(std::vector< T > &v, typename std::vector< T >::size_type index, typename std::vector< T >::value_type &&value)
Definition: OneTo01Data.h:225
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
Char_t n[5]
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
template<std::size_t GroupKey, typename Iter >
auto proxy::details::associationRangeBoundaries ( Iter  begin,
Iter  end 
)

Definition at line 924 of file AssociatedData.h.

References util::begin(), and util::end().

925  {
926  return associationRangesImpl<GroupKey, Iter>(begin, end);
927  }
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
template<std::size_t GroupKey, typename Iter >
auto proxy::details::associationRangeBoundaries ( Iter  begin,
Iter  end,
std::size_t  n 
)

Definition at line 931 of file AssociatedData.h.

References util::begin(), util::end(), and n.

932  {
933  auto boundaries = associationRangesImpl<GroupKey, Iter>(begin, end, n);
934  if (boundaries.size() <= n) {
935  boundaries.insert(boundaries.end(), n + 1 - boundaries.size(), boundaries.back());
936  assert(boundaries.size() == (n + 1));
937  }
938  return boundaries;
939  } // associationRangeBoundaries(Iter, Iter, std::size_t)
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
Char_t n[5]
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
template<std::size_t GroupKey, typename Iter >
BoundaryList<Iter> proxy::details::associationRanges ( Iter  begin,
Iter  end 
)

Groups associations by the first key.

Template Parameters
GroupKeyindex of the key in the tuple pointed by the iterator
Itertype of iterators delimiting the data (same type required)
Parameters
beginiterator to the first association in the list
enditerator past the last association in the list
Returns
a list of range boundaries marking the different groups.
Exceptions
std::runtime_errorif input key is not monotonic

The input iterators are expected to point to a tuple-like structure whose key element can be accessed as std::get<GroupKey>() and is an art pointer of some sort.

The index of the grouping key is expected to be monotonically increasing. Gaps are supported except that at the end: if e.g. an association of 5 keys associates objects to only elements #0, #1 and #3, the resulting list will cover 4 ranges for elements #0 to #3 included, but excluding the end elements, the existence of which can't be inferred from the association list in input. In this example, the range #2 will exist and be empty. To enforce a minimum number of elements, use associationRanges(Iter, Iter, std::size_t).

Definition at line 965 of file AssociatedData.h.

References util::begin(), and util::end().

966  {
967  return BoundaryList<Iter>(associationRangeBoundaries<GroupKey>(begin, end));
968  }
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
template<std::size_t GroupKey, typename Iter >
BoundaryList<Iter> proxy::details::associationRanges ( Iter  begin,
Iter  end,
std::size_t  n 
)

Groups associations by the first key.

Template Parameters
GroupKeyindex of the key in the tuple pointed by the iterator
Itertype of iterators delimiting the data (same type required)
Parameters
beginiterator to the first association in the list
enditerator past the last association in the list
nminimum number of ranges to be produced.
Returns
a list of range boundaries marking the different groups.
Exceptions
std::runtime_errorif input key is not monotonic
See also
associationRanges(Iter, Iter)

This function operates almost like associationRanges(Iter, Iter). The only difference is that at least n ranges are guaranteed to be produced: if the input defines less than n, the missing ones will be added at the end, empty. This allows to work around the possibility of empty ranges at the end, which the associationRanges(Iter, Iter) algorithm does not support.

Definition at line 989 of file AssociatedData.h.

References util::begin(), util::end(), and n.

990  {
991  return BoundaryList<Iter>(associationRangeBoundaries<GroupKey>(begin, end, n));
992  }
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
Char_t n[5]
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
template<std::size_t GroupKey, typename Iter >
BoundaryList<Iter>::boundaries_t proxy::details::associationRangesImpl ( Iter  begin,
Iter  end,
std::size_t  expectedSize 
)

Definition at line 896 of file AssociatedData.h.

References util::end(), proxy::details::BoundaryList< Iter >::end(), and util::to_string().

897  {
898  constexpr auto KeyIndex = GroupKey;
899 
900  auto extractKey = [](auto const& assn) { return std::get<KeyIndex>(assn).key(); };
901 
902  typename BoundaryList<Iter>::boundaries_t boundaries;
903  boundaries.reserve(expectedSize + 1);
904  boundaries.push_back(begin);
905  std::size_t current = 0;
906  for (auto it = begin; it != end; ++it) {
907  auto const key = extractKey(*it);
908  if (key == current) continue;
909  if (key < current) {
910  auto index = std::distance(begin, it);
911  throw std::runtime_error(
912  "associationRanges() got input element #" + std::to_string(index - 1) + " with key " +
913  std::to_string(current) + " and the next with key " + std::to_string(key) + "!");
914  }
915  boundaries.insert(boundaries.end(), key - current, it);
916  current = key;
917  } // for
918  boundaries.push_back(end);
919  return boundaries;
920  } // associationRangesImpl()
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
template<template< typename... > class CollProxy, typename MainColl , typename... AuxColl>
auto proxy::details::createCollectionProxy ( MainColl const &  main,
AuxColl &&...  aux 
)

Creates a collection proxy of a specified type with the given arguments.

Definition at line 311 of file CollectionProxy.h.

References main().

312  {
313  return CollProxy<MainColl, AuxColl...>(main, std::forward<AuxColl>(aux)...);
314  }
int main()
Definition: example_main.cc:17
template<typename Traits , typename... Args>
auto proxy::details::createCollectionProxyFromTraits ( Args &&...  args)

Definition at line 246 of file CollectionProxyMaker.h.

247  {
248  using collection_proxy_impl_t =
249  CollectionProxyImplFromTraits_t<Traits, std::decay_t<Args>...>;
250  return collection_proxy_impl_t(std::forward<Args>(args)...);
251  } // createCollectionProxyFromTraits()
template<typename T >
void proxy::details::extendAndAssign ( std::vector< T > &  v,
typename std::vector< T >::size_type  index,
typename std::vector< T >::value_type const &  value 
)

Definition at line 209 of file OneTo01Data.h.

References value.

Referenced by associationOneToOneFullSequence().

212  {
213  if (index >= v.size()) {
214  v.reserve(index + 1);
215  v.resize(index);
216  v.push_back(value);
217  }
218  else
219  v[index] = value;
220  } // extendAndAssign()
double value
Definition: spectrum.C:18
template<typename T >
void proxy::details::extendAndAssign ( std::vector< T > &  v,
typename std::vector< T >::size_type  index,
typename std::vector< T >::value_type &&  value 
)

Definition at line 225 of file OneTo01Data.h.

References value.

228  {
229  if (index >= v.size()) {
230  v.reserve(index + 1);
231  v.resize(index);
232  v.push_back(std::move(value));
233  }
234  else
235  v[index] = std::move(value);
236  } // extendAndAssign()
double value
Definition: spectrum.C:18
template<typename ArtAssnsIterValue >
AssnsNode<ArtAssnsIterValue> const& proxy::details::makeAssnsNode ( ArtAssnsIterValue const &  from)

Reinterprets the specified association node as a AssnsNode.

Definition at line 356 of file AssociatedData.h.

References proxy::details::AssnsNode< ArtAssnsIterValue >::makeFrom().

Referenced by proxy::details::assns_node_iterator< ArtAssnsIter >::transform().

357  {
358  return AssnsNode<ArtAssnsIterValue>::makeFrom(from);
359  }
template<typename BoundaryIter >
BoundaryListRange<BoundaryIter> proxy::details::makeBoundaryListRange ( BoundaryIter const &  iBegin)

Reinterprets a iterator to boundaries list as a range collection.

Template Parameters
BoundaryItertype of iterator to boundary collection
Parameters
iBeginiterator to the begin iterator of a range
Returns
a collection view (lar::CollectionView) of the range

A range is conceptually defined as a sequence of data between a begin and and end iterator. The argument of this function is an iterator to the begin iterator of the range. The begin iterator itself is obtained by dereferencing the argument: *iBegin. The end iterator of the range is required to be immediately after the begin iterator (

*std::next(iBegin)

). This pair of iterators is exposed via the lar::CollectionView view, that presents a vector-like interface. For this to fully work, the data iterators (e.g., *iBegin) must comply with the random-access iterator requirements.

An example of BoundaryIter is the iterator to the list of boundaries in BoundaryList: BoundaryList::boundaries_t::const_iterator.

Definition at line 555 of file AssociatedData.h.

Referenced by proxy::details::BoundaryListRangeIterator< BoundaryIter >::transform().

556  {
557  return {iBegin};
558  }
template<typename MainColl , typename... AuxColl>
auto proxy::details::makeCollectionProxy ( MainColl const &  main,
AuxColl &&...  aux 
)

Creates a CollectionProxy object with the given arguments.

Definition at line 319 of file CollectionProxy.h.

References main().

320  {
321  return createCollectionProxy<CollectionProxy>(main, std::forward<AuxColl>(aux)...);
322  }
int main()
Definition: example_main.cc:17
template<typename ProxyElement , typename... AuxData>
auto proxy::details::makeCollectionProxyElement ( std::size_t  index,
typename ProxyElement::main_element_t const &  main,
AuxData &&...  auxData 
)

Creates a collection proxy element object from data structures.

Template Parameters
ProxyElementtype of proxy element to be created
AuxDatatypes of auxiliary data structures being included
Parameters
indexindex in main collection of the element being represented
mainmain collection proxy data
auxDataauxiliary data collections
Returns
a ProxyElement object bound to the specified data element

Definition at line 306 of file CollectionProxyElement.h.

309  {
310  return ProxyElement(
311  index, main, typename ProxyElement::aux_elements_t(std::forward<AuxData>(auxData)...));
312  } // makeCollectionProxyElement()
int main()
Definition: example_main.cc:17
template<typename ArtAssnsIterValue >
bool proxy::details::operator!= ( AssnsNode< ArtAssnsIterValue > const &  A,
typename AssnsNode< ArtAssnsIterValue >::valueptr_t const &  B 
)

Definition at line 342 of file AssociatedData.h.

References proxy::details::AssnsNode< ArtAssnsIterValue >::valuePtr().

344  {
345  return A.valuePtr() != B;
346  }
template<typename ArtAssnsIterValue >
bool proxy::details::operator!= ( typename AssnsNode< ArtAssnsIterValue >::valueptr_t const &  A,
AssnsNode< ArtAssnsIterValue > const &  B 
)

Definition at line 348 of file AssociatedData.h.

References proxy::details::AssnsNode< ArtAssnsIterValue >::valuePtr().

350  {
351  return A != B.valuePtr();
352  }
template<typename ArtAssnsIterValue >
bool proxy::details::operator== ( AssnsNode< ArtAssnsIterValue > const &  A,
typename AssnsNode< ArtAssnsIterValue >::valueptr_t const &  B 
)

Definition at line 330 of file AssociatedData.h.

References proxy::details::AssnsNode< ArtAssnsIterValue >::valuePtr().

332  {
333  return A.valuePtr() == B;
334  }
template<typename ArtAssnsIterValue >
bool proxy::details::operator== ( typename AssnsNode< ArtAssnsIterValue >::valueptr_t const &  A,
AssnsNode< ArtAssnsIterValue > const &  B 
)

Definition at line 336 of file AssociatedData.h.

References proxy::details::AssnsNode< ArtAssnsIterValue >::valuePtr().

338  {
339  return A == B.valuePtr();
340  }