Use sls::make_unique<>

This commit is contained in:
Samuel Debionne 2019-02-13 08:59:26 +01:00
parent b18391330e
commit f125b94a7d
2 changed files with 7 additions and 9 deletions

View File

@ -11,6 +11,7 @@
#include <map> #include <map>
#include <getopt.h> #include <getopt.h>
#include "container_utils.h" // For sls::make_unique<>
#include "slsReceiver.h" #include "slsReceiver.h"
#include "slsReceiverTCPIPInterface.h" #include "slsReceiverTCPIPInterface.h"
@ -78,17 +79,14 @@ slsReceiver::slsReceiver(int argc, char *argv[]):
} }
// might throw an exception // might throw an exception
//tcpipInterface = std::make_unique<slsReceiverTCPIPInterface>(tcpip_port_no); tcpipInterface = sls::make_unique<slsReceiverTCPIPInterface>(tcpip_port_no);
tcpipInterface = std::unique_ptr<slsReceiverTCPIPInterface>(new slsReceiverTCPIPInterface(tcpip_port_no));
} }
slsReceiver::slsReceiver(int tcpip_port_no) slsReceiver::slsReceiver(int tcpip_port_no)
{ {
// might throw an exception // might throw an exception
//tcpipInterface = std::make_unique<slsReceiverTCPIPInterface>(tcpip_port_no); tcpipInterface = sls::make_unique<slsReceiverTCPIPInterface>(tcpip_port_no);
tcpipInterface = std::unique_ptr<slsReceiverTCPIPInterface>(new slsReceiverTCPIPInterface(tcpip_port_no));
} }

View File

@ -1,10 +1,11 @@
#include "container_utils.h" // For sls::make_unique<>
#include "slsReceiverUsers.h" #include "slsReceiverUsers.h"
slsReceiverUsers::slsReceiverUsers(int argc, char *argv[], int &success) { slsReceiverUsers::slsReceiverUsers(int argc, char *argv[], int &success) {
// catch the exception here to limit it to within the library (for current version) // catch the exception here to limit it to within the library (for current version)
try { try {
//receiver = std::make_unique<slsReceiver>(argc, argv); receiver = sls::make_unique<slsReceiver>(argc, argv);
receiver = std::unique_ptr<slsReceiver>(new slsReceiver(argc, argv));
success = slsDetectorDefs::OK; success = slsDetectorDefs::OK;
} catch (...) { } catch (...) {
success = slsDetectorDefs::FAIL; success = slsDetectorDefs::FAIL;
@ -12,8 +13,7 @@ slsReceiverUsers::slsReceiverUsers(int argc, char *argv[], int &success) {
} }
slsReceiverUsers::slsReceiverUsers(int tcpip_port_no) { slsReceiverUsers::slsReceiverUsers(int tcpip_port_no) {
//receiver = std::make_unique<slsReceiver>(tcpip_port_no); receiver = sls::make_unique<slsReceiver>(tcpip_port_no);
receiver = std::unique_ptr<slsReceiver>(new slsReceiver(tcpip_port_no));
} }
int slsReceiverUsers::start() { int slsReceiverUsers::start() {