LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
art::PtrVectorBase Class Referenceabstract

#include "PtrVectorBase.h"

Inheritance diagram for art::PtrVectorBase:
art::PtrVector< T > art::PtrVector< recob::EndPoint2D > art::PtrVector< recob::Hit > art::PtrVector< recob::Seed > art::PtrVector< recob::Track > art::PtrVector< recob::Vertex >

Public Types

typedef unsigned long key_type
 
typedef std::vector< key_typeindices_t
 
typedef indices_t::size_type size_type
 

Public Member Functions

virtual ~PtrVectorBase ()=default
 
bool isNonnull () const
 
bool isNull () const
 
bool isAvailable () const
 
ProductID id () const
 
EDProductGetter const * productGetter () const
 
void setProductGetter (EDProductGetter *g) const
 
template<typename T >
art::Ptr< T >::key_type key (Ptr< T > const &ptr) const
 

Protected Member Functions

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

Private Member Functions

void reserve (size_type n)
 
void fillPtrs () const
 
template<typename T >
Ptr< T >::key_type key (Ptr< T > const &ptr) const
 
virtual void fill_offsets (indices_t &indices)=0
 
virtual void fill_from_offsets (indices_t const &indices) const =0
 
virtual void zeroTransients ()=0
 

Private Attributes

RefCore core_
 
indices_t indicies_
 

Friends

class art::detail::PtrVectorBaseStreamer
 

Detailed Description

Definition at line 21 of file PtrVectorBase.h.

Member Typedef Documentation

Definition at line 24 of file PtrVectorBase.h.

typedef unsigned long art::PtrVectorBase::key_type

Definition at line 23 of file PtrVectorBase.h.

typedef indices_t::size_type art::PtrVectorBase::size_type

Definition at line 27 of file PtrVectorBase.h.

Constructor & Destructor Documentation

virtual art::PtrVectorBase::~PtrVectorBase ( )
virtualdefault
art::PtrVectorBase::PtrVectorBase ( )
protecteddefault

Member Function Documentation

void art::PtrVectorBase::clear ( void  )
inlineprotected

Definition at line 102 of file PtrVectorBase.h.

References tmp.

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

103 {
104  core_ = RefCore();
105  indices_t tmp;
106  indicies_.swap(tmp); // Free up memory
107 }
Float_t tmp
Definition: plot.C:37
std::vector< key_type > indices_t
Definition: PtrVectorBase.h:24
virtual void art::PtrVectorBase::fill_from_offsets ( indices_t const &  indices) const
privatepure virtual
void art::PtrVectorBase::fillPtrs ( ) const
private

Definition at line 6 of file PtrVectorBase.cc.

References fill_from_offsets(), indicies_, swap(), and tmp.

7 {
8  if (indicies_.size() == 0)
9  return; // Empty or already done.
11 
12  using std::swap;
13  indices_t tmp;
14  swap(indicies_, tmp); // Zero -- finished with these.
15 }
void swap(PtrVectorBase &)
Float_t tmp
Definition: plot.C:37
virtual void fill_from_offsets(indices_t const &indices) const =0
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
std::vector< key_type > indices_t
Definition: PtrVectorBase.h:24
art::ProductID art::PtrVectorBase::id ( ) const
inline

Definition at line 84 of file PtrVectorBase.h.

Referenced by updateCore().

85 {
86  return core_.id();
87 }
ProductID id() const
Definition: RefCore.h:93
bool art::PtrVectorBase::isAvailable ( ) const
inline

Definition at line 78 of file PtrVectorBase.h.

79 {
80  return core_.isAvailable();
81 }
bool isAvailable() const
Definition: RefCore.cc:15
bool art::PtrVectorBase::isNonnull ( ) const
inline

Definition at line 66 of file PtrVectorBase.h.

67 {
68  return core_.isNonnull();
69 }
bool isNonnull() const
Definition: RefCore.h:76
bool art::PtrVectorBase::isNull ( ) const
inline

Definition at line 72 of file PtrVectorBase.h.

Referenced by vertex::AggregateVertex::MatchV2T(), and updateCore().

73 {
74  return !isNonnull();
75 }
bool isNonnull() const
Definition: PtrVectorBase.h:66
template<typename T >
Ptr<T>::key_type art::PtrVectorBase::key ( Ptr< T > const &  ptr) const
private
template<typename T >
art::Ptr<T>::key_type art::PtrVectorBase::key ( Ptr< T > const &  ptr) const
inline

Definition at line 123 of file PtrVectorBase.h.

References art::Ptr< T >::key().

124 {
125  return ptr.key();
126 }
bool art::PtrVectorBase::operator== ( PtrVectorBase const &  other) const
inlineprotected

Definition at line 129 of file PtrVectorBase.h.

References core_.

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

130 {
131  return core_ == other.core_;
132 }
art::EDProductGetter const * art::PtrVectorBase::productGetter ( ) const
inline

Definition at line 90 of file PtrVectorBase.h.

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

91 {
92  return core_.productGetter();
93 }
EDProductGetter const * productGetter() const
Definition: RefCore.h:105
void art::PtrVectorBase::reserve ( size_type  n)
inlineprivate

Definition at line 110 of file PtrVectorBase.h.

111 {
112  indicies_.reserve(n);
113 }
Char_t n[5]
void art::PtrVectorBase::setProductGetter ( EDProductGetter g) const
inline

Definition at line 96 of file PtrVectorBase.h.

97 {
99 }
void setProductGetter(EDProductGetter const *prodGetter) const
Definition: RefCore.h:117
void art::PtrVectorBase::swap ( PtrVectorBase other)
inlineprotected

Definition at line 116 of file PtrVectorBase.h.

References core_.

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

117 {
118  core_.swap(other.core_);
119 }
void swap(RefCore &other)
Definition: RefCore.h:123
void art::PtrVectorBase::updateCore ( RefCore const &  core)
protected

Definition at line 18 of file PtrVectorBase.cc.

References core_, id(), art::RefCore::id(), art::errors::InvalidReference, 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 >::insert(), art::PtrVector< T >::PtrVector(), and art::PtrVector< T >::push_back().

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

Friends And Related Function Documentation

friend class art::detail::PtrVectorBaseStreamer
friend

Definition at line 62 of file PtrVectorBase.h.

Member Data Documentation

RefCore art::PtrVectorBase::core_
private

Definition at line 55 of file PtrVectorBase.h.

Referenced by operator==(), swap(), and updateCore().

indices_t art::PtrVectorBase::indicies_
mutableprivate

Definition at line 56 of file PtrVectorBase.h.

Referenced by fillPtrs().


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