mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-18 15:57:13 +02:00
Add slsReceiverUsers(int tcpip_port_no) overload
Use std::unique_ptr<> instead of raw pointers
This commit is contained in:
@ -78,14 +78,17 @@ slsReceiver::slsReceiver(int argc, char *argv[]):
|
||||
}
|
||||
|
||||
// might throw an exception
|
||||
tcpipInterface = new slsReceiverTCPIPInterface(tcpip_port_no);
|
||||
//tcpipInterface = std::make_unique<slsReceiverTCPIPInterface>(tcpip_port_no);
|
||||
tcpipInterface = std::unique_ptr<slsReceiverTCPIPInterface>(new slsReceiverTCPIPInterface(tcpip_port_no));
|
||||
|
||||
}
|
||||
|
||||
|
||||
slsReceiver::~slsReceiver() {
|
||||
if(tcpipInterface)
|
||||
delete tcpipInterface;
|
||||
slsReceiver::slsReceiver(int tcpip_port_no)
|
||||
{
|
||||
// might throw an exception
|
||||
//tcpipInterface = std::make_unique<slsReceiverTCPIPInterface>(tcpip_port_no);
|
||||
tcpipInterface = std::unique_ptr<slsReceiverTCPIPInterface>(new slsReceiverTCPIPInterface(tcpip_port_no));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
#include "slsReceiverUsers.h"
|
||||
#include "slsReceiver.h"
|
||||
|
||||
slsReceiverUsers::slsReceiverUsers(int argc, char *argv[], int &success) {
|
||||
// catch the exception here to limit it to within the library (for current version)
|
||||
try {
|
||||
slsReceiver* r = new slsReceiver(argc, argv);
|
||||
receiver = r;
|
||||
//receiver = std::make_unique<slsReceiver>(argc, argv);
|
||||
receiver = std::unique_ptr<slsReceiver>(new slsReceiver(argc, argv));
|
||||
success = slsDetectorDefs::OK;
|
||||
} catch (...) {
|
||||
success = slsDetectorDefs::FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
slsReceiverUsers::~slsReceiverUsers() {
|
||||
delete receiver;
|
||||
slsReceiverUsers::slsReceiverUsers(int tcpip_port_no) {
|
||||
//receiver = std::make_unique<slsReceiver>(tcpip_port_no);
|
||||
receiver = std::unique_ptr<slsReceiver>(new slsReceiver(tcpip_port_no));
|
||||
}
|
||||
|
||||
int slsReceiverUsers::start() {
|
||||
|
Reference in New Issue
Block a user