Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
art::Assns< L, R, void > Class Template Reference

#include <Assns.h>

Inheritance diagram for art::Assns< L, R, void >:
art::detail::AssnsBase

Public Types

using left_t = L
 
using right_t = R
 
using partner_t = art::Assns< right_t, left_t, void >
 
using assn_t = typename ptrs_t::value_type
 
using const_iterator = typename ptrs_t::const_iterator
 
using size_type = typename ptrs_t::size_type
 

Public Member Functions

 Assns ()
 
 Assns (partner_t const &other)
 
virtual ~Assns ()=default
 
const_iterator begin () const
 
const_iterator end () const
 
assn_t const & operator[] (size_type index) const
 
assn_t const & at (size_type index) const
 
size_type size () const
 
std::string className () const
 
void addSingle (Ptr< left_t > const &left, Ptr< right_t > const &right)
 
template<typename Ls >
void addMany (Ls const &lefts, Ptr< right_t > const &right)
 
template<typename Rs >
void addMany (Ptr< left_t > const &left, Rs const &rights)
 
void swap (art::Assns< L, R, void > &other)
 
std::unique_ptr< EDProductmakePartner (std::type_info const &wanted_wrapper_type) const
 
void aggregate (Assns const &) const
 
- Public Member Functions inherited from art::detail::AssnsBase
virtual ~AssnsBase () noexcept=default
 

Static Public Member Functions

static short Class_Version ()
 

Protected Member Functions

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

Private Types

using ptrs_t = std::vector< std::pair< Ptr< left_t >, Ptr< right_t >>>
 
using ptr_data_t = std::vector< std::pair< RefCore, std::size_t >>
 

Private Member Functions

virtual bool left_first () const
 
void fill_transients () override
 
void fill_from_transients () override
 

Private Attributes

ptrs_t ptrs_ {}
 
ptr_data_t ptr_data_1_ {}
 transient More...
 
ptr_data_t ptr_data_2_ {}
 

Friends

class detail::AssnsStreamer
 
class art::Assns< right_t, left_t, void >
 

Detailed Description

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

Definition at line 123 of file Assns.h.

Member Typedef Documentation

template<typename L , typename R >
using art::Assns< L, R, void >::assn_t = typename ptrs_t::value_type

Definition at line 134 of file Assns.h.

template<typename L , typename R >
using art::Assns< L, R, void >::const_iterator = typename ptrs_t::const_iterator

Definition at line 135 of file Assns.h.

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

Definition at line 125 of file Assns.h.

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

Definition at line 127 of file Assns.h.

template<typename L , typename R >
using art::Assns< L, R, void >::ptr_data_t = std::vector<std::pair<RefCore, std::size_t>>
private

Definition at line 131 of file Assns.h.

template<typename L , typename R >
using art::Assns< L, R, void >::ptrs_t = std::vector<std::pair<Ptr<left_t>, Ptr<right_t>>>
private

Definition at line 130 of file Assns.h.

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

Definition at line 126 of file Assns.h.

template<typename L , typename R >
using art::Assns< L, R, void >::size_type = typename ptrs_t::size_type

Definition at line 137 of file Assns.h.

Constructor & Destructor Documentation

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

Definition at line 299 of file Assns.h.

300 {}
template<typename L , typename R >
art::Assns< L, R, void >::Assns ( partner_t const &  other)
inline

Definition at line 303 of file Assns.h.

304 {
305  ptrs_.reserve(other.ptrs_.size());
307  other.ptrs_, std::back_inserter(ptrs_), [](auto const& pr) {
308  using pr_t = typename ptrs_t::value_type;
309  return pr_t{pr.second, pr.first};
310  });
311 }
auto transform_all(Container &, OutputIt, UnaryOp)
template<typename L , typename R >
virtual art::Assns< L, R, void >::~Assns ( )
virtualdefault

Member Function Documentation

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

Definition at line 367 of file Assns.h.

368 {
369  static_assert(std::is_same_v<typename Ls::value_type, art::Ptr<L>>,
370  "\n\nart error: The first argument must be a container whose "
371  "value_type is art::Ptr<L>\n"
372  " corresponding to an Assns<L, R(, D)> object.\n");
373  for (auto const& left : lefts) {
374  addSingle(left, right);
375  }
376 }
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 addSingle(Ptr< left_t > const &left, Ptr< right_t > const &right)
Definition: Assns.h:358
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 >
template<typename Rs >
void art::Assns< L, R, void >::addMany ( Ptr< left_t > const &  left,
Rs const &  rights 
)
inline

