LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
art::Assns< L, R, D > Class Template Reference

#include "Assns.h"

Public Types

using left_t = typename base::left_t
 
using right_t = typename base::right_t
 
using data_t = D
 
using partner_t = art::Assns< right_t, left_t, data_t >
 
using const_iterator = typename art::const_AssnsIter< L, R, D, Direction::Forward >
 
using const_reverse_iterator = typename art::const_AssnsIter< L, R, D, Direction::Reverse >
 
using size_type = typename base::size_type
 

Public Member Functions

 Assns ()
 
 Assns (partner_t const &other)
 
size_type size () const
 
const_iterator begin () const
 
const_iterator end () const
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
data_t const & data (typename std::vector< data_t >::size_type index) const
 
data_t const & data (const_iterator it) const
 
void addSingle (Ptr< left_t > const &left, Ptr< right_t > const &right, data_t const &data)
 
template<typename Ls , typename Ds >
void addMany (Ls const &lefts, Ptr< right_t > const &right, Ds const &data)
 
template<typename Rs , typename Ds >
void addMany (Ptr< left_t > const &left, Rs const &rights, Ds const &data)
 
void swap (art::Assns< L, R, D > &other)
 
std::unique_ptr< EDProductmakePartner (std::type_info const &wanted_wrapper_type) const
 
void aggregate (Assns const &) const
 

Static Public Member Functions

static short Class_Version ()
 

Private Types

using base = Assns< L, R >
 

Private Member Functions

void swap_ (art::Assns< L, R, void > &other) override
 
std::unique_ptr< EDProductmakePartner_ (std::type_info const &wanted_wrapper_type) const override
 

Private Attributes

std::vector< data_tdata_
 

Friends

class art::Assns< right_t, left_t, data_t >
 

Detailed Description

template<typename L, typename R, typename D>
class art::Assns< L, R, D >

Definition at line 103 of file Assns.h.

Member Typedef Documentation

template<typename L, typename R, typename D>
using art::Assns< L, R, D >::base = Assns<L, R>
private

Definition at line 219 of file Assns.h.

template<typename L, typename R, typename D>
using art::Assns< L, R, D >::const_iterator = typename art::const_AssnsIter<L, R, D, Direction::Forward>

Definition at line 239 of file Assns.h.

template<typename L, typename R, typename D>
using art::Assns< L, R, D >::const_reverse_iterator = typename art::const_AssnsIter<L, R, D, Direction::Reverse>

Definition at line 241 of file Assns.h.

template<typename L, typename R, typename D>
using art::Assns< L, R, D >::data_t = D

Definition at line 236 of file Assns.h.

template<typename L, typename R, typename D>
using art::Assns< L, R, D >::left_t = typename base::left_t

Definition at line 234 of file Assns.h.

template<typename L, typename R, typename D>
using art::Assns< L, R, D >::partner_t = art::Assns<right_t, left_t, data_t>

Definition at line 237 of file Assns.h.

template<typename L, typename R, typename D>
using art::Assns< L, R, D >::right_t = typename base::right_t

Definition at line 235 of file Assns.h.

template<typename L, typename R, typename D>
using art::Assns< L, R, D >::size_type = typename base::size_type

Definition at line 242 of file Assns.h.

Constructor & Destructor Documentation

template<typename L , typename R , typename D >
art::Assns< L, R, D >::Assns ( )
inline

Definition at line 487 of file Assns.h.

488 {
489  static_assert(!std::is_pointer_v<D>,
490  "Data template argument must not be pointer type!");
491 }
template<typename L , typename R , typename D >
art::Assns< L, R, D >::Assns ( partner_t const &  other)

Definition at line 494 of file Assns.h.

495  : base(other), data_(other.data_)
496 {}
Assns< L, R > base
Definition: Assns.h:219
std::vector< data_t > data_
Definition: Assns.h:294

Member Function Documentation

template<typename L , typename R , typename D >
template<typename Ls , typename Ds >
void art::Assns< L, R, D >::addMany ( Ls const &  lefts,
Ptr< right_t > const &  right,
Ds const &  data 
)
inline

Definition at line 560 of file Assns.h.

References art::Assns< L, R, D >::data_.

Referenced by art::Assns< L, R, D >::addMany().

