LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
art::View< T > Class Template Reference

#include "fwd.h"

Public Types

using collection_type = std::vector< T const * >
 
using value_type = typename collection_type::value_type
 
using const_iterator = typename collection_type::const_iterator
 
using iterator = typename collection_type::iterator
 
using size_type = typename collection_type::size_type
 

Public Member Functions

 View ()=default
 
 View (std::vector< T const * >, ProductID const, EDProduct const *)
 
auto isValid () const noexcept
 
auto id () const
 
void fill (PtrVector< T > &pv) const
 
auto & vals () noexcept
 
auto const & vals () const noexcept
 
 operator auto & () noexcept
 
 operator auto const & () const noexcept
 
auto begin () noexcept
 
auto end () noexcept
 
auto begin () const noexcept
 
auto end () const noexcept
 
auto cbegin () const noexcept
 
auto cend () const noexcept
 
auto size () const noexcept
 

Private Attributes

std::vector< T const * > vals_ {}
 
ProductID id_ {}
 
EDProduct const * prod_ {nullptr}
 

Friends

template<typename Element >
bool ProductRetriever::getView (std::string const &, std::string const &, std::string const &, View< Element > &) const
 

Detailed Description

template<typename T>
class art::View< T >

Definition at line 46 of file fwd.h.

Member Typedef Documentation

template<typename T>
using art::View< T >::collection_type = std::vector<T const*>

Definition at line 42 of file View.h.

template<typename T>
using art::View< T >::const_iterator = typename collection_type::const_iterator

Definition at line 44 of file View.h.

template<typename T>
using art::View< T >::iterator = typename collection_type::iterator

Definition at line 45 of file View.h.

template<typename T>
using art::View< T >::size_type = typename collection_type::size_type

Definition at line 46 of file View.h.

template<typename T>
using art::View< T >::value_type = typename collection_type::value_type

Definition at line 43 of file View.h.

Constructor & Destructor Documentation

template<typename T>
art::View< T >::View ( )
default
template<typename T >
art::View< T >::View ( std::vector< T const * >  v,
ProductID const  id,
EDProduct const *  p 
)

Definition at line 137 of file View.h.

References art::View< T >::id_, and art::View< T >::prod_.

138  : vals_{std::move(v)}, id_{id}, prod_{p}
139  {}
EDProduct const * prod_
Definition: View.h:133
ProductID id_
Definition: View.h:130
std::vector< T const * > vals_
Definition: View.h:127

Member Function Documentation

template<typename T>
auto art::View< T >::begin ( )
inlinenoexcept

Definition at line 83 of file View.h.

References art::View< T >::vals_.

84  {
85  return vals_.begin();
86  }
std::vector< T const * > vals_
Definition: View.h:127
template<typename T>
auto art::View< T >::begin ( ) const
inlinenoexcept

Definition at line 95 of file View.h.

References art::View< T >::vals_.

96  {
97  return vals_.begin();
98  }
std::vector< T const * > vals_
Definition: View.h:127
template<typename T>
auto art::View< T >::cbegin ( ) const
inlinenoexcept

Definition at line 107 of file View.h.

References art::View< T >::vals_.

108  {
109  return vals_.cbegin();
110  }
std::vector< T const * > vals_
Definition: View.h:127
template<typename T>
auto art::View< T >::cend ( ) const
inlinenoexcept

Definition at line 113 of file View.h.

References art::View< T >::vals_.

114  {
115  return vals_.cend();
116  }
std::vector< T const * > vals_
Definition: View.h:127
template<typename T>
auto art::View< T >::end ( void  )
inlinenoexcept

Definition at line 89 of file View.h.

References art::View< T >::vals_.

90  {
91  return vals_.end();
92  }
std::vector< T const * > vals_
Definition: View.h:127
template<typename T>
auto art::View< T >::end ( void  ) const
inlinenoexcept

Definition at line 101 of file View.h.

References art::View< T >::vals_.

102  {
103  return vals_.end();
104  }
std::vector< T const * > vals_
Definition: View.h:127
template<typename T >
void art::View< T >::fill ( PtrVector< T > &  pv) const

Definition at line 145 of file View.h.

References art::PtrVector< T >::emplace_back(), art::EDProduct::getView(), art::View< T >::id_, art::View< T >::isValid(), art::View< T >::prod_, and art::View< T >::vals_.

Referenced by art::View< T >::id(), and evd::RecoBaseDrawer::Prong3D().

146  {
147  if (not isValid()) {
148  return;
149  }
150  typename std::vector<T const*>::size_type i{};
151  for (auto a : prod_->getView()) {
152  // We do this as a sloppy guard against the container data
153  // product having been replaced between the View<T> ctor and the
154  // fill call. The user is supposed to do event.getView<T>()
155  // immediately followed by View<T>::fill(), but well. This can
156  // be O(n^2) so maybe it is not worth it in the case of large
157  // containers.
158  if (cet::search_all(vals_, a)) {
159  pv.emplace_back(id_, reinterpret_cast<T const*>(a), i);
160  ++i;
161  }
162  }
163  }
EDProduct const * prod_
Definition: View.h:133
ProductID id_
Definition: View.h:130
virtual std::vector< void const * > getView() const
Definition: EDProduct.cc:15
std::vector< T const * > vals_
Definition: View.h:127
auto isValid() const noexcept
Definition: View.h:52
template<typename T>
auto art::View< T >::id ( ) const
inline

Definition at line 58 of file View.h.

References art::View< T >::fill(), and art::View< T >::id_.

59  {
60  return id_;
61  }
ProductID id_
Definition: View.h:130
template<typename T>
auto art::View< T >::isValid ( ) const
inlinenoexcept

Definition at line 52 of file View.h.

References art::View< T >::prod_.

Referenced by art::View< T >::fill(), and evd::RecoBaseDrawer::Prong3D().

53  {
54  return prod_ != nullptr;
55  }
EDProduct const * prod_
Definition: View.h:133
template<typename T>
art::View< T >::operator auto & ( )
inlinenoexcept

Definition at line 79 of file View.h.

References art::View< T >::vals_.

79 { return vals_; }
std::vector< T const * > vals_
Definition: View.h:127
template<typename T>
art::View< T >::operator auto const & ( ) const
inlinenoexcept

Definition at line 80 of file View.h.

References art::View< T >::vals_.

80 { return vals_; }
std::vector< T const * > vals_
Definition: View.h:127
template<typename T>
auto art::View< T >::size ( void  ) const
inlinenoexcept

Definition at line 119 of file View.h.

References art::View< T >::vals_.

Referenced by filter::ADCFilter::filter().

120  {
121  return vals_.size();
122  }
std::vector< T const * > vals_
Definition: View.h:127
template<typename T>
auto const& art::View< T >::vals ( ) const
inlinenoexcept

Definition at line 74 of file View.h.

References art::View< T >::vals_.

75  {
76  return vals_;
77  }
std::vector< T const * > vals_
Definition: View.h:127

Friends And Related Function Documentation

template<typename T>
template<typename Element >
bool ProductRetriever::getView ( std::string const &  ,
std::string const &  ,
std::string const &  ,
View< Element > &   
) const
friend

Member Data Documentation

template<typename T>
ProductID art::View< T >::id_ {}
private

Definition at line 130 of file View.h.

Referenced by art::View< T >::fill(), art::View< T >::id(), and art::View< T >::View().

template<typename T>
EDProduct const* art::View< T >::prod_ {nullptr}
private

Definition at line 133 of file View.h.

Referenced by art::View< T >::fill(), art::View< T >::isValid(), and art::View< T >::View().


The documentation for this class was generated from the following files: