From 09ed8e69312cebe31b69af4f42a3b0417774cf04 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 24 Jun 2011 15:22:55 -0700 Subject: uhd: added dynamic throw and clone to exceptions --- host/lib/exception.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'host/lib') diff --git a/host/lib/exception.cpp b/host/lib/exception.cpp index ecb1fe768..ea056bd3b 100644 --- a/host/lib/exception.cpp +++ b/host/lib/exception.cpp @@ -27,7 +27,9 @@ exception::exception(const std::string &what): #define make_exception_impl(name, class, base) \ class::class(const std::string &what): \ base(str(boost::format("%s: %s") % name % what)){} \ - unsigned class::code(void) const{return boost::hash()(#class) & 0xfff;} + unsigned class::code(void) const{return boost::hash()(#class) & 0xfff;} \ + class *class::dynamic_clone(void) const{return new class(*this);} \ + void class::dynamic_throw(void) const{throw *this;} make_exception_impl("AssertionError", assertion_error, exception) make_exception_impl("LookupError", lookup_error, exception) -- cgit v1.2.3