35 #ifndef HPP_UTIL_EXCEPTION_FACTORY_HH 36 #define HPP_UTIL_EXCEPTION_FACTORY_HH 43 struct ThrowException {};
45 template <
typename exception>
46 struct ExceptionFactory;
49 template <
typename exception,
typename In>
50 struct conditional_insertion_operator {
51 typedef ExceptionFactory<exception>& type;
53 static inline type run(ExceptionFactory<exception>& be,
const In& t) {
72 template <
typename exception>
77 inline typename internal::conditional_insertion_operator<exception, T>::type
79 return internal::conditional_insertion_operator<exception, T>::run(*
this,
89 template <
typename exception>
90 struct conditional_insertion_operator<exception, ThrowException> {
91 typedef exception type;
94 const ThrowException&) {
95 return exception(be.
ss.str().c_str());
109 #define HPP_THROW(TYPE, MSG) \ 110 throw ::hpp::ExceptionFactory<TYPE>() << MSG << ::hpp::ThrowException() 116 #define HPP_THROW_WITH_LINEINFO(TYPE, MSG) \ 117 HPP_THROW(TYPE, MSG << " at " << __FILE__ << ":" << __LINE__) Definition: assertion.hh:45
Class to ease exception creation.
Definition: exception-factory.hh:73
#define HPP_UTIL_DLLAPI
Definition: config.hh:88
HPP_UTIL_DLLAPI std::ostream & operator<<(std::ostream &o, const Exception &exception)
Override operator<< to handle exception display.
Definition: exception.cc:79
std::stringstream ss
Definition: exception-factory.hh:74