Skip to content

Commit

Permalink
STYLE: Remove private ObjectFactoryBase member RegisterInternal()
Browse files Browse the repository at this point in the history
`ObjectFactoryBase::RegisterInternal()` was only called by `Initialize()`
anyway.

Moved the code from `RegisterInternal()` into `Initialize()`, except from an
`itkInitGlobalsMacro(PimplGlobals)` call which is no longer necessary.
  • Loading branch information
N-Dekker authored and dzenanz committed Oct 4, 2023
1 parent 2859d67 commit 427972e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
7 changes: 1 addition & 6 deletions Modules/Core/Common/include/itkObjectFactoryBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,7 @@ class ITKCommon_EXPORT ObjectFactoryBase : public Object
(void)staticFactoryRegistration;
}

/** Initialize the static members of ObjectFactoryBase.
* RegisterInternal() and InitializeFactoryList() are called here. */
/** Initialize the static members of ObjectFactoryBase. */
static void
Initialize();

Expand Down Expand Up @@ -271,10 +270,6 @@ class ITKCommon_EXPORT ObjectFactoryBase : public Object

const std::unique_ptr<OverrideMap> m_OverrideMap;

/** Register default factories which are not loaded at run time. */
static void
RegisterInternal();

/** Load dynamic factories from the ITK_AUTOLOAD_PATH */
static void
LoadDynamicFactories();
Expand Down
23 changes: 6 additions & 17 deletions Modules/Core/Common/src/itkObjectFactoryBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -231,29 +231,18 @@ ObjectFactoryBase::Initialize()
// Atomically set m_Initialized to true. If it was false before, enter the if.
if (!m_PimplGlobals->m_Initialized.exchange(true))
{
ObjectFactoryBase::RegisterInternal();
// Guarantee that no internal factories have already been registered.
itkAssertInDebugAndIgnoreInReleaseMacro(m_PimplGlobals->m_RegisteredFactories.empty());

// Register all factories registered by the "RegisterFactoryInternal" method
m_PimplGlobals->m_RegisteredFactories = m_PimplGlobals->m_InternalFactories;

#if defined(ITK_DYNAMIC_LOADING) && !defined(ITK_WRAPPING)
ObjectFactoryBase::LoadDynamicFactories();
#endif
}
}

/**
* Register any factories that are always present in ITK like
* the OpenGL factory, currently this is not done.
*/
void
ObjectFactoryBase::RegisterInternal()
{
itkInitGlobalsMacro(PimplGlobals);

// Guarantee that no internal factories have already been registered.
itkAssertInDebugAndIgnoreInReleaseMacro(m_PimplGlobals->m_RegisteredFactories.empty());

// Register all factories registered by the "RegisterFactoryInternal" method
m_PimplGlobals->m_RegisteredFactories = m_PimplGlobals->m_InternalFactories;
}

/**
* Load all libraries in ITK_AUTOLOAD_PATH
*/
Expand Down

0 comments on commit 427972e

Please sign in to comment.