Skip to content

Commit

Permalink
STYLE: Declare ObjectFactoryBase::m_OverrideMap as unique_ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Dekker authored and dzenanz committed Sep 23, 2022
1 parent a7c26b5 commit f02dafa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Modules/Core/Common/include/itkObjectFactoryBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "itkSingletonMacro.h"
#include "itkCommonEnums.h"
#include <list>
#include <memory> // For unique_ptr.
#include <vector>

namespace itk
Expand Down Expand Up @@ -276,7 +277,7 @@ class ITKCommon_EXPORT ObjectFactoryBase : public Object
SynchronizeObjectFactoryBase(void * objectFactoryBasePrivate);
itkGetGlobalDeclarationMacro(ObjectFactoryBasePrivate, PimplGlobals);

OverRideMap * m_OverrideMap;
const std::unique_ptr<OverRideMap> m_OverrideMap;

/** Initialize the static list of Factories. */
static void
Expand Down
8 changes: 2 additions & 6 deletions Modules/Core/Common/src/itkObjectFactoryBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -512,20 +512,16 @@ ObjectFactoryBase::ReHash()
* initialize class members
*/
ObjectFactoryBase::ObjectFactoryBase()
: m_OverrideMap{ std::make_unique<OverRideMap>() }
{
m_LibraryHandle = nullptr;
m_LibraryDate = 0;
m_OverrideMap = new OverRideMap;
}

/**
* Unload the library and free the path string
*/
ObjectFactoryBase::~ObjectFactoryBase()
{
m_OverrideMap->erase(m_OverrideMap->begin(), m_OverrideMap->end());
delete m_OverrideMap;
}
ObjectFactoryBase::~ObjectFactoryBase() = default;

/**
* Add a factory to the registered list.
Expand Down

0 comments on commit f02dafa

Please sign in to comment.