LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
art::PtrRemapper Class Reference

#include "PtrRemapper.h"

Public Member Functions

 PtrRemapper ()=default
 
template<typename PROD , typename SIZE_TYPE >
Ptr< PROD > operator() (Ptr< PROD > const &oldPtr, SIZE_TYPE offset) const
 
template<typename PROD , typename SIZE_TYPE >
PtrVector< PROD > operator() (PtrVector< PROD > const &old, SIZE_TYPE offset) const
 
template<typename InIter , typename OutIter , typename SIZE_TYPE >
void operator() (InIter beg, InIter end, OutIter out, SIZE_TYPE offset) const
 
template<typename OutIter , typename PROD , typename OFFSETS >
void operator() (std::vector< PROD const * > const &in, OutIter out, OFFSETS const &offsets) const
 
template<typename CONT , typename OutIter , typename PROD , typename OFFSETS >
void operator() (std::vector< PROD const * > const &in, OutIter out, OFFSETS const &offsets, CONT const &(*extractor)(PROD const *)) const
 
template<typename CONT , typename OutIter , typename PROD , typename OFFSETS >
void operator() (std::vector< PROD const * > const &in, OutIter out, OFFSETS const &offsets, CONT const &(PROD::*extractor)() const) const
 
template<typename CONT , typename OutIter , typename PROD , typename OFFSETS >
void operator() (std::vector< PROD const * > const &in, OutIter out, OFFSETS const &offsets, CONT PROD::*const data) const
 
template<typename PROD , typename OutIter , typename CONT , typename X , typename OFFSETS >
void operator() (std::vector< PROD const * > const &in, OutIter out, OFFSETS const &offsets, CONT const &(X::*extractor)(PROD const *), X &x) const
 
template<typename PROD , typename OutIter , typename CONT , typename X , typename OFFSETS >
void operator() (std::vector< PROD const * > const &in, OutIter out, OFFSETS const &offsets, CONT const &(X::*extractor)(PROD const *) const, X const &x) const
 
template<typename CONT , typename CALLBACK , typename OutIter , typename PROD , typename OFFSETS >
void operator() (std::vector< PROD const * > const &in, OutIter out, OFFSETS const &offsets, CALLBACK extractor) const
 
template<typename PROD , typename SIZE_TYPE >
art::Ptr< PROD > operator() (Ptr< PROD > const &oldPtr, SIZE_TYPE const offset) const
 
template<typename PROD , typename SIZE_TYPE >
art::PtrVector< PROD > operator() (PtrVector< PROD > const &old, SIZE_TYPE const offset) const
 
template<typename PROD , typename OutIter , typename CONT , typename X , typename OFFSETS >
void operator() (std::vector< PROD const * > const &in, OutIter out, OFFSETS const &offsets, CONT const &(X::*)(PROD const *), X &x) const
 

Private Types

using ProdTransMap_t = std::map< ProductID, ProductID >
 

Private Attributes

ProdTransMap_t prodTransMap_ {}
 
cet::exempt_ptr< Event const > event_ {nullptr}
 

Friends

class ProdToProdMapBuilder
 

Detailed Description

Definition at line 241 of file PtrRemapper.h.

Member Typedef Documentation

Definition at line 325 of file PtrRemapper.h.

Constructor & Destructor Documentation

art::PtrRemapper::PtrRemapper ( )
default

Member Function Documentation

template<typename PROD , typename SIZE_TYPE >
Ptr<PROD> art::PtrRemapper::operator() ( Ptr< PROD > const &  oldPtr,
SIZE_TYPE  offset 
) const
template<typename PROD , typename SIZE_TYPE >
PtrVector<PROD> art::PtrRemapper::operator() ( PtrVector< PROD > const &  old,
SIZE_TYPE  offset 
) const
template<typename InIter , typename OutIter , typename SIZE_TYPE >
void art::PtrRemapper::operator() ( InIter  beg,
InIter  end,
OutIter  out,
SIZE_TYPE  offset 
) const

Definition at line 374 of file PtrRemapper.h.

References evd::details::end(), and art::PtrRemapperDetail::ContReturner< CONT, PROD, CALLBACK >::operator()().

