diff options
author | telsoa01 <telmo.soares@arm.com> | 2018-08-31 09:22:23 +0100 |
---|---|---|
committer | telsoa01 <telmo.soares@arm.com> | 2018-08-31 09:22:23 +0100 |
commit | c577f2c6a3b4ddb6ba87a882723c53a248afbeba (patch) | |
tree | bd7d4c148df27f8be6649d313efb24f536b7cf34 /include/armnn/Exceptions.hpp | |
parent | 4c7098bfeab1ffe1cdc77f6c15548d3e73274746 (diff) | |
download | armnn-c577f2c6a3b4ddb6ba87a882723c53a248afbeba.tar.gz |
Release 18.08
Diffstat (limited to 'include/armnn/Exceptions.hpp')
-rw-r--r-- | include/armnn/Exceptions.hpp | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/include/armnn/Exceptions.hpp b/include/armnn/Exceptions.hpp index 630c77660d..403fc593b5 100644 --- a/include/armnn/Exceptions.hpp +++ b/include/armnn/Exceptions.hpp @@ -11,7 +11,38 @@ namespace armnn { -// base class for all ArmNN exceptions so that users can filter to just those +struct CheckLocation +{ + const char* m_Function; + const char* m_File; + unsigned int m_Line; + + CheckLocation(const char* func, + const char* file, + unsigned int line) + : m_Function{func} + , m_File{file} + , m_Line{line} + { + } + + std::string AsString() const + { + std::stringstream ss; + ss << " at function " << m_Function + << " [" << m_File << ':' << m_Line << "]"; + return ss.str(); + } + + std::string FileLine() const + { + std::stringstream ss; + ss << " [" << m_File << ':' << m_Line << "]"; + return ss.str(); + } +}; + +/// Base class for all ArmNN exceptions so that users can filter to just those. class Exception : public std::exception { public: @@ -91,4 +122,6 @@ void ConditionalThrowIfNotEqual(const std::string& message, } } -} +} // namespace armnn + +#define CHECK_LOCATION() armnn::CheckLocation(__func__, __FILE__, __LINE__) |