563 {
564  static_assert(std::is_same_v<typename Ds::value_type, D>,
565  "\n\nart error: The data argument must be a container whose "
566  "value_type is D corresponding\n"
567  " to an Assns<L, R, D> object.\n");
568  assert(lefts.size() == data.size());
569  base::addMany(lefts, right);
570  data_.insert(data_.end(), data.begin(), data.end());
571 }
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:102
void addMany(Ls const &lefts, Ptr< right_t > const &right, Ds const &data)
Definition: Assns.h:560
data_t const & data(typename std::vector< data_t >::size_type index) const
Definition: Assns.h:535
std::vector< data_t > data_
Definition: Assns.h:294
template<typename L , typename R , typename D >
template<typename Rs , typename Ds >
void art::Assns< L, R, D >::addMany ( Ptr< left_t > const &  left,
Rs const &  rights,
Ds const &  data 
)

Definition at line 576 of file Assns.h.

References art::Assns< L, R, D >::addMany(), and art::Assns< L, R, D >::data_.

579 {
580  static_assert(std::is_same_v<typename Ds::value_type, D>,
581  "\n\nart error: The data argument must be a container whose "
582  "value_type is D corresponding\n"
583  " to an Assns<L, R, D> object.\n");
584  assert(rights.size() == data.size());
585  base::addMany(left, rights);
586  data_.insert(data_.end(), data.begin(), data.end());
587 }
void addMany(Ls const &lefts, Ptr< right_t > const &right, Ds const &data)
Definition: Assns.h:560
data_t const & data(typename std::vector< data_t >::size_type index) const
Definition: Assns.h:535
std::vector< data_t > data_
Definition: Assns.h:294
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:94
template<typename L , typename R , typename D >
void art::Assns< L, R, D >::addSingle ( Ptr< left_t > const &  left,
Ptr< right_t > const &  right,
data_t const &  data 
)
inline

Definition at line 549 of file Assns.h.

References art::Assns< L, R, D >::data_.

Referenced by art::Assns< L, R, void >::addMany(), util::CreateAssn(), evgb::util::CreateAssn(), util::CreateAssnD(), evgb::util::CreateAssnD(), t0::IndirectHitParticleAssns::CreateHitParticleAssociations(), t0::DirectHitParticleAssns::CreateHitParticleAssociations(), trkf::Track3DKalmanHit::createOutputs(), reco3d::SpacePointSolver::FillSystemToSpacePointsAndAssns(), lar_cluster3d::StandardHit3DBuilder::makeRawDigitAssns(), lar_cluster3d::SnippetHit3DBuilder::makeRawDigitAssns(), lar_cluster3d::StandardHit3DBuilder::makeWireAssns(), and lar_cluster3d::SnippetHit3DBuilder::makeWireAssns().

552 {
554  data_.push_back(data);
555 }
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:102
data_t const & data(typename std::vector< data_t >::size_type index) const
Definition: Assns.h:535
std::vector< data_t > data_
Definition: Assns.h:294
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:94
void addSingle(Ptr< left_t > const &left, Ptr< right_t > const &right, data_t const &data)
Definition: Assns.h:549
template<typename L, typename R, typename D>
void art::Assns< L, R, D >::aggregate ( Assns< L, R, D > const &  ) const
inline

Definition at line 284 of file Assns.h.

285  {}
template<typename L , typename R , typename D >
art::Assns< L, R, D >::const_iterator art::Assns< L, R, D >::begin ( ) const
inline

Definition at line 507 of file Assns.h.

Referenced by trkf::KalmanFilterTrajectoryFitter::produce(), and trkf::KalmanFilterFinalTrackFitter::produce().

508 {
509  return const_iterator{*this, 0};
510 }
template<typename L, typename R, typename D>
static short art::Assns< L, R, D >::Class_Version ( )
inlinestatic

Definition at line 278 of file Assns.h.

279  {
280  return 11;
281  }
template<typename L , typename R , typename D >
art::Assns< L, R, D >::data_t const & art::Assns< L, R, D >::data ( typename std::vector< data_t >::size_type  index) const
inline

Definition at line 535 of file Assns.h.

References art::Assns< L, R, D >::data_.

536 {
537  return data_.at(index);
538 }
std::vector< data_t > data_
Definition: Assns.h:294
template<typename L , typename R , typename D >
art::Assns< L, R, D >::data_t const & art::Assns< L, R, D >::data ( const_iterator  it) const
inline

Definition at line 542 of file Assns.h.

References art::Assns< L, R, D >::data_.

543 {
544  return data_.at(it.getIndex());
545 }
std::vector< data_t > data_
Definition: Assns.h:294
template<typename L , typename R , typename D >
std::unique_ptr< art::EDProduct > art::Assns< L, R, D >::makePartner ( std::type_info const &  wanted_wrapper_type) const
inline

Definition at line 600 of file Assns.h.

References art::Assns< L, R, D >::makePartner_().