378 {
379  // Need to assume that all Ptr containers and consistent internally
380  // and with each other due to a lack of productGetters.
381 
382  // Not using transform here allows instantiation for iterator to
383  // collection of Ptr or collection of PtrVector.
384  for (auto i = beg; i != end; ++i) {
385  // Note: this could be signature 1 OR 2 of operator(). If the user
386  // calls this signature (3) with iterators into a collection of
387  // PtrVector, then the call order will be 3, 2, 3, 1 due to the
388  // templates that will be instantiated i.e. the relationship
389  // between signatures 2 and 3 is *not* infinitely recursive.
390  *out++ = this->operator()(*i, offset); // 1 OR 2.
391  }
392 }
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
Ptr< PROD > operator()(Ptr< PROD > const &oldPtr, SIZE_TYPE offset) const
template<typename OutIter , typename PROD , typename OFFSETS >
void art::PtrRemapper::operator() ( std::vector< PROD const * > const &  in,
OutIter  out,
OFFSETS const &  offsets 
) const

Definition at line 397 of file PtrRemapper.h.

References art::PtrRemapperDetail::ContReturner< CONT, PROD, CALLBACK >::operator()().

400 {
401  this->operator()(in,
402  out,
403  offsets,
404  PtrRemapperDetail::simpleProdReturner<PROD>); // 5.
405 }
Ptr< PROD > operator()(Ptr< PROD > const &oldPtr, SIZE_TYPE offset) const
template<typename CONT , typename OutIter , typename PROD , typename OFFSETS >
void art::PtrRemapper::operator() ( std::vector< PROD const * > const &  in,
OutIter  out,
OFFSETS const &  offsets,
CONT const &(*)(PROD const *)  extractor 
) const

Definition at line 410 of file PtrRemapper.h.

414 {
415  this->operator()<CONT, CONT const& (*)(PROD const*)>(
416  in, out, offsets, extractor); // 10.
417 }
template<typename CONT , typename OutIter , typename PROD , typename OFFSETS >
void art::PtrRemapper::operator() ( std::vector< PROD const * > const &  in,
OutIter  out,
OFFSETS const &  offsets,
CONT const &(PROD::*)() const  extractor 
) const

Definition at line 422 of file PtrRemapper.h.

References in.

426 {
427  this->operator()<CONT, CONT const& (PROD::*)() const>(
428  in, out, offsets, extractor); // 10.
429 }
template<typename CONT , typename OutIter , typename PROD , typename OFFSETS >
void art::PtrRemapper::operator() ( std::vector< PROD const * > const &  in,
OutIter  out,
OFFSETS const &  offsets,
CONT PROD::*const  data 
) const

Definition at line 434 of file PtrRemapper.h.

References in, and X.

438 {
439  this->operator()<CONT, CONT PROD::*const>(in, out, offsets, data); // 10.
440 }
ifstream in
Definition: comparison.C:7
template<typename PROD , typename OutIter , typename CONT , typename X , typename OFFSETS >
void art::PtrRemapper::operator() ( std::vector< PROD const * > const &  in,
OutIter  out,
OFFSETS const &  offsets,
CONT const &(X::*)(PROD const *)  extractor,
X x 
) const
template<typename PROD , typename OutIter , typename CONT , typename X , typename OFFSETS >
void art::PtrRemapper::operator() ( std::vector< PROD const * > const &  in,
OutIter  out,
OFFSETS const &  offsets,
CONT const &(X::*)(PROD const *) const  extractor,
X const &  x 
) const

Definition at line 466 of file PtrRemapper.h.

References in, and x.

471 {
472  this->operator()<CONT>(
473  in, out, offsets, [&x](auto& elem) { elem.extractor(x); }); // 10.
474 }
Float_t x
Definition: compare.C:6
ifstream in
Definition: comparison.C:7
template<typename CONT , typename CALLBACK , typename OutIter , typename PROD , typename OFFSETS >
void art::PtrRemapper::operator() ( std::vector< PROD const * > const &  in,
OutIter  out,
OFFSETS const &  offsets,
CALLBACK  extractor 
) const

