mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 21:07:13 +02:00
Merge branch 'developer' into gui
This commit is contained in:
@ -14,6 +14,7 @@ class CmdLineParser {
|
||||
int detector_id() const { return detector_id_; };
|
||||
int n_arguments() const { return arguments_.size(); }
|
||||
const std::string &command() const { return command_; }
|
||||
bool isHelp() const{return help_;}
|
||||
void setCommand(std::string cmd){command_ = cmd;}
|
||||
const std::string &executable() const { return executable_; }
|
||||
const std::vector<std::string> &arguments() const { return arguments_; };
|
||||
@ -23,6 +24,7 @@ class CmdLineParser {
|
||||
void DecodeIdAndPosition(const char *c);
|
||||
int multi_id_ = 0;
|
||||
int detector_id_ = -1;
|
||||
bool help_{false};
|
||||
std::string command_;
|
||||
std::string executable_;
|
||||
std::vector<std::string> arguments_;
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "logger.h"
|
||||
#include "slsDetectorCommand.h"
|
||||
#include "sls_detector_exceptions.h"
|
||||
#include "sls_detector_defs.h"
|
||||
#include "string_utils.h"
|
||||
|
||||
namespace sls {
|
||||
@ -20,7 +21,8 @@ template <typename T> class CmdProxy {
|
||||
|
||||
std::string Call(const std::string &command,
|
||||
const std::vector<std::string> &arguments,
|
||||
int detector_id) {
|
||||
int detector_id,
|
||||
int action=-1) {
|
||||
cmd = command;
|
||||
args = arguments;
|
||||
det_id = detector_id;
|
||||
@ -29,7 +31,7 @@ template <typename T> class CmdProxy {
|
||||
|
||||
auto it = functions.find(cmd);
|
||||
if (it != functions.end()) {
|
||||
std::cout << ((*this).*(it->second))();
|
||||
std::cout << ((*this).*(it->second))(action);
|
||||
return {};
|
||||
} else {
|
||||
return cmd;
|
||||
@ -57,7 +59,7 @@ template <typename T> class CmdProxy {
|
||||
std::vector<std::string> args;
|
||||
int det_id{-1};
|
||||
|
||||
using FunctionMap = std::map<std::string, std::string (CmdProxy::*)()>;
|
||||
using FunctionMap = std::map<std::string, std::string (CmdProxy::*)(int)>;
|
||||
using StringMap = std::map<std::string, std::string>;
|
||||
|
||||
// Initialize maps for translating name and function
|
||||
@ -91,7 +93,10 @@ template <typename T> class CmdProxy {
|
||||
|
||||
// Mapped functions
|
||||
|
||||
std::string ListCommands() {
|
||||
std::string ListCommands(int action) {
|
||||
if (action==slsDetectorDefs::HELP_ACTION)
|
||||
return "list - lists all available commands, list deprecated - list deprecated commands\n";
|
||||
|
||||
if (args.size() == 0) {
|
||||
auto commands = slsDetectorCommand(nullptr).getAllCommands();
|
||||
for (const auto &it : functions)
|
||||
|
@ -27,49 +27,39 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
struct CriticalError : public RuntimeError {
|
||||
struct SharedMemoryError : public RuntimeError {
|
||||
public:
|
||||
CriticalError(std::string msg):RuntimeError(msg) {}
|
||||
SharedMemoryError(std::string msg):RuntimeError(msg) {}
|
||||
};
|
||||
|
||||
struct SharedMemoryError : public CriticalError {
|
||||
struct SocketError : public RuntimeError {
|
||||
public:
|
||||
SharedMemoryError(std::string msg):CriticalError(msg) {}
|
||||
SocketError(std::string msg):RuntimeError(msg) {}
|
||||
};
|
||||
|
||||
struct SocketError : public CriticalError {
|
||||
struct ZmqSocketError : public RuntimeError {
|
||||
public:
|
||||
SocketError(std::string msg):CriticalError(msg) {}
|
||||
ZmqSocketError(std::string msg):RuntimeError(msg) {}
|
||||
};
|
||||
|
||||
struct ZmqSocketError : public CriticalError {
|
||||
struct NotImplementedError : public RuntimeError {
|
||||
public:
|
||||
ZmqSocketError(std::string msg):CriticalError(msg) {}
|
||||
NotImplementedError(std::string msg):RuntimeError(msg) {}
|
||||
};
|
||||
|
||||
struct NonCriticalError : public RuntimeError {
|
||||
struct DetectorError : public RuntimeError {
|
||||
public:
|
||||
NonCriticalError(std::string msg):RuntimeError(msg) {}
|
||||
DetectorError(std::string msg):RuntimeError(msg) {}
|
||||
};
|
||||
|
||||
struct NotImplementedError : public NonCriticalError {
|
||||
struct ReceiverError : public RuntimeError {
|
||||
public:
|
||||
NotImplementedError(std::string msg):NonCriticalError(msg) {}
|
||||
ReceiverError(std::string msg):RuntimeError(msg) {}
|
||||
};
|
||||
|
||||
struct DetectorError : public NonCriticalError {
|
||||
struct GuiError : public RuntimeError {
|
||||
public:
|
||||
DetectorError(std::string msg):NonCriticalError(msg) {}
|
||||
};
|
||||
|
||||
struct ReceiverError : public NonCriticalError {
|
||||
public:
|
||||
ReceiverError(std::string msg):NonCriticalError(msg) {}
|
||||
};
|
||||
|
||||
struct GuiError : public NonCriticalError {
|
||||
public:
|
||||
GuiError(std::string msg):NonCriticalError(msg) {}
|
||||
GuiError(std::string msg):RuntimeError(msg) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user