diff options
author | Martin Braun <martin.braun@ettus.com> | 2020-03-02 15:25:13 -0800 |
---|---|---|
committer | atrnati <54334261+atrnati@users.noreply.github.com> | 2020-03-03 08:51:32 -0600 |
commit | 876d4150aa3da531ddd687b48afada6e43f79146 (patch) | |
tree | fd72a71419f4cd800d4e500cfcaded4dfc8dc367 /host/lib/image_loader.cpp | |
parent | 1393553d623bdf4ba40d5435c9719b6ce990d9ac (diff) | |
download | uhd-876d4150aa3da531ddd687b48afada6e43f79146.tar.gz uhd-876d4150aa3da531ddd687b48afada6e43f79146.tar.bz2 uhd-876d4150aa3da531ddd687b48afada6e43f79146.zip |
uhd: Apply clang-format against all .cpp and .hpp files in host/
Note: template_lvbitx.{cpp,hpp} need to be excluded from the list of
files that clang-format gets applied against.
Diffstat (limited to 'host/lib/image_loader.cpp')
-rw-r--r-- | host/lib/image_loader.cpp | 64 |
1 files changed, 34 insertions, 30 deletions
diff --git a/host/lib/image_loader.cpp b/host/lib/image_loader.cpp index 7e91dfaec..38fed1c87 100644 --- a/host/lib/image_loader.cpp +++ b/host/lib/image_loader.cpp @@ -5,18 +5,15 @@ // SPDX-License-Identifier: GPL-3.0-or-later // -#include <iostream> -#include <map> -#include <utility> - -#include <boost/filesystem.hpp> -#include <boost/format.hpp> - #include <uhd/exception.hpp> #include <uhd/image_loader.hpp> #include <uhd/utils/log.hpp> - #include <uhd/utils/static.hpp> +#include <boost/filesystem.hpp> +#include <boost/format.hpp> +#include <iostream> +#include <map> +#include <utility> namespace fs = boost::filesystem; @@ -28,15 +25,17 @@ typedef std::pair<std::string, uhd::image_loader::loader_fcn_t> loader_fcn_pair_ typedef std::pair<std::string, std::string> string_pair_t; UHD_SINGLETON_FCN(loader_fcn_map_t, get_image_loaders); -UHD_SINGLETON_FCN(string_map_t, get_recovery_strings); +UHD_SINGLETON_FCN(string_map_t, get_recovery_strings); /* * Registration */ -void uhd::image_loader::register_image_loader(const std::string &device_type, - const loader_fcn_t &loader_fcn, - const std::string &recovery_instructions){ - // UHD_LOGGER_TRACE("UHD") << "Registering image loader and recovery instructions for " +void uhd::image_loader::register_image_loader(const std::string& device_type, + const loader_fcn_t& loader_fcn, + const std::string& recovery_instructions) +{ + // UHD_LOGGER_TRACE("UHD") << "Registering image loader and recovery instructions for + // " // << device_type; get_image_loaders().insert(loader_fcn_pair_t(device_type, loader_fcn)); @@ -46,20 +45,23 @@ void uhd::image_loader::register_image_loader(const std::string &device_type, /* * Actual loading */ -bool uhd::image_loader::load(const uhd::image_loader::image_loader_args_t &image_loader_args){ - +bool uhd::image_loader::load( + const uhd::image_loader::image_loader_args_t& image_loader_args) +{ // If "type=foo" given in args, see if we have an image loader for that - if(image_loader_args.args.has_key("type")){ + if (image_loader_args.args.has_key("type")) { std::string type = image_loader_args.args.get("type"); - if(get_image_loaders().find(type) == get_image_loaders().end()){ - throw uhd::runtime_error(str(boost::format("There is no image loader registered for given type \"%s\".") - % type)); - } - else return get_image_loaders().at(type)(image_loader_args); - } - else{ - for(const loader_fcn_pair_t &loader_fcn_pair: get_image_loaders()){ - if(loader_fcn_pair.second(image_loader_args)) return true; + if (get_image_loaders().find(type) == get_image_loaders().end()) { + throw uhd::runtime_error( + str(boost::format( + "There is no image loader registered for given type \"%s\".") + % type)); + } else + return get_image_loaders().at(type)(image_loader_args); + } else { + for (const loader_fcn_pair_t& loader_fcn_pair : get_image_loaders()) { + if (loader_fcn_pair.second(image_loader_args)) + return true; } return false; } @@ -68,9 +70,11 @@ bool uhd::image_loader::load(const uhd::image_loader::image_loader_args_t &image /* * Get recovery instructions for particular device */ -std::string uhd::image_loader::get_recovery_instructions(const std::string &device_type){ - if(get_recovery_strings().count(device_type) == 0){ - return "A firmware or FPGA loading process was interrupted by the user. This can leave your device in a non-working state."; - } - else return get_recovery_strings().at(device_type); +std::string uhd::image_loader::get_recovery_instructions(const std::string& device_type) +{ + if (get_recovery_strings().count(device_type) == 0) { + return "A firmware or FPGA loading process was interrupted by the user. This can " + "leave your device in a non-working state."; + } else + return get_recovery_strings().at(device_type); } |