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

#include "DeferredProductGetter.h"

Inheritance diagram for art::DeferredProductGetter:
art::EDProductGetter

Public Member Functions

 DeferredProductGetter (cet::exempt_ptr< Principal const > groupFinder, ProductID pid)
 
bool isReady () const override
 
EDProduct const * getIt () const override
 
EDProduct const * anyProduct () const override
 
EDProduct const * uniqueProduct () const override
 
EDProduct const * uniqueProduct (TypeID const &) const override
 
bool resolveProduct (TypeID const &) const override
 
bool resolveProductIfAvailable (TypeID const &) const override
 

Private Member Functions

cet::exempt_ptr< EDProductGetter const > resolveGetter_ () const
 
cet::exempt_ptr< EDProductGetter const > maybeResolveGetter_ () const
 

Private Attributes

cet::exempt_ptr< Principal const > groupFinder_
 
ProductID const pid_
 
cet::exempt_ptr< EDProductGetter const > realGetter_
 

Detailed Description

Definition at line 10 of file DeferredProductGetter.h.

Constructor & Destructor Documentation

art::DeferredProductGetter::DeferredProductGetter ( cet::exempt_ptr< Principal const >  groupFinder,
ProductID  pid 
)

Definition at line 7 of file DeferredProductGetter.cc.

10  : groupFinder_(groupFinder), pid_(pid), realGetter_()
11 {}
cet::exempt_ptr< EDProductGetter const > realGetter_
cet::exempt_ptr< Principal const > groupFinder_

Member Function Documentation

art::EDProduct const * art::DeferredProductGetter::anyProduct ( ) const
overridevirtual

Implements art::EDProductGetter.

Definition at line 20 of file DeferredProductGetter.cc.

References resolveGetter_().

21 {
22  return resolveGetter_()->anyProduct();
23 }
cet::exempt_ptr< EDProductGetter const > resolveGetter_() const
art::EDProduct const * art::DeferredProductGetter::getIt ( ) const
overridevirtual

Implements art::EDProductGetter.

Definition at line 14 of file DeferredProductGetter.cc.

References resolveGetter_().

15 {
16  return resolveGetter_()->getIt();
17 }
cet::exempt_ptr< EDProductGetter const > resolveGetter_() const
bool art::DeferredProductGetter::isReady ( ) const
inlineoverridevirtual

Implements art::EDProductGetter.

Definition at line 33 of file DeferredProductGetter.h.

References maybeResolveGetter_(), and realGetter_.

34 {
35  return (maybeResolveGetter_() != nullptr) && realGetter_->isReady();
36 }
cet::exempt_ptr< EDProductGetter const > maybeResolveGetter_() const
cet::exempt_ptr< EDProductGetter const > realGetter_
cet::exempt_ptr< art::EDProductGetter const > art::DeferredProductGetter::maybeResolveGetter_ ( ) const
private

Definition at line 63 of file DeferredProductGetter.cc.

References groupFinder_, pid_, and realGetter_.

Referenced by isReady(), and resolveGetter_().

64 {
65  if (realGetter_) {
66  return realGetter_;
67  } else if ((realGetter_ =
68  groupFinder_->getByProductID(pid_).result().get())) {
69  return realGetter_;
70  } else {
71  return cet::exempt_ptr<EDProductGetter const>();
72  }
73 }
cet::exempt_ptr< EDProductGetter const > realGetter_
cet::exempt_ptr< Principal const > groupFinder_
cet::exempt_ptr< art::EDProductGetter const > art::DeferredProductGetter::resolveGetter_ ( ) const
private

Definition at line 50 of file DeferredProductGetter.cc.

References maybeResolveGetter_(), pid_, and art::errors::ProductNotFound.

Referenced by anyProduct(), getIt(), resolveProduct(), resolveProductIfAvailable(), and uniqueProduct().

51 {
52  auto result = maybeResolveGetter_();
53  if (!result) {
55  << "Product corresponding to ProductID " << pid_
56  << " not found: possible attempt to resolve a Ptr before its product has "
57  "been committed.\n";
58  }
59  return result;
60 }
cet::exempt_ptr< EDProductGetter const > maybeResolveGetter_() const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
bool art::DeferredProductGetter::resolveProduct ( TypeID const &  tid) const
overridevirtual

Implements art::EDProductGetter.

Definition at line 38 of file DeferredProductGetter.cc.

References resolveGetter_().

39 {
40  return resolveGetter_()->resolveProduct(tid);
41 }
cet::exempt_ptr< EDProductGetter const > resolveGetter_() const
bool art::DeferredProductGetter::resolveProductIfAvailable ( TypeID const &  tid) const
overridevirtual

Implements art::EDProductGetter.

Definition at line 44 of file DeferredProductGetter.cc.

References resolveGetter_().

45 {
46  return resolveGetter_()->resolveProductIfAvailable(tid);
47 }
cet::exempt_ptr< EDProductGetter const > resolveGetter_() const
art::EDProduct const * art::DeferredProductGetter::uniqueProduct ( ) const
overridevirtual

Implements art::EDProductGetter.

Definition at line 26 of file DeferredProductGetter.cc.

References resolveGetter_().

27 {
28  return resolveGetter_()->uniqueProduct();
29 }
cet::exempt_ptr< EDProductGetter const > resolveGetter_() const
art::EDProduct const * art::DeferredProductGetter::uniqueProduct ( TypeID const &  tid) const
overridevirtual

Implements art::EDProductGetter.

Definition at line 32 of file DeferredProductGetter.cc.

References resolveGetter_().

33 {
34  return resolveGetter_()->uniqueProduct(tid);
35 }
cet::exempt_ptr< EDProductGetter const > resolveGetter_() const

Member Data Documentation

cet::exempt_ptr<Principal const> art::DeferredProductGetter::groupFinder_
private

Definition at line 27 of file DeferredProductGetter.h.

Referenced by maybeResolveGetter_().

ProductID const art::DeferredProductGetter::pid_
private

Definition at line 28 of file DeferredProductGetter.h.

Referenced by maybeResolveGetter_(), and resolveGetter_().

cet::exempt_ptr<EDProductGetter const> art::DeferredProductGetter::realGetter_
mutableprivate

Definition at line 29 of file DeferredProductGetter.h.

Referenced by isReady(), and maybeResolveGetter_().


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