Definition at line 381 of file Assns.h.

382 {
383  static_assert(std::is_same_v<typename Rs::value_type, art::Ptr<R>>,
384  "\n\nart error: The second argument must be a container whose "
385  "value_type is art::Ptr<R>\n"
386  " corresponding to an Assns<L, R(, D)> object.\n");
387  for (auto const& right : rights) {
388  addSingle(left, right);
389  }
390 }
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 addSingle(Ptr< left_t > const &left, Ptr< right_t > const &right)
Definition: Assns.h:358
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 >
void art::Assns< L, R, void >::addSingle ( Ptr< left_t > const &  left,
Ptr< right_t > const &  right 
)
inline

Definition at line 358 of file Assns.h.

360 {
361  ptrs_.emplace_back(left, right);
362 }
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:102
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 >
void art::Assns< L, R, void >::aggregate ( Assns< L, R, void > const &  ) const
inline

Definition at line 173 of file Assns.h.

174  {}
template<typename L , typename R >
art::Assns< L, R, void >::assn_t const & art::Assns< L, R, void >::at ( size_type  index) const
inline

Definition at line 336 of file Assns.h.

337 {
338  return ptrs_.at(index);
339 }
template<typename L , typename R >
art::Assns< L, R, void >::const_iterator art::Assns< L, R, void >::begin ( ) const
inline

Definition at line 315 of file Assns.h.

316 {
317  return ptrs_.begin();
318 }
template<typename L , typename R >
static short art::Assns< L, R, void >::Class_Version ( )
inlinestatic

Definition at line 167 of file Assns.h.

168  {
169  return 11;
170  }
template<typename L , typename R >
std::string art::Assns< L, R, void >::className ( ) const
inline

Definition at line 350 of file Assns.h.

351 {
352  TypeID const assns_type{typeid(Assns<L, R, void>)};
353  return assns_type.className();
354 }
template<typename L , typename R >
art::Assns< L, R, void >::const_iterator art::Assns< L, R, void >::end ( ) const
inline

Definition at line 322 of file Assns.h.

323 {
324  return ptrs_.end();
325 }
template<typename L , typename R >
void art::Assns< L, R, void >::fill_from_transients ( )
overrideprivatevirtual

Implements art::detail::AssnsBase.

Definition at line 462 of file Assns.h.

463 {
464  if (!ptr_data_1_.empty()) {
465  assert(ptr_data_1_.size() == ptr_data_2_.size() &&
466  ptr_data_2_.size() == ptrs_.size() &&
467  "Assns: internal inconsistency between transient and persistent "
468  "member data.");
469  // Multiple output modules: nothing to do on second and subsequent
470  // calls.
471  return;
472  }
475  l_ref.reserve(ptrs_.size());
476  r_ref.reserve(ptrs_.size());
477  for (auto const& pr : ptrs_) {
478  l_ref.emplace_back(pr.first.refCore(), pr.first.key());
479  r_ref.emplace_back(pr.second.refCore(), pr.second.key());
480  }
481 }
virtual bool left_first() const
Definition: Assns.h:431
std::vector< std::pair< RefCore, std::size_t >> ptr_data_t
Definition: Assns.h:131
ptr_data_t ptr_data_2_
Definition: Assns.h:208
ptr_data_t ptr_data_1_
transient
Definition: Assns.h:207
template<typename L , typename R >
void art::Assns< L, R, void >::fill_transients ( )
overrideprivatevirtual

Implements art::detail::AssnsBase.

Definition at line 440 of file Assns.h.

