aboutsummaryrefslogtreecommitdiff
path: root/include/armnn/Exceptions.hpp
diff options
context:
space:
mode:
authorDerek Lamberti <derek.lamberti@arm.com>2020-02-19 13:30:47 +0000
committerDerek Lamberti <derek.lamberti@arm.com>2020-03-09 09:17:21 +0000
commit4d4e0e2530629ae9ecfcb379bf0f27c6b18b6891 (patch)
tree5240428061fe5c57ce1c762908166432bca7d0c5 /include/armnn/Exceptions.hpp
parente66448491b836049df62e63e1e5151eefe3bfcf8 (diff)
downloadarmnn-4d4e0e2530629ae9ecfcb379bf0f27c6b18b6891.tar.gz
IVGCVSW-4483 Introduce polymorphic_downcast implementation
Change-Id: I958dd719162337eb5c7e71f4ac49dd5784564b1a Signed-off-by: Derek Lamberti <derek.lamberti@arm.com>
Diffstat (limited to 'include/armnn/Exceptions.hpp')
-rw-r--r--include/armnn/Exceptions.hpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/armnn/Exceptions.hpp b/include/armnn/Exceptions.hpp
index cb62079b76..05b740614d 100644
--- a/include/armnn/Exceptions.hpp
+++ b/include/armnn/Exceptions.hpp
@@ -143,6 +143,13 @@ public:
using Exception::Exception;
};
+class PolymorphicDowncastException : public Exception
+{
+public:
+ using Exception::Exception;
+};
+
+
template <typename ExceptionType>
void ConditionalThrow(bool condition, const std::string& message)
{
@@ -152,6 +159,16 @@ void ConditionalThrow(bool condition, const std::string& message)
}
}
+template <typename ExceptionType>
+void ConditionalThrow(bool condition)
+{
+ if (!condition)
+ {
+ throw ExceptionType();
+ }
+}
+
+
///
/// ComparedType must support:
/// operator==(const ComparedType&)