@@ -324,8 +324,8 @@ const CParameterMgr::SRemoteCommandParserItem CParameterMgr::gastRemoteCommandPa
324324
325325// Remote command parsers array Size
326326CParameterMgr::CParameterMgr (const string &strConfigurationFilePath, log::ILogger &logger)
327- : _pMainParameterBlackboard(new CParameterBlackboard),
328- _pElementLibrarySet(new CElementLibrarySet),
327+ : _pMainParameterBlackboard(utility::make_unique< CParameterBlackboard>() ),
328+ _pElementLibrarySet(utility::make_unique< CElementLibrarySet>() ),
329329 _xmlConfigurationUri(CXmlDocSource::mkUri(strConfigurationFilePath, " " )), _logger(logger)
330330{
331331 // Deal with children
@@ -337,10 +337,7 @@ CParameterMgr::CParameterMgr(const string &strConfigurationFilePath, log::ILogge
337337
338338CParameterMgr::~CParameterMgr ()
339339{
340- // Children
341- delete _pRemoteProcessorServer;
342- delete _pMainParameterBlackboard;
343- delete _pElementLibrarySet;
340+ ;
344341}
345342
346343string CParameterMgr::getKind () const
@@ -393,14 +390,14 @@ bool CParameterMgr::load(string &strError)
393390 LOG_CONTEXT (" Main blackboard back synchronization" );
394391
395392 // Back synchronization for areas in parameter blackboard not covered by any domain
396- BackSynchronizer (getConstSystemClass (), _pMainParameterBlackboard).sync ();
393+ BackSynchronizer (getConstSystemClass (), _pMainParameterBlackboard. get () ).sync ();
397394 }
398395
399396 // We're done loading the settings and back synchronizing
400397 CConfigurableDomains *pConfigurableDomains = getConfigurableDomains ();
401398
402399 // We need to ensure all domains are valid
403- pConfigurableDomains->validate (_pMainParameterBlackboard);
400+ pConfigurableDomains->validate (_pMainParameterBlackboard. get () );
404401
405402 // Log selection criterion states
406403 {
@@ -792,7 +789,7 @@ void CParameterMgr::getSettingsAsBytes(const CConfigurableElement &element,
792789 // Prepare parameter access context for main blackboard.
793790 // No need to handle output raw format and value space as Byte arrays are hexa formatted
794791 CParameterAccessContext parameterAccessContext (error);
795- parameterAccessContext.setParameterBlackboard (_pMainParameterBlackboard);
792+ parameterAccessContext.setParameterBlackboard (_pMainParameterBlackboard. get () );
796793
797794 // Get the settings
798795 element.getSettingsAsBytes (settings, parameterAccessContext);
@@ -809,7 +806,7 @@ bool CParameterMgr::setSettingsAsBytes(const CConfigurableElement &element,
809806 // This may lead to undetected out of range value assignment.
810807 // Use this functionality with caution
811808 CParameterAccessContext parameterAccessContext (error);
812- parameterAccessContext.setParameterBlackboard (_pMainParameterBlackboard);
809+ parameterAccessContext.setParameterBlackboard (_pMainParameterBlackboard. get () );
813810 parameterAccessContext.setAutoSync (autoSyncOn ());
814811
815812 // Set the settings
@@ -1524,7 +1521,7 @@ bool CParameterMgr::getSettingsAsXML(const CConfigurableElement *configurableEle
15241521 string &result) const
15251522{
15261523 string error;
1527- CConfigurationAccessContext configContext (error, _pMainParameterBlackboard, _bValueSpaceIsRaw,
1524+ CConfigurationAccessContext configContext (error, _pMainParameterBlackboard. get () , _bValueSpaceIsRaw,
15281525 _bOutputRawFormatIsHex, true );
15291526
15301527 CXmlParameterSerializingContext xmlParameterContext (configContext, error);
@@ -1548,7 +1545,7 @@ bool CParameterMgr::getSettingsAsXML(const CConfigurableElement *configurableEle
15481545bool CParameterMgr::setSettingsAsXML (CConfigurableElement *configurableElement,
15491546 const string &settings, string &error)
15501547{
1551- CConfigurationAccessContext configContext (error, _pMainParameterBlackboard, _bValueSpaceIsRaw,
1548+ CConfigurationAccessContext configContext (error, _pMainParameterBlackboard. get () , _bValueSpaceIsRaw,
15521549 _bOutputRawFormatIsHex, false );
15531550
15541551 CXmlParameterSerializingContext xmlParameterContext (configContext, error);
@@ -1567,7 +1564,7 @@ bool CParameterMgr::setSettingsAsXML(CConfigurableElement *configurableElement,
15671564 CSyncerSet syncerSet;
15681565 static_cast <CConfigurableElement *>(configurableElement)->fillSyncerSet (syncerSet);
15691566 core::Results errors;
1570- if (not syncerSet.sync (*_pMainParameterBlackboard, false , &errors)) {
1567+ if (not syncerSet.sync (*_pMainParameterBlackboard. get () , false , &errors)) {
15711568 error = utility::asString (errors);
15721569
15731570 return false ;
@@ -1631,7 +1628,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::dumpElementCommandP
16311628
16321629 string strError;
16331630
1634- CParameterAccessContext parameterAccessContext (strError, _pMainParameterBlackboard,
1631+ CParameterAccessContext parameterAccessContext (strError, _pMainParameterBlackboard. get () ,
16351632 _bValueSpaceIsRaw, _bOutputRawFormatIsHex);
16361633
16371634 // Dump elements
@@ -1966,7 +1963,7 @@ bool CParameterMgr::accessParameterValue(const string &strPath, string &strValue
19661963 }
19671964
19681965 // Define context
1969- CParameterAccessContext parameterAccessContext (strError, _pMainParameterBlackboard,
1966+ CParameterAccessContext parameterAccessContext (strError, _pMainParameterBlackboard. get () ,
19701967 _bValueSpaceIsRaw, _bOutputRawFormatIsHex);
19711968
19721969 // Activate the auto synchronization with the hardware
@@ -2070,7 +2067,7 @@ bool CParameterMgr::accessConfigurationValue(const string &strDomain,
20702067 if (bIsLastApplied) {
20712068
20722069 // Define Main context
2073- parameterAccessContext.setParameterBlackboard (_pMainParameterBlackboard);
2070+ parameterAccessContext.setParameterBlackboard (_pMainParameterBlackboard. get () );
20742071
20752072 // Activate the auto synchronization with the hardware
20762073 if (bSet) {
@@ -2210,7 +2207,7 @@ bool CParameterMgr::sync(string &strError)
22102207
22112208 // Sync
22122209 core::Results error;
2213- if (!syncerSet.sync (*_pMainParameterBlackboard, false , &error)) {
2210+ if (!syncerSet.sync (*_pMainParameterBlackboard. get () , false , &error)) {
22142211
22152212 strError = utility::asString (error);
22162213 return false ;
@@ -2312,7 +2309,7 @@ bool CParameterMgr::createConfiguration(const string &strDomain, const string &s
23122309
23132310 // Delegate to configurable domains
23142311 return logResult (getConfigurableDomains ()->createConfiguration (
2315- strDomain, strConfiguration, _pMainParameterBlackboard, strError),
2312+ strDomain, strConfiguration, _pMainParameterBlackboard. get () , strError),
23162313 strError);
23172314}
23182315bool CParameterMgr::renameConfiguration (const string &strDomain, const string &strConfiguration,
@@ -2362,7 +2359,7 @@ bool CParameterMgr::restoreConfiguration(const string &strDomain, const string &
23622359 // Delegate to configurable domains
23632360 return logResult (
23642361 getConstConfigurableDomains ()->restoreConfiguration (
2365- strDomain, strConfiguration, _pMainParameterBlackboard, _bAutoSyncOn, errors),
2362+ strDomain, strConfiguration, _pMainParameterBlackboard. get () , _bAutoSyncOn, errors),
23662363 strError);
23672364}
23682365
@@ -2380,7 +2377,7 @@ bool CParameterMgr::saveConfiguration(const string &strDomain, const string &str
23802377
23812378 // Delegate to configurable domains
23822379 return logResult (getConfigurableDomains ()->saveConfiguration (
2383- strDomain, strConfiguration, _pMainParameterBlackboard, strError),
2380+ strDomain, strConfiguration, _pMainParameterBlackboard. get () , strError),
23842381 strError);
23852382}
23862383
@@ -2415,7 +2412,7 @@ bool CParameterMgr::addConfigurableElementToDomain(const string &strDomain,
24152412 // Delegate
24162413 core::Results infos;
24172414 bool isSuccess = getConfigurableDomains ()->addConfigurableElementToDomain (
2418- strDomain, pConfigurableElement, _pMainParameterBlackboard, infos);
2415+ strDomain, pConfigurableElement, _pMainParameterBlackboard. get () , infos);
24192416
24202417 if (isSuccess) {
24212418 info () << infos;
@@ -2556,7 +2553,7 @@ bool CParameterMgr::importDomainsXml(const string &xmlSource, bool withSettings,
25562553 if (importSuccess) {
25572554
25582555 // Validate domains after XML import
2559- pConfigurableDomains->validate (_pMainParameterBlackboard);
2556+ pConfigurableDomains->validate (_pMainParameterBlackboard. get () );
25602557 }
25612558
25622559 return importSuccess;
@@ -2731,7 +2728,7 @@ std::mutex &CParameterMgr::getBlackboardMutex()
27312728// Blackboard reference (dynamic parameter handling)
27322729CParameterBlackboard *CParameterMgr::getParameterBlackboard ()
27332730{
2734- return _pMainParameterBlackboard;
2731+ return _pMainParameterBlackboard. get () ;
27352732}
27362733
27372734// Dynamic creation library feeding
@@ -2856,17 +2853,12 @@ bool CParameterMgr::handleRemoteProcessingInterface(string &strError)
28562853
28572854 try {
28582855 // The ownership of remoteComandHandler is given to Bg remote processor server.
2859- _pRemoteProcessorServer = new BackgroundRemoteProcessorServer (port, createCommandHandler ());
2856+ _pRemoteProcessorServer = utility::make_unique< BackgroundRemoteProcessorServer> (port, createCommandHandler ());
28602857 } catch (std::runtime_error &e) {
28612858 strError = string (" ParameterMgr: Unable to create Remote Processor Server: " ) + e.what ();
28622859 return false ;
28632860 }
28642861
2865- if (_pRemoteProcessorServer == nullptr ) {
2866- strError = " ParameterMgr: Unable to create Remote Processor Server" ;
2867- return false ;
2868- }
2869-
28702862 if (!_pRemoteProcessorServer->start (strError)) {
28712863 ostringstream oss;
28722864 oss << " ParameterMgr: Unable to start remote processor server on port " << port;
@@ -2936,7 +2928,7 @@ void CParameterMgr::doApplyConfigurations(bool bForce)
29362928 getSystemClass ()->checkForSubsystemsToResync (syncerSet, infos);
29372929
29382930 // Ensure application of currently selected configurations
2939- getConfigurableDomains ()->apply (_pMainParameterBlackboard, syncerSet, bForce, infos);
2931+ getConfigurableDomains ()->apply (_pMainParameterBlackboard. get () , syncerSet, bForce, infos);
29402932 info () << infos;
29412933
29422934 // Reset the modified status of the current criteria to indicate that a new configuration has
0 commit comments