LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
DeferredProductGetter.cc
Go to the documentation of this file.
2 
6 
8  cet::exempt_ptr<Principal const> groupFinder,
10  : groupFinder_(groupFinder), pid_(pid), realGetter_()
11 {}
12 
13 art::EDProduct const*
15 {
16  return resolveGetter_()->getIt();
17 }
18 
19 art::EDProduct const*
21 {
22  return resolveGetter_()->anyProduct();
23 }
24 
25 art::EDProduct const*
27 {
28  return resolveGetter_()->uniqueProduct();
29 }
30 
31 art::EDProduct const*
33 {
34  return resolveGetter_()->uniqueProduct(tid);
35 }
36 
37 bool
39 {
40  return resolveGetter_()->resolveProduct(tid);
41 }
42 
43 bool
45 {
46  return resolveGetter_()->resolveProductIfAvailable(tid);
47 }
48 
49 cet::exempt_ptr<art::EDProductGetter const>
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 }
61 
62 cet::exempt_ptr<art::EDProductGetter const>
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 > resolveGetter_() const
EDProduct const * getIt() const override
cet::exempt_ptr< EDProductGetter const > maybeResolveGetter_() const
EDProduct const * anyProduct() const override
DeferredProductGetter(cet::exempt_ptr< Principal const > groupFinder, ProductID pid)
cet::exempt_ptr< EDProductGetter const > realGetter_
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
EDProduct const * uniqueProduct() const override
bool resolveProduct(TypeID const &) const override
cet::exempt_ptr< Principal const > groupFinder_
bool resolveProductIfAvailable(TypeID const &) const override