Public Types | Public Member Functions | Private Attributes | Friends | List of all members
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 DataViewImpl::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.

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

Member Function Documentation

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

Definition at line 83 of file View.h.

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.

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.

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.

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

Definition at line 89 of file View.h.

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

Definition at line 101 of file View.h.

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.

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
bool search_all(FwdCont const &, Datum const &)
const double a
std::vector< T const * > vals_
Definition: View.h:127
auto isValid() const noexcept
Definition: View.h:52
virtual std::vector< void const * > getView() const
Definition: EDProduct.h:39
template<typename T>
auto art::View< T >::id ( ) const
inline

Definition at line 58 of file View.h.

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.

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.

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.

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

Definition at line 119 of file View.h.

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

Definition at line 68 of file View.h.

69  {
70  return vals_;
71  }
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.

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 DataViewImpl::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.

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

Definition at line 133 of file View.h.

template<typename T>
std::vector<T const*> art::View< T >::vals_ {}
private

Definition at line 127 of file View.h.


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