mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 21:37:13 +02:00
help should doesn't create detector object (#508)
* help should doesn't create detector object instead passing nullptr to the Proxy
This commit is contained in:
@ -53,16 +53,18 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
if (parser.isHelp())
|
||||
action = slsDetectorDefs::HELP_ACTION;
|
||||
else {
|
||||
|
||||
// Free shared memory should work also without a detector
|
||||
// if we have an option for verify in the detector constructor
|
||||
// we could avoid this but clutter the code
|
||||
if (parser.command() == "free" && action != slsDetectorDefs::HELP_ACTION) {
|
||||
if (parser.detector_id() != -1)
|
||||
std::cout << "Cannot free shared memory of sub-detector\n";
|
||||
else
|
||||
sls::freeSharedMemory(parser.multi_id());
|
||||
return 0;
|
||||
// Free shared memory should work also without a detector
|
||||
// if we have an option for verify in the detector constructor
|
||||
// we could avoid this but clutter the code
|
||||
if (parser.command() == "free") {
|
||||
if (parser.detector_id() != -1)
|
||||
std::cout << "Cannot free shared memory of sub-detector\n";
|
||||
else
|
||||
sls::freeSharedMemory(parser.multi_id());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// prevent mem size check
|
||||
@ -71,8 +73,11 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
try {
|
||||
sls::Detector det(parser.multi_id());
|
||||
sls::CmdProxy proxy(&det);
|
||||
std::unique_ptr<sls::Detector> det{nullptr};
|
||||
if (action != slsDetectorDefs::HELP_ACTION) {
|
||||
det = sls::make_unique<sls::Detector>(parser.multi_id());
|
||||
}
|
||||
sls::CmdProxy proxy(det.get());
|
||||
proxy.Call(parser.command(), parser.arguments(), parser.detector_id(),
|
||||
action, std::cout, parser.receiver_id());
|
||||
} catch (const sls::RuntimeError &e) {
|
||||
|
Reference in New Issue
Block a user