CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ConvertException.h
Go to the documentation of this file.
1 #ifndef FWCore_Utilities_ConvertException_h
2 #define FWCore_Utilities_ConvertException_h
3 
4 #include <string>
5 #include <exception>
6 #include <functional>
9 
10 namespace edm {
11  namespace convertException {
12  void badAllocToEDM();
13  void stdToEDM(std::exception const& e);
14  void stringToEDM(std::string& s);
15  void charPtrToEDM(char const* c);
16  void unknownToEDM();
17 
18  template <typename F>
19  auto wrap(F iFunc) -> decltype(iFunc()) {
20  // Caught exception is rethrown
21  CMS_SA_ALLOW try { return iFunc(); } catch (cms::Exception&) {
22  throw;
23  } catch (std::bad_alloc&) {
25  } catch (std::exception& e) {
27  } catch (std::string& s) {
29  } catch (char const* c) {
31  } catch (...) {
33  }
34  //Never gets here
35  typedef decltype(iFunc()) ReturnType;
36  return ReturnType();
37  }
38  } // namespace convertException
39 } // namespace edm
40 
41 #endif
const edm::EventSetup & c
#define CMS_SA_ALLOW
std::map< DetId, double > ReturnType
void stdToEDM(std::exception const &e)
void charPtrToEDM(char const *c)
void stringToEDM(std::string &s)
auto wrap(F iFunc) -> decltype(iFunc())
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163