diff options
Diffstat (limited to 'host/lib/rfnoc/block_ctrl_base_factory.cpp')
-rw-r--r-- | host/lib/rfnoc/block_ctrl_base_factory.cpp | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/host/lib/rfnoc/block_ctrl_base_factory.cpp b/host/lib/rfnoc/block_ctrl_base_factory.cpp index 554db5acf..6f3e9d9f7 100644 --- a/host/lib/rfnoc/block_ctrl_base_factory.cpp +++ b/host/lib/rfnoc/block_ctrl_base_factory.cpp @@ -5,11 +5,10 @@ // SPDX-License-Identifier: GPL-3.0-or-later // -#include <boost/format.hpp> - -#include <uhd/utils/log.hpp> -#include <uhd/rfnoc/blockdef.hpp> #include <uhd/rfnoc/block_ctrl_base.hpp> +#include <uhd/rfnoc/blockdef.hpp> +#include <uhd/utils/log.hpp> +#include <boost/format.hpp> using namespace uhd; using namespace uhd::rfnoc; @@ -18,14 +17,13 @@ typedef uhd::dict<std::string, block_ctrl_base::make_t> block_fcn_reg_t; // Instantiate the block function registry container UHD_SINGLETON_FCN(block_fcn_reg_t, get_block_fcn_regs); -void block_ctrl_base::register_block( - const make_t &make, - const std::string &key -) { +void block_ctrl_base::register_block(const make_t& make, const std::string& key) +{ if (get_block_fcn_regs().has_key(key)) { - throw uhd::runtime_error( - str(boost::format("Attempting to register an RFNoC block with key %s for the second time.") % key) - ); + throw uhd::runtime_error(str( + boost::format( + "Attempting to register an RFNoC block with key %s for the second time.") + % key)); } get_block_fcn_regs().set(key, make); @@ -33,7 +31,7 @@ void block_ctrl_base::register_block( /*! Look up names for blocks in XML files using NoC ID. */ -static void lookup_block_key(uint64_t noc_id, make_args_t &make_args) +static void lookup_block_key(uint64_t noc_id, make_args_t& make_args) { try { blockdef::sptr bd = blockdef::make_from_noc_id(noc_id); @@ -46,8 +44,10 @@ static void lookup_block_key(uint64_t noc_id, make_args_t &make_args) make_args.block_key = bd->get_key(); make_args.block_name = bd->get_name(); return; - } catch (std::exception &e) { - UHD_LOGGER_WARNING("RFNOC") << str(boost::format("Error while looking up name for NoC-ID %016X.\n%s") % noc_id % e.what()) ; + } catch (std::exception& e) { + UHD_LOGGER_WARNING("RFNOC") + << str(boost::format("Error while looking up name for NoC-ID %016X.\n%s") + % noc_id % e.what()); } make_args.block_key = DEFAULT_BLOCK_NAME; @@ -56,9 +56,8 @@ static void lookup_block_key(uint64_t noc_id, make_args_t &make_args) block_ctrl_base::sptr block_ctrl_base::make( - const make_args_t &make_args_, - uint64_t noc_id -) { + const make_args_t& make_args_, uint64_t noc_id) +{ UHD_LOGGER_TRACE("RFNOC") << "[RFNoC Factory] block_ctrl_base::make()"; make_args_t make_args = make_args_; @@ -68,22 +67,21 @@ block_ctrl_base::sptr block_ctrl_base::make( lookup_block_key(noc_id, make_args); } else if (not get_block_fcn_regs().has_key(make_args.block_key)) { throw uhd::runtime_error( - str(boost::format("No block controller class registered for key '%s'.") % make_args.block_key) - ); + str(boost::format("No block controller class registered for key '%s'.") + % make_args.block_key)); } if (not get_block_fcn_regs().has_key(make_args.block_key)) { UHD_LOG_WARNING("RFNOC", - "Can't find a block controller for key " << make_args.block_key - << ", using default block controller!"); + "Can't find a block controller for key " + << make_args.block_key << ", using default block controller!"); make_args.block_key = DEFAULT_BLOCK_NAME; } if (make_args.block_name.empty()) { make_args.block_name = make_args.block_key; } - UHD_LOGGER_TRACE("RFNOC") - << "[RFNoC Factory] Using controller key '" << make_args.block_key - << "' and block name '" << make_args.block_name << "'"; + UHD_LOGGER_TRACE("RFNOC") << "[RFNoC Factory] Using controller key '" + << make_args.block_key << "' and block name '" + << make_args.block_name << "'"; return get_block_fcn_regs()[make_args.block_key](make_args); } - |