mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
fixed output
This commit is contained in:
parent
e89b65002a
commit
2c5ff0e9bf
@ -10,6 +10,10 @@
|
|||||||
|
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define TIME_COMMAND(GETFCN, SETFCN, HLPSTR) \
|
#define TIME_COMMAND(GETFCN, SETFCN, HLPSTR) \
|
||||||
std::ostringstream os; \
|
std::ostringstream os; \
|
||||||
@ -37,13 +41,13 @@
|
|||||||
} else { \
|
} else { \
|
||||||
WrongNumberOfParameters(2); \
|
WrongNumberOfParameters(2); \
|
||||||
} \
|
} \
|
||||||
os << ToString(args) << '\n'; \
|
os << args << '\n'; \
|
||||||
} else { \
|
} else { \
|
||||||
throw sls::RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
return os.str();
|
return os.str();
|
||||||
|
|
||||||
#define INTEGER_COMMAND(GETFCN, SETFCN, HLPSTR) \
|
#define INTEGER_COMMAND(GETFCN, SETFCN, CONV, HLPSTR) \
|
||||||
std::ostringstream os; \
|
std::ostringstream os; \
|
||||||
os << cmd << ' '; \
|
os << cmd << ' '; \
|
||||||
if (action == slsDetectorDefs::HELP_ACTION) \
|
if (action == slsDetectorDefs::HELP_ACTION) \
|
||||||
@ -57,12 +61,13 @@
|
|||||||
} \
|
} \
|
||||||
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
||||||
if (args.size() == 1) { \
|
if (args.size() == 1) { \
|
||||||
auto val = std::stoi(args[0]); \
|
auto val = CONV(args[0]); \
|
||||||
det->SETFCN(val, {det_id}); \
|
det->SETFCN(val, {det_id}); \
|
||||||
|
os << args.front() << '\n'; \
|
||||||
} else { \
|
} else { \
|
||||||
WrongNumberOfParameters(1); \
|
WrongNumberOfParameters(1); \
|
||||||
} \
|
} \
|
||||||
os << ToString(args) << '\n'; \
|
\
|
||||||
} else { \
|
} else { \
|
||||||
throw sls::RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
@ -70,6 +75,17 @@
|
|||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
|
|
||||||
|
std::ostream &operator<<(std::ostream &os,
|
||||||
|
const std::vector<std::string> &vec) {
|
||||||
|
if (!vec.empty()) {
|
||||||
|
auto it = vec.begin();
|
||||||
|
os << *it++;
|
||||||
|
while (it != vec.end())
|
||||||
|
os << ' ' << *it++;
|
||||||
|
}
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
std::string CmdProxy::Call(const std::string &command,
|
std::string CmdProxy::Call(const std::string &command,
|
||||||
const std::vector<std::string> &arguments,
|
const std::vector<std::string> &arguments,
|
||||||
int detector_id, int action, std::ostream &os) {
|
int detector_id, int action, std::ostream &os) {
|
||||||
@ -158,13 +174,12 @@ std::string CmdProxy::SubExptime(int action) {
|
|||||||
|
|
||||||
std::string CmdProxy::RxFifoDepth(const int action) {
|
std::string CmdProxy::RxFifoDepth(const int action) {
|
||||||
INTEGER_COMMAND(
|
INTEGER_COMMAND(
|
||||||
getRxFifoDepth, setRxFifoDepth,
|
getRxFifoDepth, setRxFifoDepth, std::stoi,
|
||||||
"[n_frames]\n\tSet the number of frames in the receiver fifo");
|
"[n_frames]\n\tSet the number of frames in the receiver fifo");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CmdProxy::RxSilent(const int action){
|
std::string CmdProxy::RxSilent(const int action) {
|
||||||
INTEGER_COMMAND(
|
INTEGER_COMMAND(getRxSilentMode, setRxSilentMode, std::stoi,
|
||||||
getRxSilentMode, setRxSilentMode,
|
|
||||||
"[0, 1]\n\tSwitch on or off receiver text output");
|
"[0, 1]\n\tSwitch on or off receiver text output");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user