tool/CommandDebug.cpp
changeset 1826 ec6223c3b7ec
parent 1804 742607c464c4
child 1869 14f634f5b613
equal deleted inserted replaced
1825:65781b048a47 1826:ec6223c3b7ec
    30 #include <sstream>
    30 #include <sstream>
    31 #include <iomanip>
    31 #include <iomanip>
    32 using namespace std;
    32 using namespace std;
    33 
    33 
    34 #include "CommandDebug.h"
    34 #include "CommandDebug.h"
       
    35 #include "MasterDevice.h"
    35 
    36 
    36 /*****************************************************************************/
    37 /*****************************************************************************/
    37 
    38 
    38 CommandDebug::CommandDebug():
    39 CommandDebug::CommandDebug():
    39     Command("debug", "Set the master's debug level.")
    40     Command("debug", "Set the master's debug level.")
    63     return str.str();
    64     return str.str();
    64 }
    65 }
    65 
    66 
    66 /****************************************************************************/
    67 /****************************************************************************/
    67 
    68 
    68 void CommandDebug::execute(MasterDevice &m, const StringVector &args)
    69 void CommandDebug::execute(const StringVector &args)
    69 {
    70 {
    70     stringstream str;
    71     stringstream str;
    71     int debugLevel;
    72     int debugLevel;
    72     
    73     
    73     if (args.size() != 1) {
    74     if (args.size() != 1) {
    84         stringstream err;
    85         stringstream err;
    85         err << "Invalid debug level '" << args[0] << "'!";
    86         err << "Invalid debug level '" << args[0] << "'!";
    86         throwInvalidUsageException(err);
    87         throwInvalidUsageException(err);
    87     }
    88     }
    88 
    89 
    89     m.open(MasterDevice::ReadWrite);
    90     MasterIndexList::const_iterator mi;
    90     m.setDebug(debugLevel);
    91     for (mi = getMasterIndices().begin();
       
    92             mi != getMasterIndices().end(); mi++) {
       
    93         MasterDevice m(*mi);
       
    94         m.open(MasterDevice::ReadWrite);
       
    95         m.setDebug(debugLevel);
       
    96     }
    91 }
    97 }
    92 
    98 
    93 /*****************************************************************************/
    99 /*****************************************************************************/