Public Member Functions | Private Types | Private Attributes | Friends | List of all members
art::PtrRemapper Class Reference

#include <PtrRemapper.h>

Public Member Functions

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 323 of file PtrRemapper.h.

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 381 of file PtrRemapper.h.

385 {
386  // Need to assume that all Ptr containers and consistent internally
387  // and with each other due to a lack of productGetters.
388 
389  // Not using transform here allows instantiation for iterator to
390  // collection of Ptr or collection of PtrVector.
391  for (auto i = beg; i != end; ++i) {
392  // Note: this could be signature 1 OR 2 of operator(). If the user
393  // calls this signature (3) with iterators into a collection of
394  // PtrVector, then the call order will be 3, 2, 3, 1 due to the
395  // templates that will be instantiated i.e. the relationship
396  // between signatures 2 and 3 is *not* infinitely recursive.
397  *out++ = this->operator()(*i, offset); // 1 OR 2.
398  }
399 }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
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 404 of file PtrRemapper.h.

407 {
408  this->operator()(in,
409  out,
410  offsets,
411  PtrRemapperDetail::simpleProdReturner<PROD>); // 5.
412 }
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 417 of file PtrRemapper.h.

421 {
422  this->operator()<CONT, CONT const& (*)(PROD const*)>(in,
423  out,
424  offsets,
425  extractor); // 10.
426 }
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 431 of file PtrRemapper.h.

435 {
436  this->operator()<CONT, CONT const& (PROD::*)() const>(in,
437  out,
438  offsets,
439  extractor); // 10.
440 }
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 445 of file PtrRemapper.h.

449 {
450  this->operator()<CONT, CONT PROD::*const>(in, out, offsets, data); // 10.
451 }
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 477 of file PtrRemapper.h.

482 {
483  this->operator()<CONT>(
484  in, out, offsets, [&x](auto& elem) { elem.extractor(x); }); // 10.
485 }
list x
Definition: train.py:276
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 494 of file PtrRemapper.h.

498 {
499  if (in.size() != offsets.size()) {
501  << "Collection size of " << in.size()
502  << " disagrees with offset container size of " << offsets.size() << ".\n";
503  }
504  auto i = in.begin();
505  auto const e = in.end();
506  auto off_iter = offsets.begin();
508  extractor};
509  for (; i != e; ++i, ++off_iter) {
510  CONT const& cont{returner.operator()(*i)};
511  this->operator()(cont.begin(), cont.end(), out, *off_iter); // 3.
512  }
513 }
const double e
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
Ptr< PROD > operator()(Ptr< PROD > const &oldPtr, SIZE_TYPE offset) const
template<typename PROD , typename SIZE_TYPE >
art::Ptr<PROD> art::PtrRemapper::operator() ( Ptr< PROD > const &  oldPtr,
SIZE_TYPE const  offset 
) const

Definition at line 334 of file PtrRemapper.h.

336 {
337  if (oldPtr.id().isValid()) {
338  auto iter = prodTransMap_.find(oldPtr.id());
339  if (iter == cend(prodTransMap_)) {
341  << "PtrRemapper: could not find old ProductID " << oldPtr.id()
342  << " in translation table: already translated?\n";
343  }
344  auto productGetter = event_->productGetter(iter->second);
345  if (productGetter == nullptr) {
347  << "PtrRemapper: cannot create output "
348  << TypeID{typeid(art::Ptr<PROD>)}.className()
349  << " with ProductID: " << iter->second
350  << "\nbecause the product is not known. Perhaps the output product "
351  "was misspecified for product mixing.\n";
352  }
353 
354  return oldPtr.isNonnull() ?
355  Ptr<PROD>{iter->second, oldPtr.key() + offset, productGetter} :
356  Ptr<PROD>{iter->second};
357  }
358 
359  // Default-constructed.
360  return Ptr<PROD>{};
361 }
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
Definition: StdUtils.h:87
static QCString className
Definition: declinfo.cpp:669
cet::exempt_ptr< Event const > event_
Definition: PtrRemapper.h:328
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
ProdTransMap_t prodTransMap_
Definition: PtrRemapper.h:327
Definition: fwd.h:31
template<typename PROD , typename SIZE_TYPE >
art::PtrVector<PROD> art::PtrRemapper::operator() ( PtrVector< PROD > const &  old,
SIZE_TYPE const  offset 
) const

Definition at line 366 of file PtrRemapper.h.

368 {
369  PtrVector<PROD> result;
370  result.reserve(old.size());
371  this->operator()(old.begin(),
372  old.end(),
373  std::back_inserter(result),
374  offset); // 3.
375  return result;
376 }
static QCString result
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 460 of file PtrRemapper.h.

465 {
466  this->operator()<CONT>(
467  in, out, offsets, [&x](auto& elem) { elem.extractor(x); }); // 10.
468 }
list x
Definition: train.py:276

Friends And Related Function Documentation

friend class ProdToProdMapBuilder
friend

Definition at line 322 of file PtrRemapper.h.

Member Data Documentation

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

Definition at line 328 of file PtrRemapper.h.

ProdTransMap_t art::PtrRemapper::prodTransMap_ {}
private

Definition at line 327 of file PtrRemapper.h.


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