File indexing completed on 2023-03-17 10:49:22
0001 #ifndef Subsystem_Package_FunctorHandleExceptionFactory_h
0002 #define Subsystem_Package_FunctorHandleExceptionFactory_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include "DataFormats/Common/interface/HandleExceptionFactory.h"
0023
0024
0025
0026
0027 namespace edm {
0028
0029 template <typename T>
0030 class FunctorHandleExceptionFactory : public HandleExceptionFactory {
0031 public:
0032 FunctorHandleExceptionFactory(T&& iFunctor) : m_functor(std::move(iFunctor)) {}
0033
0034
0035
0036
0037
0038 std::shared_ptr<cms::Exception> make() const override { return m_functor(); }
0039
0040 private:
0041 T m_functor;
0042 };
0043
0044 template <typename T>
0045 std::shared_ptr<HandleExceptionFactory> makeHandleExceptionFactory(T&& iFunctor) {
0046 return std::make_shared<FunctorHandleExceptionFactory<T>>(std::move(iFunctor));
0047 }
0048 }
0049
0050 #endif