602 {
603  return makePartner_(wanted_wrapper_type);
604 }
std::unique_ptr< EDProduct > makePartner_(std::type_info const &wanted_wrapper_type) const override
Definition: Assns.h:621
template<typename L , typename R , typename D >
std::unique_ptr< art::EDProduct > art::Assns< L, R, D >::makePartner_ ( std::type_info const &  wanted_wrapper_type) const
overrideprivate

Definition at line 621 of file Assns.h.

References art::detail::throwPartnerException().

Referenced by art::Assns< L, R, void >::makePartner(), and art::Assns< L, R, D >::makePartner().

623 {
624  using bp = typename base::partner_t;
625  std::unique_ptr<art::EDProduct> result;
626  if (wanted_wrapper_type == typeid(Wrapper<partner_t>)) { // Partner.
627  result =
628  std::make_unique<Wrapper<partner_t>>(std::make_unique<partner_t>(*this));
629  } else if (wanted_wrapper_type == typeid(Wrapper<base>)) { // Base.
630  result = std::make_unique<Wrapper<base>>(
631  std::make_unique<base>(static_cast<base>(*this)));
632  } else if (wanted_wrapper_type == typeid(Wrapper<bp>)) { // Base of partner.
633  result = std::make_unique<Wrapper<bp>>(
634  std::make_unique<bp>(static_cast<base>(*this)));
635  } else { // Oops.
636  detail::throwPartnerException(typeid(*this), wanted_wrapper_type);
637  }
638  return result;
639 }
void throwPartnerException(std::type_info const &generator, std::type_info const &wanted_wrapper_type)
Assns< L, R > base
Definition: Assns.h:219
art::Assns< right_t, left_t, data_t > partner_t
Definition: Assns.h:237
template<typename L , typename R , typename D >
art::Assns< L, R, D >::const_reverse_iterator art::Assns< L, R, D >::rbegin ( ) const
inline

Definition at line 521 of file Assns.h.

References art::Assns< L, R, D >::size().

522 {
523  return const_reverse_iterator{*this, size()};
524 }
size_type size() const
Definition: Assns.h:500
typename art::const_AssnsIter< L, R, D, Direction::Reverse > const_reverse_iterator
Definition: Assns.h:241
template<typename L , typename R , typename D >
art::Assns< L, R, D >::const_reverse_iterator art::Assns< L, R, D >::rend ( ) const
inline

Definition at line 528 of file Assns.h.

529 {
530  return const_reverse_iterator{*this, 0};
531 }
typename art::const_AssnsIter< L, R, D, Direction::Reverse > const_reverse_iterator
Definition: Assns.h:241
template<typename L , typename R , typename D >
art::Assns< L, R, D >::size_type art::Assns< L, R, D >::size ( void  ) const
inline
template<typename L, typename R, typename D>
void art::Assns< L, R, D >::swap ( art::Assns< L, R, D > &  other)
inline

Definition at line 591 of file Assns.h.

References art::Assns< L, R, D >::data_, and art::Assns< L, R, D >::swap_().

Referenced by art::Assns< L, R, void >::fill_transients(), and art::Assns< L, R, D >::swap_().

592 {
593  using std::swap;
594  base::swap_(other);
595  swap(data_, other.data_);
596 }
void swap(art::Assns< L, R, D > &other)
Definition: Assns.h:591
void swap_(art::Assns< L, R, void > &other) override
Definition: Assns.h:608
std::vector< data_t > data_
Definition: Assns.h:294
void swap(lar::deep_const_fwd_iterator_nested< CITER, INNERCONTEXTRACT > &a, lar::deep_const_fwd_iterator_nested< CITER, INNERCONTEXTRACT > &b)
template<typename L, typename R, typename D >
void art::Assns< L, R, D >::swap_ ( art::Assns< L, R, void > &  other)
inlineoverrideprivate

Definition at line 608 of file Assns.h.

References art::errors::LogicError, and art::Assns< L, R, D >::swap().

Referenced by art::Assns< L, R, void >::swap(), and art::Assns< L, R, D >::swap().

609 {
610  try {
611  swap(dynamic_cast<Assns<L, R, D>&>(other));
612  }
613  catch (std::bad_cast const&) {
614  throw Exception(errors::LogicError, "AssnsBadCast")
615  << "Attempt to swap base with derived!\n";
616  }
617 }
void swap(art::Assns< L, R, D > &other)
Definition: Assns.h:591
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66

Friends And Related Function Documentation

template<typename L, typename R, typename D>
friend class art::Assns< right_t, left_t, data_t >
friend

Definition at line 288 of file Assns.h.

Member Data Documentation

template<typename L, typename R, typename D>
std::vector<data_t> art::Assns< L, R, D >::data_
private

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