From 2e4e3ba93caebe0fe1f8335361ca375d0085e33c 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 | 8 ++++---- parameter/include/ParameterMgrPlatformConnector.h | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/parameter/ParameterMgrPlatformConnector.cpp b/parameter/ParameterMgrPlatformConnector.cpp index c69d76eb0..63b65972a 100644 --- a/parameter/ParameterMgrPlatformConnector.cpp +++ b/parameter/ParameterMgrPlatformConnector.cpp @@ -30,6 +30,7 @@ #include "ParameterMgrPlatformConnector.h" #include "ParameterMgr.h" #include "ParameterMgrLogger.h" +#include "Memory.hpp" #include using std::string; @@ -37,16 +38,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..644d6952d 100644 --- a/parameter/include/ParameterMgrPlatformConnector.h +++ b/parameter/include/ParameterMgrPlatformConnector.h @@ -37,6 +37,8 @@ #include "ElementHandle.h" #include "ParameterMgrLoggerForward.h" +#include + class CParameterMgr; class PARAMETER_EXPORT CParameterMgrPlatformConnector @@ -196,9 +198,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