tool/Command.cpp
changeset 1870 0cee1fb7f0fd
parent 1869 14f634f5b613
child 1880 f46bec1b5f21
--- a/tool/Command.cpp	Thu Mar 11 15:03:52 2010 +0100
+++ b/tool/Command.cpp	Thu Mar 11 15:17:25 2010 +0100
@@ -209,6 +209,19 @@
 
 /*****************************************************************************/
 
+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();
+}
+
+/*****************************************************************************/
+
 Command::SlaveList Command::selectedSlaves(MasterDevice &m)
 {
     ec_ioctl_master_t master;