This commit is contained in:
2019-10-28 16:27:20 +01:00
parent bc7ebd45df
commit 8c279695de
5 changed files with 91 additions and 119 deletions

View File

@@ -1467,6 +1467,45 @@ std::string CmdProxy::BitOperations(int action) {
/* Insignificant */
std::string CmdProxy::ExecuteCommand(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[command]\n\tExecutes command on detector server." << '\n';
} else if (action == defs::GET_ACTION) {
throw sls::RuntimeError("Cannot get.");
} else if (action == defs::PUT_ACTION) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
det->executeCommand(args[0], {det_id});
os << "successful" << '\n';
} else {
throw sls::RuntimeError("Unknown action");
}
return os.str();
}
std::string CmdProxy::UserDetails(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "\n\tUser details from shared memory." << '\n';
} else if (action == defs::GET_ACTION) {
if (det_id != -1) {
throw sls::RuntimeError("Cannot execute this at module level");
}
if (args.size() != 0) {
WrongNumberOfParameters(0);
}
auto t = det->getUserDetails();
os << t << '\n';
} else if (action == defs::PUT_ACTION) {
throw sls::RuntimeError("Cannot put.");
} else {
throw sls::RuntimeError("Unknown action");
}
return os.str();
}
} // namespace sls