From 432af364fe422d593443e3b4b52bcace78b1da45 Mon Sep 17 00:00:00 2001 From: Markov Vladislav Date: Mon, 28 Jan 2019 20:03:38 +0700 Subject: [PATCH] Added: smart pointers in ParameterMgrPlatformConnector issue #311 --- parameter/ParameterMgrPlatformConnector.cpp | 7 +++---- parameter/include/ParameterMgrPlatformConnector.h | 5 +++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/parameter/ParameterMgrPlatformConnector.cpp b/parameter/ParameterMgrPlatformConnector.cpp index c69d76eb0..d88a3f2cd 100644 --- a/parameter/ParameterMgrPlatformConnector.cpp +++ b/parameter/ParameterMgrPlatformConnector.cpp @@ -37,16 +37,15 @@ using std::string; // Construction CParameterMgrPlatformConnector::CParameterMgrPlatformConnector( const string &strConfigurationFilePath) - : _pParameterMgrLogger(new CParameterMgrLogger(*this)), - _pParameterMgr(new CParameterMgr(strConfigurationFilePath, *_pParameterMgrLogger)), + : _pParameterMgrLogger(utility::make_unique>(*this)), + _pParameterMgr(utility::make_unique(strConfigurationFilePath, *_pParameterMgrLogger)), _bStarted(false), _pLogger(nullptr) { } CParameterMgrPlatformConnector::~CParameterMgrPlatformConnector() { - delete _pParameterMgr; - delete _pParameterMgrLogger; + ; } // Selection Criteria interface. Beware returned objects are lent, clients shall not delete them! diff --git a/parameter/include/ParameterMgrPlatformConnector.h b/parameter/include/ParameterMgrPlatformConnector.h index 3df9794f9..a5aa90e9d 100644 --- a/parameter/include/ParameterMgrPlatformConnector.h +++ b/parameter/include/ParameterMgrPlatformConnector.h @@ -36,6 +36,7 @@ #include "ParameterHandle.h" #include "ElementHandle.h" #include "ParameterMgrLoggerForward.h" +#include "Memory.hpp" class CParameterMgr; @@ -196,9 +197,9 @@ class PARAMETER_EXPORT CParameterMgrPlatformConnector protected: // Private logging - CParameterMgrLogger *_pParameterMgrLogger; + std::unique_ptr> _pParameterMgrLogger; // Implementation - CParameterMgr *_pParameterMgr; + std::unique_ptr _pParameterMgr; // State bool _bStarted; // Logging