diff options
author | Josh Blum <josh@joshknows.com> | 2011-02-24 14:54:24 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-02-24 14:54:24 -0800 |
commit | 16f08844d7b6ccbdcfdf17963b88cadb7525ddc6 (patch) | |
tree | 802a4e5558706155d7231ccb8f64b44b1cd67599 /host/include | |
parent | 20a524d1a00497bdffda0292143d92e4d98cfbe9 (diff) | |
download | uhd-16f08844d7b6ccbdcfdf17963b88cadb7525ddc6.tar.gz uhd-16f08844d7b6ccbdcfdf17963b88cadb7525ddc6.tar.bz2 uhd-16f08844d7b6ccbdcfdf17963b88cadb7525ddc6.zip |
uhd: renamed the assert header to assert has
only the assert has implementation is in this header
uhd assert throw moved to the exception header
updated code base includes to match
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/exception.hpp | 9 | ||||
-rw-r--r-- | host/include/uhd/utils/CMakeLists.txt | 4 | ||||
-rw-r--r-- | host/include/uhd/utils/assert_has.hpp (renamed from host/include/uhd/utils/assert.hpp) | 14 | ||||
-rw-r--r-- | host/include/uhd/utils/assert_has.ipp (renamed from host/include/uhd/utils/assert.ipp) | 7 |
4 files changed, 19 insertions, 15 deletions
diff --git a/host/include/uhd/exception.hpp b/host/include/uhd/exception.hpp index 71836e22e..9acc768ed 100644 --- a/host/include/uhd/exception.hpp +++ b/host/include/uhd/exception.hpp @@ -114,6 +114,15 @@ namespace uhd{ #define UHD_THROW_INVALID_CODE_PATH() \ throw uhd::system_error(UHD_THROW_SITE_INFO("invalid code path")) + /*! + * Assert the result of the code evaluation. + * If the code evaluates to false, throw an assertion error. + * \param code the code that resolved to a boolean + */ + #define UHD_ASSERT_THROW(code) if (not (code)) \ + throw uhd::assertion_error(UHD_THROW_SITE_INFO(#code)); \ + else void(0) + } //namespace uhd #endif /* INCLUDED_UHD_UTILS_EXCEPTION_HPP */ diff --git a/host/include/uhd/utils/CMakeLists.txt b/host/include/uhd/utils/CMakeLists.txt index b638431d3..4ed7ca460 100644 --- a/host/include/uhd/utils/CMakeLists.txt +++ b/host/include/uhd/utils/CMakeLists.txt @@ -17,8 +17,8 @@ INSTALL(FILES algorithm.hpp - assert.hpp - assert.ipp + assert_has.hpp + assert_has.ipp byteswap.hpp byteswap.ipp gain_group.hpp diff --git a/host/include/uhd/utils/assert.hpp b/host/include/uhd/utils/assert_has.hpp index 1be4237d6..eae7652ad 100644 --- a/host/include/uhd/utils/assert.hpp +++ b/host/include/uhd/utils/assert_has.hpp @@ -15,20 +15,14 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. // -#ifndef INCLUDED_UHD_UTILS_ASSERT_HPP -#define INCLUDED_UHD_UTILS_ASSERT_HPP +#ifndef INCLUDED_UHD_UTILS_ASSERT_HAS_HPP +#define INCLUDED_UHD_UTILS_ASSERT_HAS_HPP #include <uhd/config.hpp> -#include <uhd/exception.hpp> #include <string> namespace uhd{ - //! Throw an assert error with throw-site information - #define UHD_ASSERT_THROW(_x) if (not (_x)) throw uhd::assertion_error( \ - UHD_THROW_SITE_INFO("assertion failed: " + std::string(#_x)) \ - ); else void(0) - /*! * Check that an element is found in a container. * If not, throw a meaningful assertion error. @@ -48,6 +42,6 @@ namespace uhd{ }//namespace uhd -#include <uhd/utils/assert.ipp> +#include <uhd/utils/assert_has.ipp> -#endif /* INCLUDED_UHD_UTILS_ASSERT_HPP */ +#endif /* INCLUDED_UHD_UTILS_ASSERT_HAS_HPP */ diff --git a/host/include/uhd/utils/assert.ipp b/host/include/uhd/utils/assert_has.ipp index 4374fff67..a46d172f4 100644 --- a/host/include/uhd/utils/assert.ipp +++ b/host/include/uhd/utils/assert_has.ipp @@ -15,10 +15,11 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. // -#ifndef INCLUDED_UHD_UTILS_ASSERT_IPP -#define INCLUDED_UHD_UTILS_ASSERT_IPP +#ifndef INCLUDED_UHD_UTILS_ASSERT_HAS_IPP +#define INCLUDED_UHD_UTILS_ASSERT_HAS_IPP #include <uhd/utils/algorithm.hpp> +#include <uhd/exception.hpp> #include <boost/format.hpp> #include <boost/foreach.hpp> #include <boost/lexical_cast.hpp> @@ -49,4 +50,4 @@ namespace uhd{ }//namespace uhd -#endif /* INCLUDED_UHD_UTILS_ASSERT_IPP */ +#endif /* INCLUDED_UHD_UTILS_ASSERT_HAS_IPP */ |