Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
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 102 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 217 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 237 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 239 of file Assns.h.

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

Definition at line 234 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 232 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 235 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 233 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 240 of file Assns.h.

Constructor & Destructor Documentation

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

Definition at line 484 of file Assns.h.

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

Definition at line 491 of file Assns.h.

492  : base(other), data_(other.data_)
493 {}
Assns< L, R > base
Definition: Assns.h:217
std::vector< data_t > data_
Definition: Assns.h:292

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 557 of file Assns.h.

560 {
561  static_assert(std::is_same_v<typename Ds::value_type, D>,
562  "\n\nart error: The data argument must be a container whose "
563  "value_type is D corresponding\n"
564  " to an Assns<L, R, D> object.\n");
565  assert(lefts.size() == data.size());
566  base::addMany(lefts, right);
567  data_.insert(data_.end(), data.begin(), data.end());
568 }
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:557
data_t const & data(typename std::vector< data_t >::size_type index) const
Definition: Assns.h:532
std::vector< data_t > data_
Definition: Assns.h:292
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 573 of file Assns.h.

576 {
577  static_assert(std::is_same_v<typename Ds::value_type, D>,
578  "\n\nart error: The data argument must be a container whose "
579  "value_type is D corresponding\n"
580  " to an Assns<L, R, D> object.\n");
581  assert(rights.size() == data.size());
582  base::addMany(left, rights);
583  data_.insert(data_.end(), data.begin(), data.end());
584 }
void addMany(Ls const &lefts, Ptr< right_t > const &right, Ds const &data)
Definition: Assns.h:557
data_t const & data(typename std::vector< data_t >::size_type index) const
Definition: Assns.h:532
std::vector< data_t > data_
Definition: Assns.h:292
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 546 of file Assns.h.

549 {
551  data_.push_back(data);
552 }
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:532
std::vector< data_t > data_
Definition: Assns.h:292
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:546
template<typename L, typename R, typename D>
void art::Assns< L, R, D >::aggregate ( Assns< L, R, D > const &  ) const
inline

Definition at line 282 of file Assns.h.

283  {}
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 504 of file Assns.h.

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

Definition at line 276 of file Assns.h.

277  {
278  return 11;
279  }
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 532 of file Assns.h.

533 {
534  return data_.at(index);
535 }
std::vector< data_t > data_
Definition: Assns.h:292
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 539 of file Assns.h.

540 {
541  return data_.at(it.getIndex());
542 }
std::vector< data_t > data_
Definition: Assns.h:292
template<typename L , typename R , typename D >
art::Assns< L, R, D >::const_iterator art::Assns< L, R, D >::end ( ) const
inline

Definition at line 511 of file Assns.h.

512 {
513  return const_iterator{*this};
514 }
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 597 of file Assns.h.

599 {
600  return makePartner_(wanted_wrapper_type);
601 }
std::unique_ptr< EDProduct > makePartner_(std::type_info const &wanted_wrapper_type) const override
Definition: Assns.h:618
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 618 of file Assns.h.

620 {
621  using bp = typename base::partner_t;
622  std::unique_ptr<art::EDProduct> result;
623  if (wanted_wrapper_type == typeid(Wrapper<partner_t>)) { // Partner.
624  result =
625  std::make_unique<Wrapper<partner_t>>(std::make_unique<partner_t>(*this));
626  } else if (wanted_wrapper_type == typeid(Wrapper<base>)) { // Base.
627  result = std::make_unique<Wrapper<base>>(
628  std::make_unique<base>(static_cast<base>(*this)));
629  } else if (wanted_wrapper_type == typeid(Wrapper<bp>)) { // Base of partner.
630  result = std::make_unique<Wrapper<bp>>(
631  std::make_unique<bp>(static_cast<base>(*this)));
632  } else { // Oops.
633  detail::throwPartnerException(typeid(*this), wanted_wrapper_type);
634  }
635  return result;
636 }
static QCString result
void throwPartnerException(std::type_info const &generator, std::type_info const &wanted_wrapper_type)
art::Assns< right_t, left_t, data_t > partner_t
Definition: Assns.h:235
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 518 of file Assns.h.

519 {
520  return const_reverse_iterator{*this, size()};
521 }
size_type size() const
Definition: Assns.h:497
typename art::const_AssnsIter< L, R, D, Direction::Reverse > const_reverse_iterator
Definition: Assns.h:239
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 525 of file Assns.h.

526 {
527  return const_reverse_iterator{*this, 0};
528 }
typename art::const_AssnsIter< L, R, D, Direction::Reverse > const_reverse_iterator
Definition: Assns.h:239
template<typename L , typename R , typename D >
art::Assns< L, R, D >::size_type art::Assns< L, R, D >::size ( ) const
inline

Definition at line 497 of file Assns.h.

498 {
499  return base::size();
500 }
size_type size() const
Definition: Assns.h:497
template<typename L, typename R, typename D>
void art::Assns< L, R, D >::swap ( art::Assns< L, R, D > &  other)
inline

Definition at line 588 of file Assns.h.

589 {
590  using std::swap;
591  base::swap_(other);
592  swap(data_, other.data_);
593 }
void swap(art::Assns< L, R, D > &other)
Definition: Assns.h:588
void swap(Handle< T > &a, Handle< T > &b)
void swap_(art::Assns< L, R, void > &other) override
Definition: Assns.h:605
std::vector< data_t > data_
Definition: Assns.h:292
template<typename L, typename R, typename D >
void art::Assns< L, R, D >::swap_ ( art::Assns< L, R, void > &  other)
inlineoverrideprivate

Definition at line 605 of file Assns.h.

606 {
607  try {
608  swap(dynamic_cast<Assns<L, R, D>&>(other));
609  }
610  catch (std::bad_cast const&) {
611  throw Exception(errors::LogicError, "AssnsBadCast")
612  << "Attempt to swap base with derived!\n";
613  }
614 }
void swap(art::Assns< L, R, D > &other)
Definition: Assns.h:588
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 286 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

Definition at line 292 of file Assns.h.


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