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

#include "fwd.h"

Inheritance diagram for art::PtrVector< T >:
art::PtrVectorBase

Public Types

using value_type = typename data_t::value_type
 
using allocator_type = typename data_t::allocator_type
 
using reference = typename data_t::reference
 
using const_reference = typename data_t::const_reference
 
using pointer = typename data_t::pointer
 
using const_pointer = typename data_t::const_pointer
 
using iterator = typename data_t::iterator
 
using const_iterator = typename data_t::const_iterator
 
using reverse_iterator = typename data_t::reverse_iterator
 
using const_reverse_iterator = typename data_t::const_reverse_iterator
 
using difference_type = typename data_t::difference_type
 
using size_type = typename data_t::size_type
 
using key_type = unsigned long
 
using indices_t = std::vector< key_type >
 

Public Member Functions

 PtrVector ()
 
template<typename U >
 PtrVector (PtrVector< U > const &other)
 
template<typename U >
 PtrVector (std::initializer_list< Ptr< U >> il)
 
template<typename U >
PtrVector< T > & operator= (std::initializer_list< Ptr< U >> il)
 
template<typename U >
PtrVector< T > & operator= (PtrVector< U > const &other)&
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator crend () const
 
size_type size () const
 
size_type max_size () const
 
void resize (size_type n)
 
size_type capacity () const
 
bool empty () const
 
void reserve (size_type n)
 
void shrink_to_fit ()
 
Ptr< T > const & operator[] (unsigned long const idx) const
 
reference at (size_type n)
 
const_reference at (size_type n) const
 
reference front ()
 
const_reference front () const
 
reference back ()
 
const_reference back () const
 
template<typename U >
void assign (size_type n, Ptr< U > const &p)
 
template<class InputIterator >
void assign (InputIterator first, InputIterator last)
 
template<typename U >
void assign (std::initializer_list< Ptr< U >> il)
 
template<typename U >
void push_back (Ptr< U > const &p)
 
template<typename... Args>
void emplace_back (Args &&...args)
 
void pop_back ()
 
template<typename U >
iterator insert (iterator position, Ptr< U > const &p)
 
template<typename U >
void insert (iterator position, size_type n, Ptr< U > const &p)
 
template<typename InputIterator >
iterator insert (const_iterator position, InputIterator first, InputIterator last)
 
iterator erase (iterator position)
 
iterator erase (iterator first, iterator last)
 
void swap (PtrVector &other)
 
void swap (key_type k1, key_type k2)
 
void clear ()
 
bool operator== (PtrVector const &other) const
 
void sort ()
 
template<class Comp >
void sort (Comp comp)
 
template<typename U >
art::PtrVector< T > & operator= (std::initializer_list< Ptr< U >> const il)
 
template<typename U >
art::PtrVector< T > & operator= (PtrVector< U > const &other)&
 
template<typename U >
art::PtrVector< T >::iterator insert (iterator const position, Ptr< U > const &p)
 
template<typename InputIterator >
auto insert (const_iterator position, InputIterator first, InputIterator last) -> iterator
 
bool isNonnull () const noexcept
 
bool isNull () const noexcept
 
bool isAvailable () const
 
ProductID id () const noexcept
 
EDProductGetter const * productGetter () const noexcept
 
void setProductGetter (EDProductGetter const *) noexcept
 
template<typename T >
art::Ptr< T >::key_type key (Ptr< T > const &ptr) const noexcept
 

Static Public Member Functions

static short Class_Version ()
 

Protected Member Functions

void swap (PtrVectorBase &)
 
void updateCore (RefCore const &core)
 
bool operator== (PtrVectorBase const &) const noexcept
 

Private Types

using data_t = std::vector< Ptr< T >>
 

Private Member Functions

void fill_offsets (indices_t &indices) override
 
void fill_from_offsets (indices_t const &indices) const override
 
void zeroTransients () override
 

Private Attributes

data_t ptrs_ {}
 

Detailed Description

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

Definition at line 28 of file fwd.h.

Member Typedef Documentation

template<typename T>
using art::PtrVector< T >::allocator_type = typename data_t::allocator_type

Definition at line 49 of file PtrVector.h.

template<typename T>
using art::PtrVector< T >::const_iterator = typename data_t::const_iterator

Definition at line 55 of file PtrVector.h.

template<typename T>
using art::PtrVector< T >::const_pointer = typename data_t::const_pointer

Definition at line 53 of file PtrVector.h.

template<typename T>
using art::PtrVector< T >::const_reference = typename data_t::const_reference

Definition at line 51 of file PtrVector.h.

template<typename T>
using art::PtrVector< T >::const_reverse_iterator = typename data_t::const_reverse_iterator

