LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
ExceptionCollector.h
Go to the documentation of this file.
1 #ifndef art_Framework_EventProcessor_detail_ExceptionCollector_h
2 #define art_Framework_EventProcessor_detail_ExceptionCollector_h
3 
4 // ======================================================================
5 //
6 // ExceptionCollector - Utility used to collect exceptions thrown when
7 // invoking functions that were provided to ExceptionCollector::call.
8 // The semantics are different than cet::exception_collector in that
9 // the (compiled-generated) ExceptionCollector d'tor DOES NOT call
10 // rethrow.
11 //
12 // TODO: determine if this class should be removed in favor of the
13 // cet::exception_collector class.
14 //
15 // ======================================================================
16 
17 #include <exception>
18 #include <vector>
19 
20 namespace art {
21  namespace detail {
22  class ExceptionCollector;
23  }
24 }
25 
27 public:
28  bool
29  empty() const noexcept
30  {
31  return exceptions_.empty();
32  }
33  [[noreturn]] void rethrow();
34 
35  template <typename F>
36  void
37  call(F f) try {
38  f();
39  }
40  catch (...) {
41  exceptions_.push_back(std::current_exception());
42  }
43 
44 private:
45  std::vector<std::exception_ptr> exceptions_{};
46 };
47 
48 #endif /* art_Framework_EventProcessor_detail_ExceptionCollector_h */
49 
50 // Local Variables:
51 // mode: c++
52 // End:
TFile f
Definition: plotHisto.C:6
std::vector< std::exception_ptr > exceptions_
HLT enums.