mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-21 00:58:01 +02:00
more tests
This commit is contained in:
@ -60,13 +60,8 @@ int main(int argc, char *argv[]) {
|
||||
//How big should this try block be?
|
||||
sls::Detector det(parser.multi_id());
|
||||
sls::CmdProxy proxy(&det);
|
||||
auto cmd = proxy.Call(parser.command(), parser.arguments(),
|
||||
proxy.Call(parser.command(), parser.arguments(),
|
||||
parser.detector_id(), action);
|
||||
// TODO! move this check into CmdProxy
|
||||
if (!cmd.empty()) {
|
||||
std::cout << cmd
|
||||
<< " Unknown command, use list to list all commands\n";
|
||||
}
|
||||
} catch (const sls::RuntimeError &e) {
|
||||
// OK to catch and do nothing since this will print the error message
|
||||
// and command line app will anyway exit
|
||||
|
@ -25,7 +25,7 @@ std::ostream &operator<<(std::ostream &os,
|
||||
return os;
|
||||
}
|
||||
|
||||
std::string CmdProxy::Call(const std::string &command,
|
||||
void CmdProxy::Call(const std::string &command,
|
||||
const std::vector<std::string> &arguments,
|
||||
int detector_id, int action, std::ostream &os) {
|
||||
cmd = command;
|
||||
@ -37,9 +37,8 @@ std::string CmdProxy::Call(const std::string &command,
|
||||
auto it = functions.find(cmd);
|
||||
if (it != functions.end()) {
|
||||
os << ((*this).*(it->second))(action);
|
||||
return {};
|
||||
} else {
|
||||
return cmd;
|
||||
throw sls::RuntimeError(cmd + " Unknown command, use list to list all commands");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -416,7 +416,7 @@ class CmdProxy {
|
||||
public:
|
||||
explicit CmdProxy(Detector *ptr) : det(ptr) {}
|
||||
|
||||
std::string Call(const std::string &command,
|
||||
void Call(const std::string &command,
|
||||
const std::vector<std::string> &arguments, int detector_id = -1,
|
||||
int action = -1, std::ostream &os = std::cout);
|
||||
|
||||
|
Reference in New Issue
Block a user