Definition at line 57 of file PtrVector.h.

template<typename T>
using art::PtrVector< T >::data_t = std::vector<Ptr<T>>
private

Definition at line 45 of file PtrVector.h.

template<typename T>
using art::PtrVector< T >::difference_type = typename data_t::difference_type

Definition at line 58 of file PtrVector.h.

using art::PtrVectorBase::indices_t = std::vector<key_type>
inherited

Definition at line 22 of file PtrVectorBase.h.

template<typename T>
using art::PtrVector< T >::iterator = typename data_t::iterator

Definition at line 54 of file PtrVector.h.

using art::PtrVectorBase::key_type = unsigned long
inherited

Definition at line 21 of file PtrVectorBase.h.

template<typename T>
using art::PtrVector< T >::pointer = typename data_t::pointer

Definition at line 52 of file PtrVector.h.

template<typename T>
using art::PtrVector< T >::reference = typename data_t::reference

Definition at line 50 of file PtrVector.h.

template<typename T>
using art::PtrVector< T >::reverse_iterator = typename data_t::reverse_iterator

Definition at line 56 of file PtrVector.h.

template<typename T>
using art::PtrVector< T >::size_type = typename data_t::size_type

Definition at line 59 of file PtrVector.h.

template<typename T>
using art::PtrVector< T >::value_type = typename data_t::value_type

Definition at line 48 of file PtrVector.h.

Constructor & Destructor Documentation

template<typename T >
art::PtrVector< T >::PtrVector ( )
inlinedefault
template<typename T >
template<typename U >
art::PtrVector< T >::PtrVector ( PtrVector< U > const &  other)
inline

Definition at line 165 of file PtrVector.h.

References fhicl::other, and art::PtrVector< T >::ptrs_.

167 {
168  // Ensure that types are compatible.
169  static_assert(std::is_base_of_v<T, U> || std::is_base_of_v<U, T>,
170  "PtrVector: incompatible types");
171  ptrs_.reserve(other.size());
172  cet::copy_all(other, std::back_inserter(ptrs_));
173 }
PtrVectorBase()=default
data_t ptrs_
Definition: PtrVector.h:151
template<typename T >
template<typename U >
art::PtrVector< T >::PtrVector ( std::initializer_list< Ptr< U >>  il)
inline

Definition at line 177 of file PtrVector.h.

References art::PtrVector< T >::ptrs_, and art::PtrVectorBase::updateCore().

178 {
179  static_assert(std::is_same_v<T, U> || std::is_base_of_v<T, U> ||
180  std::is_base_of_v<U, T>,
181  "PtrVector: incompatible types");
182  ptrs_.reserve(il.size());
183  for (auto&& p : il) {
184  updateCore(p.refCore());
185  ptrs_.push_back(std::move(p));
186  }
187 }
data_t ptrs_
Definition: PtrVector.h:151
void updateCore(RefCore const &core)

Member Function Documentation

template<typename T >
template<typename U >
void art::PtrVector< T >::assign ( size_type  n,
Ptr< U > const &  p 
)
inline

Definition at line 403 of file PtrVector.h.

References art::PtrVectorBase::clear(), art::PtrVector< T >::ptrs_, art::Ptr< T >::refCore(), and art::PtrVectorBase::updateCore().

Referenced by art::PtrVector< T >::assign(), and art::PtrVector< T >::operator=().

404 {
405  static_assert(std::is_same_v<T, U> || std::is_base_of_v<T, U> ||
406  std::is_base_of_v<U, T>,
407  "PtrVector: incompatible types");
409  updateCore(p.refCore());
410  ptrs_.assign(n, p);
411 }
data_t ptrs_
Definition: PtrVector.h:151
Char_t n[5]
void updateCore(RefCore const &core)
template<typename T >
template<typename InputIterator >
void art::PtrVector< T >::assign ( InputIterator  first,
InputIterator  last 
)
inline

Definition at line 416 of file PtrVector.h.

References art::PtrVectorBase::clear(), art::PtrVector< T >::ptrs_, art::Ptr< T >::refCore(), and art::PtrVectorBase::updateCore().

417 {
419  std::for_each(
420  first, last, [this](Ptr<T> const& p) { updateCore(p.refCore()); });
421  ptrs_.assign(first, last);
422 }
data_t ptrs_
Definition: PtrVector.h:151
void updateCore(RefCore const &core)
template<typename T >
template<typename U >
void art::PtrVector< T >::assign ( std::initializer_list< Ptr< U >>  il)
inline

Definition at line 427 of file PtrVector.h.

References art::PtrVector< T >::assign().

