summaryrefslogtreecommitdiff
path: root/cpp/include/Ice/UserExceptionFactory.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/include/Ice/UserExceptionFactory.h')
-rw-r--r--cpp/include/Ice/UserExceptionFactory.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/cpp/include/Ice/UserExceptionFactory.h b/cpp/include/Ice/UserExceptionFactory.h
index 73a22301d66..2d4f1c8c397 100644
--- a/cpp/include/Ice/UserExceptionFactory.h
+++ b/cpp/include/Ice/UserExceptionFactory.h
@@ -27,6 +27,30 @@ public:
typedef ::IceUtil::Handle<UserExceptionFactory> UserExceptionFactoryPtr;
+template<class E>
+class DefaultUserExceptionFactory : public UserExceptionFactory
+{
+public:
+
+ DefaultUserExceptionFactory(const ::std::string& typeId) :
+ _typeId(typeId)
+ {
+ }
+
+#ifndef NDEBUG
+ virtual void createAndThrow(const ::std::string& typeId)
+#else
+ virtual void createAndThrow(const ::std::string&)
+#endif
+ {
+ assert(typeId == _typeId);
+ throw E();
+ }
+
+private:
+ const ::std::string _typeId;
+};
+
}
#endif