/** Lists the bus configuration. */ void CommandConfig::execute(const StringVector &args) { MasterIndexList masterIndices; bool doIndent; ConfigList configs; if (args.size()) { stringstream err; err << "'" << getName() << "' takes no arguments!"; throwInvalidUsageException(err); } masterIndices = getMasterIndices(); doIndent = masterIndices.size() > 1; MasterIndexList::const_iterator mi; for (mi = masterIndices.begin(); mi != masterIndices.end(); mi++) { MasterDevice m(*mi); m.open(MasterDevice::Read); configs = selectedConfigs(m); if (configs.size() && doIndent) { cout << "Master" << dec << m.getIndex() << endl; } if (getVerbosity() == Verbose) { showDetailedConfigs(m, configs, doIndent); } else { listConfigs(m, configs, doIndent); } } }
unsigned int Command::getSingleMasterIndex() const { MasterIndexList masterIndices = getMasterIndices(); if (masterIndices.size() != 1) { stringstream err; err << getName() << " requires to select a single master!"; throwInvalidUsageException(err); } return masterIndices.front(); }