428 {
429  assign(il.begin(), il.end());
430 }
void assign(size_type n, Ptr< U > const &p)
Definition: PtrVector.h:403
template<typename T >
auto art::PtrVector< T >::at ( size_type  n) const
inline

Definition at line 366 of file PtrVector.h.

References n, and art::PtrVector< T >::ptrs_.

367 {
368  return ptrs_.at(n);
369 }
data_t ptrs_
Definition: PtrVector.h:151
Char_t n[5]
template<typename T >
auto art::PtrVector< T >::back ( )
inline

Definition at line 387 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

Referenced by cluster::HoughBaseAlg::FastTransform(), and cluster::DBcluster::produce().

388 {
389  return ptrs_.back();
390 }
data_t ptrs_
Definition: PtrVector.h:151
template<typename T >
auto art::PtrVector< T >::back ( ) const
inline

Definition at line 394 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

395 {
396  return ptrs_.back();
397 }
data_t ptrs_
Definition: PtrVector.h:151
template<typename T >
auto art::PtrVector< T >::begin ( ) const
inline

Definition at line 224 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

225 {
226  return ptrs_.begin();
227 }
data_t ptrs_
Definition: PtrVector.h:151
template<typename T >
auto art::PtrVector< T >::capacity ( ) const
inline

Definition at line 323 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

324 {
325  return ptrs_.capacity();
326 }
data_t ptrs_
Definition: PtrVector.h:151
template<typename T >
auto art::PtrVector< T >::cbegin ( ) const
inline

Definition at line 273 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

274 {
275  return ptrs_.cbegin();
276 }
data_t ptrs_
Definition: PtrVector.h:151
template<typename T >
auto art::PtrVector< T >::cend ( ) const
inline

Definition at line 280 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

281 {
282  return ptrs_.cend();
283 }
data_t ptrs_
Definition: PtrVector.h:151
template<typename T>
static short art::PtrVector< T >::Class_Version ( )
inlinestatic

Definition at line 140 of file PtrVector.h.

141  {
142  return 11;
143  }
template<typename T >
auto art::PtrVector< T >::crbegin ( ) const
inline

Definition at line 287 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

288 {
289  return ptrs_.crbegin();
290 }
data_t ptrs_
Definition: PtrVector.h:151
template<typename T >
auto art::PtrVector< T >::crend ( ) const
inline

Definition at line 294 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

295 {
296  return ptrs_.crend();
297 }
data_t ptrs_
Definition: PtrVector.h:151
template<typename T >
template<typename... Args>
void art::PtrVector< T >::emplace_back ( Args &&...  args)
inline

Definition at line 448 of file PtrVector.h.

References art::PtrVector< T >::ptrs_, art::Ptr< T >::refCore(), and art::PtrVectorBase::updateCore().

Referenced by art::View< T >::fill(), and opdet::OpFlashFinder::produce().

449 {
450  Ptr<T> p(std::forward<Args>(args)...);
451  updateCore(p.refCore());
452  ptrs_.push_back(std::move(p));
453 }
data_t ptrs_
Definition: PtrVector.h:151
void updateCore(RefCore const &core)
template<typename T >
auto art::PtrVector< T >::end ( void  ) const
inline

Definition at line 238 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

239 {
240  return ptrs_.end();
241 }
data_t ptrs_
Definition: PtrVector.h:151
template<typename T >
auto art::PtrVector< T >::erase ( iterator  position)
inline
template<typename T >
auto art::PtrVector< T >::erase ( iterator  first,
iterator  last 
)
inline

Definition at line 511 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

512 {
513  return ptrs_.erase(first, last);
514 }
data_t ptrs_
Definition: PtrVector.h:151
template<typename T >
void art::PtrVector< T >::fill_from_offsets ( indices_t const &  indices) const
overrideprivatevirtual

Implements art::PtrVectorBase.

Definition at line 575 of file PtrVector.h.

References art::PtrVectorBase::productGetter(), and art::PtrVector< T >::ptrs_.

576 {
577  // Precondition: ptrs_ is expected to be empty.
578  assert(ptrs_.empty());
579  ptrs_.reserve(indices.size());
580  for (auto i : indices) {
581  ptrs_.emplace_back(id(), i, productGetter());
582  }
583 }
constexpr std::array< std::size_t, geo::vect::dimension< Vector >)> indices()
Returns a sequence of indices valid for a vector of the specified type.
EDProductGetter const * productGetter() const noexcept
Definition: PtrVectorBase.h:86
data_t ptrs_
Definition: PtrVector.h:151
template<typename T >
void art::PtrVector< T >::fill_offsets ( indices_t indices)
overrideprivatevirtual