441 {
442  // Precondition: ptr_data_1_.size() = ptr_data_2_.size();
443  ptrs_.clear();
444  ptrs_.reserve(ptr_data_1_.size());
445  ptr_data_t const& l_ref = left_first() ? ptr_data_1_ : ptr_data_2_;
446  ptr_data_t const& r_ref = left_first() ? ptr_data_2_ : ptr_data_1_;
447 
448  for (auto l = cbegin(l_ref), e = cend(l_ref), r = cbegin(r_ref); l != e;
449  ++l, ++r) {
450  ptrs_.emplace_back(
451  Ptr<left_t>{l->first.id(), l->second, l->first.productGetter()},
452  Ptr<right_t>{r->first.id(), r->second, r->first.productGetter()});
453  }
454  // Empty persistent representation.
455  ptr_data_t tmp1, tmp2;
456  ptr_data_1_.swap(tmp1);
457  ptr_data_2_.swap(tmp2);
458 }
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
Definition: StdUtils.h:87
type * first()
Definition: qinternallist.h:87
static QStrList * l
Definition: config.cpp:1044
const double e
virtual bool left_first() const
Definition: Assns.h:431
std::vector< std::pair< RefCore, std::size_t >> ptr_data_t
Definition: Assns.h:131
decltype(auto) constexpr cbegin(T &&obj)
ADL-aware version of std::cbegin.
Definition: StdUtils.h:82
ptr_data_t ptr_data_2_
Definition: Assns.h:208
ptr_data_t ptr_data_1_
transient
Definition: Assns.h:207
template<typename L , typename R >
bool art::Assns< L, R, void >::left_first ( ) const
inlineprivatevirtual

Definition at line 431 of file Assns.h.

432 {
433  static bool const lf_s = (art::TypeID{typeid(left_t)}.friendlyClassName() <
434  art::TypeID{typeid(right_t)}.friendlyClassName());
435  return lf_s;
436 }
template<typename L , typename R >
std::unique_ptr< art::EDProduct > art::Assns< L, R, void >::makePartner ( std::type_info const &  wanted_wrapper_type) const
inline

Definition at line 401 of file Assns.h.

403 {
404  return makePartner_(wanted_wrapper_type);
405 }
virtual std::unique_ptr< EDProduct > makePartner_(std::type_info const &wanted_wrapper_type) const
Definition: Assns.h:419
template<typename L , typename R >
std::unique_ptr< art::EDProduct > art::Assns< L, R, void >::makePartner_ ( std::type_info const &  wanted_wrapper_type) const
protectedvirtual

Definition at line 419 of file Assns.h.

421 {
422  if (wanted_wrapper_type != typeid(Wrapper<partner_t>)) {
423  detail::throwPartnerException(typeid(*this), wanted_wrapper_type);
424  }
425  return std::make_unique<Wrapper<partner_t>>(
426  std::make_unique<partner_t>(*this));
427 }
void throwPartnerException(std::type_info const &generator, std::type_info const &wanted_wrapper_type)
template<typename L , typename R >
art::Assns< L, R, void >::assn_t const & art::Assns< L, R, void >::operator[] ( size_type  index) const
inline

Definition at line 329 of file Assns.h.

330 {
331  return ptrs_[index];
332 }
template<typename L , typename R >
art::Assns< L, R, void >::size_type art::Assns< L, R, void >::size ( ) const
inline

Definition at line 343 of file Assns.h.

344 {
345  return ptrs_.size();
346 }
template<typename L , typename R >
void art::Assns< L, R, void >::swap ( art::Assns< L, R, void > &  other)
inline

Definition at line 394 of file Assns.h.

395 {
396  swap_(other);
397 }
virtual void swap_(art::Assns< L, R, void > &other)
Definition: Assns.h:409
template<typename L , typename R >
void art::Assns< L, R, void >::swap_ ( art::Assns< L, R, void > &  other)
inlineprotectedvirtual

Definition at line 409 of file Assns.h.

410 {
411  using std::swap;
412  swap(ptrs_, other.ptrs_);
413  swap(ptr_data_1_, other.ptr_data_1_);
414  swap(ptr_data_2_, other.ptr_data_2_);
415 }
void swap(art::Assns< L, R, void > &other)
Definition: Assns.h:394
void swap(Handle< T > &a, Handle< T > &b)
ptr_data_t ptr_data_2_
Definition: Assns.h:208
ptr_data_t ptr_data_1_
transient
Definition: Assns.h:207

Friends And Related Function Documentation

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

Definition at line 184 of file Assns.h.

template<typename L , typename R >
friend class detail::AssnsStreamer
friend

Definition at line 183 of file Assns.h.

Member Data Documentation

template<typename L , typename R >
ptr_data_t art::Assns< L, R, void >::ptr_data_1_ {}
private

transient

Definition at line 207 of file Assns.h.

template<typename L , typename R >
ptr_data_t art::Assns< L, R, void >::ptr_data_2_ {}
private

Definition at line 208 of file Assns.h.

template<typename L , typename R >
ptrs_t art::Assns< L, R, void >::ptrs_ {}
private

Definition at line 206 of file Assns.h.


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