CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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>
8 
9 namespace edm {
10  namespace convertException {
11  void badAllocToEDM();
12  void stdToEDM(std::exception const& e);
13  void stringToEDM(std::string& s);
14  void charPtrToEDM(char const* c);
15  void unknownToEDM();
16 
17  template<typename F>
18  auto wrap(F iFunc) -> decltype( iFunc() ) {
19  try {
20  return iFunc();
21  }
22  catch (cms::Exception&) { throw; }
23  catch(std::bad_alloc&) { convertException::badAllocToEDM(); }
26  catch(char const* c) { convertException::charPtrToEDM(c); }
27  catch (...) { convertException::unknownToEDM(); }
28  //Never gets here
29  typedef decltype(iFunc()) ReturnType;
30  return ReturnType();
31  }
32  }
33 }
34 
35 #endif
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:281