Implements art::PtrVectorBase.

Definition at line 563 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

564 {
565  // Precondition: indices is expected to be empty.
566  assert(indices.empty());
567  indices.reserve(ptrs_.size());
568  for (auto const& i : ptrs_) {
569  indices.push_back(i.key());
570  }
571 }
constexpr std::array< std::size_t, geo::vect::dimension< Vector >)> indices()
Returns a sequence of indices valid for a vector of the specified type.
data_t ptrs_
Definition: PtrVector.h:151
template<typename T >
auto art::PtrVector< T >::front ( )
inline

Definition at line 373 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

Referenced by trkf::SpacePointAlg::fillComplexSpacePoint(), and cluster::DBcluster::produce().

374 {
375  return ptrs_.front();
376 }
data_t ptrs_
Definition: PtrVector.h:151
template<typename T >
auto art::PtrVector< T >::front ( ) const
inline

Definition at line 380 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

381 {
382  return ptrs_.front();
383 }
data_t ptrs_
Definition: PtrVector.h:151
art::ProductID art::PtrVectorBase::id ( ) const
inlinenoexceptinherited

Definition at line 80 of file PtrVectorBase.h.

Referenced by art::PtrVectorBase::updateCore().

81 {
82  return core_.id();
83 }
constexpr ProductID id() const noexcept
Definition: RefCore.h:50
template<typename T >
template<typename U >
void art::PtrVector< T >::insert ( iterator  position,
size_type  n,
Ptr< U > const &  p 
)
inline

Definition at line 478 of file PtrVector.h.

References art::PtrVector< T >::ptrs_, art::Ptr< T >::refCore(), and art::PtrVectorBase::updateCore().

481 {
482  // Ensure that types are compatible.
483  static_assert(std::is_same_v<T, U> || std::is_base_of_v<T, U> ||
484  std::is_base_of_v<U, T>,
485  "PtrVector: incompatible types");
486  updateCore(p.refCore());
487  ptrs_.insert(position, n, p);
488 }
data_t ptrs_
Definition: PtrVector.h:151
Char_t n[5]
void updateCore(RefCore const &core)
template<typename T>
template<typename InputIterator >
iterator art::PtrVector< T >::insert ( const_iterator  position,
InputIterator  first,
InputIterator  last 
)
template<typename T>
template<typename U >
art::PtrVector<T>::iterator art::PtrVector< T >::insert ( iterator const  position,
Ptr< U > const &  p 
)
inline

Definition at line 465 of file PtrVector.h.

References art::PtrVector< T >::ptrs_, art::Ptr< T >::refCore(), and art::PtrVectorBase::updateCore().

466 {
467  // Ensure that types are compatible.
468  static_assert(std::is_same_v<T, U> || std::is_base_of_v<T, U> ||
469  std::is_base_of_v<U, T>,
470  "PtrVector: incompatible types");
471  updateCore(p.refCore());
472  return ptrs_.insert(position, p);
473 }
data_t ptrs_
Definition: PtrVector.h:151
void updateCore(RefCore const &core)
template<typename T>
template<typename InputIterator >
auto art::PtrVector< T >::insert ( const_iterator  position,
InputIterator  first,
InputIterator  last 
) -> iterator
inline

Definition at line 493 of file PtrVector.h.

References art::PtrVector< T >::ptrs_, art::Ptr< T >::refCore(), and art::PtrVectorBase::updateCore().

496 {
497  std::for_each(
498  first, last, [this](Ptr<T> const& p) { updateCore(p.refCore()); });
499  return ptrs_.insert(position, first, last);
500 }
data_t ptrs_
Definition: PtrVector.h:151
void updateCore(RefCore const &core)
bool art::PtrVectorBase::isAvailable ( ) const
inlineinherited

Definition at line 74 of file PtrVectorBase.h.

75 {
76  return core_.isAvailable();
77 }
bool isAvailable() const
Definition: RefCore.cc:24
bool art::PtrVectorBase::isNonnull ( ) const
inlinenoexceptinherited

Definition at line 62 of file PtrVectorBase.h.

References art::RefCore::isNonnull().

63 {
64  return core_.isNonnull();
65 }
constexpr bool isNonnull() const noexcept
Definition: RefCore.h:28
bool art::PtrVectorBase::isNull ( ) const
inlinenoexceptinherited

Definition at line 68 of file PtrVectorBase.h.

Referenced by art::PtrVectorBase::updateCore().

69 {
70  return !isNonnull();
71 }
bool isNonnull() const noexcept
Definition: PtrVectorBase.h:62
template<typename T >
art::Ptr<T>::key_type art::PtrVectorBase::key ( Ptr< T > const &  ptr) const
inlinenoexceptinherited

