aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/common/validate_subdev_spec.cpp
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2020-03-02 15:25:13 -0800
committeratrnati <54334261+atrnati@users.noreply.github.com>2020-03-03 08:51:32 -0600
commit876d4150aa3da531ddd687b48afada6e43f79146 (patch)
treefd72a71419f4cd800d4e500cfcaded4dfc8dc367 /host/lib/usrp/common/validate_subdev_spec.cpp
parent1393553d623bdf4ba40d5435c9719b6ce990d9ac (diff)
downloaduhd-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/usrp/common/validate_subdev_spec.cpp')
-rw-r--r--host/lib/usrp/common/validate_subdev_spec.cpp82
1 files changed, 46 insertions, 36 deletions
diff --git a/host/lib/usrp/common/validate_subdev_spec.cpp b/host/lib/usrp/common/validate_subdev_spec.cpp
index 369119e4a..61895a7f8 100644
--- a/host/lib/usrp/common/validate_subdev_spec.cpp
+++ b/host/lib/usrp/common/validate_subdev_spec.cpp
@@ -5,58 +5,68 @@
// SPDX-License-Identifier: GPL-3.0-or-later
//
-#include <uhdlib/usrp/common/validate_subdev_spec.hpp>
#include <uhd/exception.hpp>
#include <uhd/utils/assert_has.hpp>
+#include <uhdlib/usrp/common/validate_subdev_spec.hpp>
#include <boost/format.hpp>
using namespace uhd;
using namespace uhd::usrp;
-namespace uhd{ namespace usrp{
+namespace uhd { namespace usrp {
- static std::ostream& operator<< (std::ostream &out, const subdev_spec_pair_t &pair){
- out << pair.db_name << ":" << pair.sd_name;
- return out;
- }
+static std::ostream& operator<<(std::ostream& out, const subdev_spec_pair_t& pair)
+{
+ out << pair.db_name << ":" << pair.sd_name;
+ return out;
+}
+
+}} // namespace uhd::usrp
+
+void uhd::usrp::validate_subdev_spec(property_tree::sptr tree,
+ const subdev_spec_t& spec,
+ const std::string& type,
+ const std::string& mb)
+{
+ const size_t num_dsps =
+ tree->list(str(boost::format("/mboards/%s/%s_dsps") % mb % type)).size();
+
+ // sanity checking on the length
+ if (spec.size() == 0)
+ throw uhd::value_error(
+ str(boost::format("Empty %s subdevice specification is not supported.\n")
+ % type));
+ if (spec.size() > num_dsps)
+ throw uhd::value_error(
+ str(boost::format("The subdevice specification \"%s\" is too long.\n"
+ "The user specified %u channels, but there are only %u %s "
+ "dsps on mboard %s.\n")
+ % spec.to_string() % spec.size() % num_dsps % type % mb));
-}}
-
-void uhd::usrp::validate_subdev_spec(
- property_tree::sptr tree,
- const subdev_spec_t &spec,
- const std::string &type,
- const std::string &mb
-){
- const size_t num_dsps = tree->list(str(boost::format("/mboards/%s/%s_dsps") % mb % type)).size();
-
- //sanity checking on the length
- if (spec.size() == 0) throw uhd::value_error(str(boost::format(
- "Empty %s subdevice specification is not supported.\n"
- ) % type));
- if (spec.size() > num_dsps) throw uhd::value_error(str(boost::format(
- "The subdevice specification \"%s\" is too long.\n"
- "The user specified %u channels, but there are only %u %s dsps on mboard %s.\n"
- ) % spec.to_string() % spec.size() % num_dsps % type % mb));
-
- //make a list of all possible specs
+ // make a list of all possible specs
subdev_spec_t all_specs;
- for(const std::string &db: tree->list(str(boost::format("/mboards/%s/dboards") % mb))){
- for(const std::string &sd: tree->list(str(boost::format("/mboards/%s/dboards/%s/%s_frontends") % mb % db % type))){
+ for (const std::string& db :
+ tree->list(str(boost::format("/mboards/%s/dboards") % mb))) {
+ for (const std::string& sd :
+ tree->list(str(
+ boost::format("/mboards/%s/dboards/%s/%s_frontends") % mb % db % type))) {
all_specs.push_back(subdev_spec_pair_t(db, sd));
}
}
- //validate that the spec is possible
- for(const subdev_spec_pair_t &pair: spec){
- uhd::assert_has(all_specs, pair, str(boost::format("%s subdevice specification on mboard %s") % type % mb));
+ // validate that the spec is possible
+ for (const subdev_spec_pair_t& pair : spec) {
+ uhd::assert_has(all_specs,
+ pair,
+ str(boost::format("%s subdevice specification on mboard %s") % type % mb));
}
- //enable selected frontends, disable others
- for(const subdev_spec_pair_t &pair: all_specs){
+ // enable selected frontends, disable others
+ for (const subdev_spec_pair_t& pair : all_specs) {
const bool enb = uhd::has(spec, pair);
- tree->access<bool>(str(boost::format(
- "/mboards/%s/dboards/%s/%s_frontends/%s/enabled"
- ) % mb % pair.db_name % type % pair.sd_name)).set(enb);
+ tree->access<bool>(
+ str(boost::format("/mboards/%s/dboards/%s/%s_frontends/%s/enabled") % mb
+ % pair.db_name % type % pair.sd_name))
+ .set(enb);
}
}