1 #ifndef art_Framework_Core_PtrRemapper_h 2 #define art_Framework_Core_PtrRemapper_h 177 #include "cetlib/exempt_ptr.h" 183 class ProdToProdMapBuilder;
185 namespace PtrRemapperDetail {
187 template <
typename PROD>
195 template <
typename CONT,
typename PROD,
typename CALLBACK>
209 template <
typename CONT,
typename PROD>
224 template <
typename CONT,
typename PROD>
249 template <
typename PROD,
typename SIZE_TYPE>
253 template <
typename PROD,
typename SIZE_TYPE>
255 SIZE_TYPE offset)
const;
258 template <
typename InIter,
typename OutIter,
typename SIZE_TYPE>
259 void operator()(InIter beg, InIter
end, OutIter out, SIZE_TYPE offset)
const;
262 template <
typename OutIter,
typename PROD,
typename OFFSETS>
265 OFFSETS
const& offsets)
const;
268 template <
typename CONT,
typename OutIter,
typename PROD,
typename OFFSETS>
269 void operator()(std::vector<PROD const*>
const& in,
271 OFFSETS
const& offsets,
272 CONT
const& (*extractor)(PROD
const*))
const;
275 template <
typename CONT,
typename OutIter,
typename PROD,
typename OFFSETS>
276 void operator()(std::vector<PROD const*>
const& in,
278 OFFSETS
const& offsets,
279 CONT
const& (PROD::*extractor)()
const)
const;
282 template <
typename CONT,
typename OutIter,
typename PROD,
typename OFFSETS>
283 void operator()(std::vector<PROD const*>
const& in,
285 OFFSETS
const& offsets,
286 CONT PROD::*
const data)
const;
289 template <
typename PROD,
294 void operator()(std::vector<PROD const*>
const& in,
296 OFFSETS
const& offsets,
297 CONT
const& (X::*extractor)(PROD
const*),
301 template <
typename PROD,
306 void operator()(std::vector<PROD const*>
const& in,
308 OFFSETS
const& offsets,
309 CONT
const& (X::*extractor)(PROD
const*)
const,
313 template <
typename CONT,
318 void operator()(std::vector<PROD const*>
const& in,
320 OFFSETS
const& offsets,
321 CALLBACK extractor)
const;
330 cet::exempt_ptr<Event const> event_{
nullptr};
334 template <
typename PROD,
typename SIZE_TYPE>
337 SIZE_TYPE
const offset)
const 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";
347 oldPtr.
key() + offset,
348 event_->productGetter(iter->second)} :
357 template <
typename PROD,
typename SIZE_TYPE>
360 SIZE_TYPE
const offset)
const 366 std::back_inserter(result),
372 template <
typename InIter,
typename OutIter,
typename SIZE_TYPE>
377 SIZE_TYPE
const offset)
const 384 for (
auto i = beg; i !=
end; ++i) {
395 template <
typename OutIter,
typename PROD,
typename OFFSETS>
399 OFFSETS
const& offsets)
const 404 PtrRemapperDetail::simpleProdReturner<PROD>);
408 template <
typename CONT,
typename OutIter,
typename PROD,
typename OFFSETS>
412 OFFSETS
const& offsets,
413 CONT
const& (*extractor)(PROD
const*))
const 415 this->operator()<CONT, CONT
const& (*)(PROD
const*)>(
416 in, out, offsets, extractor);
420 template <
typename CONT,
typename OutIter,
typename PROD,
typename OFFSETS>
424 OFFSETS
const& offsets,
425 CONT
const& (PROD::*extractor)()
const)
const 427 this->operator()<CONT, CONT
const& (PROD::*)()
const>(
428 in, out, offsets, extractor);
432 template <
typename CONT,
typename OutIter,
typename PROD,
typename OFFSETS>
436 OFFSETS
const& offsets,
437 CONT PROD::*
const data)
const 439 this->operator()<CONT, CONT PROD::*
const>(
in, out, offsets, data);
443 template <
typename PROD,
451 OFFSETS
const& offsets,
452 CONT
const& (X::*)(PROD
const*),
455 this->operator()<CONT>(
456 in, out, offsets, [&
x](
auto& elem) { elem.extractor(x); });
460 template <
typename PROD,
468 OFFSETS
const& offsets,
469 CONT
const& (X::*)(PROD
const*)
const,
472 this->operator()<CONT>(
473 in, out, offsets, [&
x](
auto& elem) { elem.extractor(x); });
477 template <
typename CONT,
485 OFFSETS
const& offsets,
486 CALLBACK extractor)
const 488 if (in.size() != offsets.size()) {
490 <<
"Collection size of " << in.size()
491 <<
" disagrees with offset container size of " << offsets.size() <<
".\n";
494 auto const e = in.end();
495 auto off_iter = offsets.begin();
498 for (; i !=
e; ++i, ++off_iter) {
499 CONT
const& cont(returner.operator()(*i));
500 this->
operator()(cont.begin(), cont.end(), out, *off_iter);
void reserve(size_type n)
CONT const & operator()(PROD const *prod) const
ContReturner(CALLBACK callback)
CONT const & operator()(PROD const *prod) const
ContReturner(CALLBACK callback)
CONT const & operator()(PROD const *prod) const
std::map< ProductID, ProductID > ProdTransMap_t
PROD const & simpleProdReturner(PROD const *prod)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
CONT PROD::*const CALLBACK
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
CONT const &(PROD::* CALLBACK)() const
Ptr< PROD > operator()(Ptr< PROD > const &oldPtr, SIZE_TYPE offset) const
ContReturner(CALLBACK callback)