Definition at line 119 of file PtrVectorBase.h.

120 {
121  return ptr.key();
122 }
template<typename T >
auto art::PtrVector< T >::max_size ( ) const
inline

Definition at line 309 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

310 {
311  return ptrs_.max_size();
312 }
data_t ptrs_
Definition: PtrVector.h:151
template<typename T>
template<typename U >
PtrVector<T>& art::PtrVector< T >::operator= ( std::initializer_list< Ptr< U >>  il)
template<typename T>
template<typename U >
PtrVector<T>& art::PtrVector< T >::operator= ( PtrVector< U > const &  other)
template<typename T>
template<typename U >
art::PtrVector<T>& art::PtrVector< T >::operator= ( std::initializer_list< Ptr< U >> const  il)
inline

Definition at line 192 of file PtrVector.h.

References art::PtrVector< T >::assign().

193 {
194  static_assert(std::is_same_v<T, U> || std::is_base_of_v<T, U> ||
195  std::is_base_of_v<U, T>,
196  "PtrVector: incompatible types");
197  assign(il);
198  return *this;
199 }
void assign(size_type n, Ptr< U > const &p)
Definition: PtrVector.h:403
template<typename T>
template<typename U >
art::PtrVector<T>& art::PtrVector< T >::operator= ( PtrVector< U > const &  other)
inline

Definition at line 204 of file PtrVector.h.

References fhicl::other, and art::PtrVector< T >::ptrs_.

205 {
206  static_assert(std::is_base_of_v<T, U> || std::is_base_of_v<U, T>,
207  "PtrVector: incompatible types");
208  PtrVectorBase::operator=(other);
209  ptrs_.clear();
210  cet::copy_all(other, std::back_inserter(ptrs_));
211  return *this;
212 }
data_t ptrs_
Definition: PtrVector.h:151
bool art::PtrVectorBase::operator== ( PtrVectorBase const &  other) const
inlineprotectednoexceptinherited

Definition at line 125 of file PtrVectorBase.h.

References fhicl::other.

Referenced by art::PtrVector< T >::operator==().

126 {
127  return core_ == other.core_;
128 }
template<typename T >
bool art::PtrVector< T >::operator== ( PtrVector< T > const &  other) const
inline

Definition at line 541 of file PtrVector.h.

References art::PtrVectorBase::operator==(), and art::PtrVector< T >::ptrs_.

542 {
543  return ptrs_ == other.ptrs_ && PtrVectorBase::operator==(other);
544 }
bool operator==(PtrVectorBase const &) const noexcept
data_t ptrs_
Definition: PtrVector.h:151
template<typename T >
art::Ptr< T > const & art::PtrVector< T >::operator[] ( unsigned long const  idx) const
inline

Definition at line 352 of file PtrVector.h.

References art::PtrVector< T >::begin().

353 {
354  return *(begin() + idx);
355 }
iterator begin()
Definition: PtrVector.h:217
template<typename T >
void art::PtrVector< T >::pop_back ( )
inline

Definition at line 457 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

Referenced by trkf::SpacePointFinder::produce().

458 {
459  ptrs_.pop_back();
460 }
data_t ptrs_
Definition: PtrVector.h:151
art::EDProductGetter const * art::PtrVectorBase::productGetter ( ) const
inlinenoexceptinherited

Definition at line 86 of file PtrVectorBase.h.

Referenced by art::PtrVector< T >::fill_from_offsets().

87 {
88  return core_.productGetter();
89 }
EDProductGetter const * productGetter() const noexcept
Definition: RefCore.cc:41
template<typename T >
template<typename U >
void art::PtrVector< T >::push_back ( Ptr< U > const &  p)
inline

Definition at line 435 of file PtrVector.h.

References art::PtrVector< T >::ptrs_, art::Ptr< T >::refCore(), and art::PtrVectorBase::updateCore().