Definition at line 483 of file PtrRemapper.h.

References e, art::errors::LogicError, and art::PtrRemapperDetail::ContReturner< CONT, PROD, CALLBACK >::operator()().

487 {
488  if (in.size() != offsets.size()) {
490  << "Collection size of " << in.size()
491  << " disagrees with offset container size of " << offsets.size() << ".\n";
492  }
493  auto i = in.begin();
494  auto const e = in.end();
495  auto off_iter = offsets.begin();
497  extractor);
498  for (; i != e; ++i, ++off_iter) {
499  CONT const& cont(returner.operator()(*i));
500  this->operator()(cont.begin(), cont.end(), out, *off_iter); // 3.
501  }
502 }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
Ptr< PROD > operator()(Ptr< PROD > const &oldPtr, SIZE_TYPE offset) const
Float_t e
Definition: plot.C:34
template<typename PROD , typename SIZE_TYPE >
art::Ptr<PROD> art::PtrRemapper::operator() ( Ptr< PROD > const &  oldPtr,
SIZE_TYPE const  offset 
) const

Definition at line 336 of file PtrRemapper.h.

References art::Ptr< T >::id(), art::Ptr< T >::isNonnull(), art::Ptr< T >::key(), and art::errors::LogicError.

338 {
339  if (oldPtr.id().isValid()) {
340  auto iter = prodTransMap_.find(oldPtr.id());
341  if (iter == prodTransMap_.end()) {
343  << "PtrRemapper: could not find old ProductID " << oldPtr.id()
344  << " in translation table: already translated?\n";
345  }
346  return oldPtr.isNonnull() ? Ptr<PROD>{iter->second,
347  oldPtr.key() + offset,
348  event_->productGetter(iter->second)} :
349  Ptr<PROD>{iter->second};
350  }
351 
352  // Default-constructed.
353  return Ptr<PROD>{};
354 }
cet::exempt_ptr< Event const > event_
Definition: PtrRemapper.h:330
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
ProdTransMap_t prodTransMap_
Definition: PtrRemapper.h:329
template<typename PROD , typename SIZE_TYPE >
art::PtrVector<PROD> art::PtrRemapper::operator() ( PtrVector< PROD > const &  old,
SIZE_TYPE const  offset 
) const

Definition at line 359 of file PtrRemapper.h.

References art::PtrVector< T >::begin(), art::PtrVector< T >::end(), art::PtrRemapperDetail::ContReturner< CONT, PROD, CALLBACK >::operator()(), art::PtrVector< T >::reserve(), and art::PtrVector< T >::size().

361 {
362  PtrVector<PROD> result;
363  result.reserve(old.size());
364  this->operator()(old.begin(),
365  old.end(),
366  std::back_inserter(result),
367  offset); // 3.
368  return result;
369 }
Ptr< PROD > operator()(Ptr< PROD > const &oldPtr, SIZE_TYPE offset) const
template<typename PROD , typename OutIter , typename CONT , typename X , typename OFFSETS >
void art::PtrRemapper::operator() ( std::vector< PROD const * > const &  in,
OutIter  out,
OFFSETS const &  offsets,
CONT const &  X::*)(PROD const *,
X x 
) const

Definition at line 449 of file PtrRemapper.h.

References in, x, and X.

454 {
455  this->operator()<CONT>(
456  in, out, offsets, [&x](auto& elem) { elem.extractor(x); }); // 10.
457 }
Float_t x
Definition: compare.C:6
ifstream in
Definition: comparison.C:7

Friends And Related Function Documentation

friend class ProdToProdMapBuilder
friend

Definition at line 324 of file PtrRemapper.h.

Member Data Documentation

cet::exempt_ptr<Event const> art::PtrRemapper::event_ {nullptr}
private

Definition at line 330 of file PtrRemapper.h.

Referenced by art::ProdToProdMapBuilder::populateRemapper().

ProdTransMap_t art::PtrRemapper::prodTransMap_ {}
private

Definition at line 329 of file PtrRemapper.h.

Referenced by art::ProdToProdMapBuilder::populateRemapper().


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