From 20a524d1a00497bdffda0292143d92e4d98cfbe9 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 24 Feb 2011 14:18:52 -0800 Subject: uhd: moved exception to top level include --- host/lib/CMakeLists.txt | 1 + host/lib/convert/convert_impl.cpp | 2 +- host/lib/exception.cpp | 47 +++++++++++++++++++++++++++++++++++ host/lib/transport/usb_dummy_impl.cpp | 2 +- host/lib/types/sensors.cpp | 2 +- host/lib/usrp/usrp2/codec_ctrl.cpp | 2 +- host/lib/usrp/usrp2/codec_impl.cpp | 2 +- host/lib/usrp/usrp2/usrp2_iface.cpp | 2 +- host/lib/utils/CMakeLists.txt | 1 - host/lib/utils/exception.cpp | 47 ----------------------------------- 10 files changed, 54 insertions(+), 54 deletions(-) create mode 100644 host/lib/exception.cpp delete mode 100644 host/lib/utils/exception.cpp (limited to 'host/lib') diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index c8a5dd51e..c2dbef89b 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -97,6 +97,7 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_BINARY_DIR}/constants.hpp ${CMAKE_CURRENT_SOURCE_DIR}/device.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/exception.cpp ${CMAKE_CURRENT_SOURCE_DIR}/version.cpp ${CMAKE_CURRENT_SOURCE_DIR}/wax.cpp ) diff --git a/host/lib/convert/convert_impl.cpp b/host/lib/convert/convert_impl.cpp index 6a5a1465d..d43cecfec 100644 --- a/host/lib/convert/convert_impl.cpp +++ b/host/lib/convert/convert_impl.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include using namespace uhd; diff --git a/host/lib/exception.cpp b/host/lib/exception.cpp new file mode 100644 index 000000000..2299aa93f --- /dev/null +++ b/host/lib/exception.cpp @@ -0,0 +1,47 @@ +// +// Copyright 2011 Ettus Research LLC +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +#include +#include +#include + +using namespace uhd; + +static unsigned make_code(const std::string &name){ + boost::hash string_hash; + return unsigned(string_hash(name) & 0xfff); +}; + +exception::exception(const std::string &what): + std::runtime_error(what){/* NOP */} + +#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 make_code(#class);} + +make_exception_impl("AssertionError", assertion_error, exception) +make_exception_impl("LookupError", lookup_error, exception) +make_exception_impl("IndexError", index_error, lookup_error) +make_exception_impl("KeyError", key_error, lookup_error) +make_exception_impl("ValueError", value_error, exception) +make_exception_impl("RuntimeError", runtime_error, exception) +make_exception_impl("NotImplementedError", not_implemented_error, runtime_error) +make_exception_impl("EnvironmentError", environment_error, exception) +make_exception_impl("IOError", io_error, environment_error) +make_exception_impl("OSError", os_error, environment_error) +make_exception_impl("SystemError", system_error, exception) diff --git a/host/lib/transport/usb_dummy_impl.cpp b/host/lib/transport/usb_dummy_impl.cpp index 8a9772e7f..419a52279 100644 --- a/host/lib/transport/usb_dummy_impl.cpp +++ b/host/lib/transport/usb_dummy_impl.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include using namespace uhd; using namespace uhd::transport; diff --git a/host/lib/types/sensors.cpp b/host/lib/types/sensors.cpp index 5f7115d70..401c229a3 100644 --- a/host/lib/types/sensors.cpp +++ b/host/lib/types/sensors.cpp @@ -16,7 +16,7 @@ // #include -#include +#include #include #include diff --git a/host/lib/usrp/usrp2/codec_ctrl.cpp b/host/lib/usrp/usrp2/codec_ctrl.cpp index 890969b5a..0756c7971 100644 --- a/host/lib/usrp/usrp2/codec_ctrl.cpp +++ b/host/lib/usrp/usrp2/codec_ctrl.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include static const bool codec_ctrl_debug = false; diff --git a/host/lib/usrp/usrp2/codec_impl.cpp b/host/lib/usrp/usrp2/codec_impl.cpp index 09bec6db2..2135b155a 100644 --- a/host/lib/usrp/usrp2/codec_impl.cpp +++ b/host/lib/usrp/usrp2/codec_impl.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include using namespace uhd; using namespace uhd::usrp; diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index 4407a3011..6426ffd3e 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -17,7 +17,7 @@ #include "usrp2_regs.hpp" #include "usrp2_iface.hpp" -#include +#include #include #include #include diff --git a/host/lib/utils/CMakeLists.txt b/host/lib/utils/CMakeLists.txt index 082553ff9..c0d99b37e 100644 --- a/host/lib/utils/CMakeLists.txt +++ b/host/lib/utils/CMakeLists.txt @@ -110,7 +110,6 @@ SET_SOURCE_FILES_PROPERTIES( # Append sources ######################################################################## LIBUHD_APPEND_SOURCES( - ${CMAKE_CURRENT_SOURCE_DIR}/exception.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gain_group.cpp ${CMAKE_CURRENT_SOURCE_DIR}/images.cpp ${CMAKE_CURRENT_SOURCE_DIR}/load_modules.cpp diff --git a/host/lib/utils/exception.cpp b/host/lib/utils/exception.cpp deleted file mode 100644 index e66addb0c..000000000 --- a/host/lib/utils/exception.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// -// Copyright 2011 Ettus Research LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// - -#include -#include -#include - -using namespace uhd; - -static unsigned make_code(const std::string &name){ - boost::hash string_hash; - return unsigned(string_hash(name) & 0xfff); -}; - -exception::exception(const std::string &what): - std::runtime_error(what){/* NOP */} - -#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 make_code(#class);} - -make_exception_impl("AssertionError", assertion_error, exception) -make_exception_impl("LookupError", lookup_error, exception) -make_exception_impl("IndexError", index_error, lookup_error) -make_exception_impl("KeyError", key_error, lookup_error) -make_exception_impl("ValueError", value_error, exception) -make_exception_impl("RuntimeError", runtime_error, exception) -make_exception_impl("NotImplementedError", not_implemented_error, runtime_error) -make_exception_impl("EnvironmentError", environment_error, exception) -make_exception_impl("IOError", io_error, environment_error) -make_exception_impl("OSError", os_error, environment_error) -make_exception_impl("SystemError", system_error, exception) -- cgit v1.2.3