Referenced by artg4tk::GenParticle::addChild(), vertex::AggregateVertexAna::analyze(), detsim::SimWireAna::analyze(), detsim::WienerFilterAna::analyze(), vertex::FeatureVertexFinderAna::analyze(), cluster::HoughLineFinderAna::analyze(), pfpf::PFPAna::analyze(), caldata::CalWireAna::analyze(), cluster::ClusterAna::analyze(), cluster::DBclusterAna::analyze(), trkf::SpacePointAna::analyze(), trkf::Track3DKalmanHitAlg::chopHitsOffSeeds(), cluster::BlurredClusteringAlg::ConvertBinsToRecobHits(), lar_cluster3d::Cluster3D::ConvertToArtOutput(), evdb_tool::DrawSkewHits::Draw(), evdb_tool::OpFlash3DDrawer::Draw(), evdb_tool::DrawGausHits::Draw(), cluster::EndPointAlg::EndPoint(), cluster::HoughBaseAlg::FastTransform(), cluster::ClusterMatchAlg::FillHitInfo(), trkf::KGTrack::fillHits(), trkf::SpacePointAlg::fillSpacePoints(), filter::MuonFilter::filter(), trkf::SeedFinderAlgorithm::FindSeeds(), lar_cluster3d::Cluster3D::findTrackSeeds(), trkf::FeatureTracker::Get3DFeaturePoints(), trkf::Track3DKalmanHit::getAllHits(), evd::RecoBaseDrawer::GetClusters(), evd::RecoBaseDrawer::GetEndPoint2D(), evd::RecoBaseDrawer::GetEvents(), evd::GraphClusterAlg::GetHitList(), trkf::SeedFinderModule::GetHitsFromEvent(), evd::RecoBaseDrawer::GetOpFlashes(), evd::RecoBaseDrawer::GetPFParticles(), evd::RecoBaseDrawer::GetSeeds(), trkf::SeedFinderAlgorithm::GetSeedsFromSortedHits(), evd::RecoBaseDrawer::GetSlices(), trkf::SeedFinderModule::GetSortedHitsFromClusters(), evd::RecoBaseDrawer::GetVertices(), evd::RecoBaseDrawer::GetWires(), nnet::EmTrack< N >::make_clusters(), lar_cluster3d::Cluster3D::MakeAndSaveSpacePoints(), trkf::SpacePointAlg::makeSpacePoints(), cluster::ClusterMatchAlg::Match_SpacePoint(), vertex::VertexCheater::produce(), trkf::FeatureTracker::produce(), trkf::SpacePointCheater::produce(), trkf::SpacePointFinder::produce(), trkf::TrackCheater::produce(), shwf::ShowerFinder::produce(), cluster::DBcluster::produce(), cluster::EndPointModule::produce(), trkf::SpacePts::produce(), trkf::Track3Dreco::produce(), ems::EMShower3D::produce(), trkf::Track3DKalman::produce(), shwf::ShowerReco::produce(), trkf::TrackKalmanCheater::produce(), vertex::VertexFinder2D::produce(), CRHitRemovalByPCA::produce(), evd::GraphCluster::produce(), vertex::FeatureVertexFinder::produce(), shower::EMShower::produce(), trkf::PMAlgTrajFitter::produce(), trkf::Track3DKalmanSPS::produce(), nnet::EmTrackClusterId2out::produce(), nnet::EmTrackClusterId::produce(), nnet::EmTrackMichelId::produce(), trkf::PMAlgTrackMaker::produce(), trkf::CosmicTracker::produce(), lar_cluster3d::Cluster3D::ProduceArtClusters(), and trkf::StitchAlg::WalkStitch().

436 {
437  // Ensure that types are compatible.
438  static_assert(std::is_same_v<T, U> || std::is_base_of_v<T, U> ||
439  std::is_base_of_v<U, T>,
440  "PtrVector: incompatible types");
441  updateCore(p.refCore());
442  ptrs_.push_back(p);
443 }
data_t ptrs_
Definition: PtrVector.h:151
void updateCore(RefCore const &core)
template<typename T >
auto art::PtrVector< T >::rbegin ( )
inline

Definition at line 245 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

246 {
247  return ptrs_.rbegin();
248 }
data_t ptrs_
Definition: PtrVector.h:151
template<typename T >
auto art::PtrVector< T >::rbegin ( ) const
inline

Definition at line 252 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

253 {
254  return ptrs_.rbegin();
255 }
data_t ptrs_
Definition: PtrVector.h:151
template<typename T >
auto art::PtrVector< T >::rend ( )
inline

Definition at line 259 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

260 {
261  return ptrs_.rend();
262 }
data_t ptrs_
Definition: PtrVector.h:151
template<typename T >
auto art::PtrVector< T >::rend ( ) const
inline

Definition at line 266 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

267 {
268  return ptrs_.rend();
269 }
data_t ptrs_
Definition: PtrVector.h:151
template<typename T >
void art::PtrVector< T >::resize ( size_type  n)
inline

Definition at line 316 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

317 {
318  ptrs_.resize(n);
319 }
data_t ptrs_
Definition: PtrVector.h:151
Char_t n[5]
void art::PtrVectorBase::setProductGetter ( EDProductGetter const *  g)
inlinenoexceptinherited

Definition at line 92 of file PtrVectorBase.h.

