1 #ifndef art_Framework_Principal_Handle_h 2 #define art_Framework_Principal_Handle_h 36 #include "cetlib_except/demangle.h" 37 #include "cetlib_except/exception.h" 60 template <
typename...
T>
64 bool const all_valid =
true && (... && t.isValid());
74 template <
class T,
class U>
78 template <
class T,
class U>
82 template <
class T,
class U>
96 explicit constexpr
Handle() =
106 T const* operator->()
const;
107 T const* product()
const;
110 bool isValid()
const;
115 std::shared_ptr<art::Exception const> whyFailed()
const;
122 T const* prod_{
nullptr};
124 std::shared_ptr<art::Exception const> whyFailed_{
nullptr};
134 if (gqr.succeeded()) {
137 if (wrapperPtr !=
nullptr) {
138 prod_ = wrapperPtr->product();
141 e <<
"Product retrieval via Handle<T> succeeded for product:\n" 143 <<
"but an attempt to interpret it as an object of type '" 144 << cet::demangle_symbol(
typeid(
T).
name()) <<
"' failed.\n";
145 whyFailed_ = std::make_shared<art::Exception const>(std::move(
e));
166 if (
prod_ ==
nullptr)
168 <<
"Attempt to de-reference product that points to 'nullptr'.\n";
212 inline std::shared_ptr<art::Exception const>
249 template <
typename T>
264 operator T const*()
const;
274 std::shared_ptr<art::Exception const>
whyFailed()
const;
291 if (prod ==
nullptr) {
293 <<
"Attempt to create ValidHandle with null pointer";
351 inline std::shared_ptr<art::Exception const>
354 return std::shared_ptr<art::Exception const>();
372 "Attempt to retrieve range set from invalid handle.";
374 return h.provenance()->rangeOfValidity();
377 template <
class T,
class U>
382 "Attempt to compare range sets where one or both handles are invalid.";
387 template <
class T,
class U>
392 "Attempt to compare range sets where one or both handles are invalid.";
397 template <
class T,
class U>
402 "Attempt to compare range sets where one or both handles are invalid.";
::xsd::cxx::tree::id< char, ncname > id
Handle & operator=(Handle const &)=default
std::enable_if_t< detail::is_handle< T >::value, RangeSet const & > range_of_validity(T const &h)
std::shared_ptr< art::Exception const > whyFailed_
vector< vector< double > > clear
void swap(Handle< T > &other)
T const & operator*() const
T const * product() const
float_mat operator*(const float_mat &a, const float_mat &b)
matrix multiplication.
static const char *const errMsg[]
T const * product() const
const XML_Char int const XML_Char * value
void swap(Handle< T > &a, Handle< T > &b)
Provenance const * provenance() const
T const * operator->() const
void convert_handle(GroupQueryResult const &, Handle< T > &)
art::art::TriggerResults element_type
std::enable_if_t< detail::are_handles< T, U >::value, bool > disjoint_ranges(T const &a, U const &b)
Provenance const * provenance() const
ProductID productID() const
constexpr Handle()=default
void throw_if_invalid(std::string const &msg, T const &...t)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
T const * operator->() const
void swap(ValidHandle< T > &a, ValidHandle< T > &b)
T const & operator*() const
std::enable_if_t< detail::are_handles< T, U >::value, bool > overlapping_ranges(T const &a, U const &b)
std::enable_if_t< detail::are_handles< T, U >::value, bool > same_ranges(T const &a, U const &b)
Service to store calibration data products (CDP) in the SQLite3 metadatabase of a file...
std::shared_ptr< art::Exception const > whyFailed() const
std::shared_ptr< art::Exception const > whyFailed() const
BranchDescription const & productDescription() const
void swap(ValidHandle< T > &other)