93 {
95 }
void setProductGetter(EDProductGetter const *) noexcept
Definition: RefCore.cc:57
template<typename T >
void art::PtrVector< T >::shrink_to_fit ( )
inline

Definition at line 344 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

345 {
346  ptrs_.shrink_to_fit();
347 }
data_t ptrs_
Definition: PtrVector.h:151
template<typename T >
auto art::PtrVector< T >::size ( void  ) const
inline

Definition at line 302 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

Referenced by vertex::AggregateVertexAna::analyze(), detsim::SimWireAna::analyze(), detsim::WienerFilterAna::analyze(), cluster::HoughLineFinderAna::analyze(), vertex::FeatureVertexFinderAna::analyze(), pfpf::PFPAna::analyze(), cluster::ClusterAna::analyze(), caldata::CalWireAna::analyze(), cluster::DBclusterAna::analyze(), trkf::SpacePointAna::analyze(), hit::DumpHits::analyze(), recob::DumpTracks::analyze(), trkf::TrackAna::anaStitch(), trkf::Track3DKalmanHitAlg::chopHitsOffSeeds(), evd::RecoBaseDrawer::Cluster2D(), trkf::SpacePointAlg::compatible(), cluster::BlurredClusteringAlg::ConvertBinsToClusters(), lar_cluster3d::Cluster3D::ConvertToArtOutput(), trkf::Track3DKalmanHit::createOutputs(), evdb_tool::DrawSkewHits::Draw(), cluster::EndPointAlg::EndPoint(), evd::RecoBaseDrawer::EndPoint2D(), evd::RecoBaseDrawer::Event2D(), evd::RecoBaseDrawer::Event3D(), trkf::SpacePointAlg::fillComplexSpacePoint(), trkf::KGTrack::fillHits(), evd::RecoBaseDrawer::FillQHisto(), trkf::SpacePointAlg::fillSpacePoint(), trkf::SpacePointAlg::fillSpacePoints(), evd::RecoBaseDrawer::FillTQHisto(), evd::RecoBaseDrawer::FillTQHistoDP(), filter::MuonFilter::filter(), vertex::FeatureVertexFinder::Find2dClusterVertexCandidates(), trkf::SeedFinderAlgorithm::FindSeeds(), evd::RecoBaseDrawer::GetClusters(), evd::RecoBaseDrawer::GetEndPoint2D(), trkf::TrackStitcher::GetHitsFromAssdSpacePoints(), trkf::TrackStitcher::GetHitsFromComponentTracks(), evd::RecoBaseDrawer::GetOpFlashes(), evd::RecoBaseDrawer::GetPFParticles(), evd::RecoBaseDrawer::GetSeeds(), evd::RecoBaseDrawer::GetSlices(), trkf::TrackStitcher::GetSpacePointsFromComponentTracks(), evd::RecoBaseDrawer::GetVertices(), evd::RecoBaseDrawer::GetWires(), trkf::Track3DKalmanHitAlg::growSeedIntoTracks(), trkf::SpacePointAlg::makeSpacePoints(), trkf::Track3DKalmanHitAlg::makeTracks(), cluster::ClusterMatchAlg::Match_SpacePoint(), cluster::MergeClusterAlg::MergeClusters(), art::PtrRemapper::operator()(), evd::RecoBaseDrawer::OpFlash2D(), evd::RecoBaseDrawer::OpFlashOrtho(), evd::RecoBaseDrawer::PFParticle3D(), evd::RecoBaseDrawer::PFParticleOrtho(), hit::HitFinder::produce(), vertex::VertexCheater::produce(), trkf::TCTrack::produce(), event::EventCheater::produce(), trkf::SpacePointFinder::produce(), trkf::TrackCheater::produce(), shwf::ShowerFinder::produce(), trkf::TrackStitcher::produce(), trkf::SpacePts::produce(), trkf::Track3Dreco::produce(), ems::EMShower3D::produce(), trkf::Track3DKalman::produce(), shwf::ShowerReco::produce(), trkf::TrackKalmanCheater::produce(), vertex::VertexFinder2D::produce(), shower::EMShower::produce(), trkf::PMAlgTrajFitter::produce(), trkf::Track3DKalmanSPS::produce(), trkf::PMAlgTrackMaker::produce(), evd::RecoBaseDrawer::Seed2D(), evd::RecoBaseDrawer::Seed3D(), evd::RecoBaseDrawer::SeedOrtho(), trkf::SpacePointAlg::separation(), evd::RecoBaseDrawer::Slice2D(), evd::RecoBaseDrawer::Slice3D(), sp_sort_nsppts(), evd::RecoBaseDrawer::Vertex2D(), evd::RecoBaseDrawer::Vertex3D(), evd::RecoBaseDrawer::VertexOrtho(), trkf::StitchAlg::WalkStitch(), and evd::RecoBaseDrawer::Wire2D().

303 {
304  return ptrs_.size();
305 }
data_t ptrs_
Definition: PtrVector.h:151
template<typename T >
void art::PtrVector< T >::sort ( void  )
inline

Definition at line 548 of file PtrVector.h.

549 {
550  sort(std::less<T>{});
551 }
template<typename T >
template<class Comp >
void art::PtrVector< T >::sort ( Comp  comp)
inline

Definition at line 556 of file PtrVector.h.

References art::PtrVector< T >::ptrs_.

557 {
558  cet::sort_all(ptrs_, ComparePtrs{comp});
559 }
data_t ptrs_
Definition: PtrVector.h:151
void art::PtrVectorBase::swap ( PtrVectorBase other)
inlineprotectedinherited

Definition at line 112 of file PtrVectorBase.h.

References art::PtrVectorBase::core_.

Referenced by art::PtrVectorBase::fillPtrs(), and art::PtrVector< T >::swap().

113 {
114  core_.swap(other.core_);
115 }
void swap(RefCore &other)
Definition: RefCore.cc:63
template<typename T >
void art::PtrVector< T >::swap ( key_type  k1,
key_type  k2 
)
inline

Definition at line 526 of file PtrVector.h.

References art::PtrVector< T >::ptrs_, and art::swap().

527 {
528  std::swap(ptrs_[k1], ptrs_[k2]);
529 }
void swap(PtrVector< T > &, PtrVector< T > &)
Definition: PtrVector.h:595
data_t ptrs_
Definition: PtrVector.h:151
void art::PtrVectorBase::updateCore ( RefCore const &  core)
protectedinherited

Definition at line 17 of file PtrVectorBase.cc.

References art::PtrVectorBase::core_, art::PtrVectorBase::id(), art::RefCore::id(), art::errors::InvalidReference, art::PtrVectorBase::isNull(), art::RefCore::isNull(), art::RefCore::productGetter(), art::RefCore::productPtr(), art::RefCore::setProductGetter(), and art::RefCore::setProductPtr().

Referenced by art::PtrVector< T >::assign(), art::PtrVector< T >::emplace_back(), art::PtrVector< T >::insert(), art::PtrVector< T >::PtrVector(), and art::PtrVector< T >::push_back().

18 {
19  if (productToBeInserted.isNull()) {
20  throw art::Exception(errors::InvalidReference, "Inconsistency")
21  << "art::PtrVectorBase::updateCore: Ptr has invalid (zero) product ID,\n"
22  "so it cannot be added to a PtrVector. id should be ("
23  << id() << ")\n";
24  }
25  if (isNull()) {
26  core_ = productToBeInserted;
27  return;
28  }
29  if (core_.id() != productToBeInserted.id()) {
30  throw art::Exception(errors::InvalidReference, "Inconsistency")
31  << "art::PtrVectorBase::updateCore: Ptr is inconsistent with\n"
32  "PtrVector. id = ("
33  << productToBeInserted.id() << "), should be (" << core_.id() << ")\n";
34  }
35  if (core_.productGetter() == nullptr &&
36  productToBeInserted.productGetter() != nullptr) {
37  core_.setProductGetter(productToBeInserted.productGetter());
38  }
39  if (core_.productPtr() == nullptr &&
40  productToBeInserted.productPtr() != nullptr) {
41  core_.setProductPtr(productToBeInserted.productPtr());
42  }
43 }
EDProductGetter const * productGetter() const noexcept
Definition: RefCore.cc:41
ProductID id() const noexcept
Definition: PtrVectorBase.h:80
bool isNull() const noexcept
Definition: PtrVectorBase.h:68
void setProductGetter(EDProductGetter const *) noexcept
Definition: RefCore.cc:57
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
void const * productPtr() const noexcept
Definition: RefCore.cc:34
void setProductPtr(void const *prodPtr) const noexcept
Definition: RefCore.cc:48
constexpr ProductID id() const noexcept
Definition: RefCore.h:50
template<typename T >
void art::PtrVector< T >::zeroTransients ( )
inlineoverrideprivatevirtual

Implements art::PtrVectorBase.

Definition at line 587 of file PtrVector.h.

References art::PtrVector< T >::ptrs_, and tmp.

588 {
589  data_t tmp;
590  ptrs_.swap(tmp);
591 }
Float_t tmp
Definition: plot.C:35
std::vector< Ptr< T >> data_t
Definition: PtrVector.h:45
data_t ptrs_
Definition: PtrVector.h:151

Member Data Documentation


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