Skip to content

Conversation

@hjmjohnson
Copy link
Member

  • STYLE: Add itkVirtualGetNameOfClassMacro + itkOverrideGetNameOfClassMacro
  • STYLE: Replace itkStaticConstMacro with static constexpr

…acro

Added two new macro's, intended to replace the old 'itkTypeMacro' and
'itkTypeMacroNoParent'.

The main aim is to be clearer about what those macro's do: add a virtual
'GetNameOfClass()' member function and override it. Unlike 'itkTypeMacro',
'itkOverrideGetNameOfClassMacro' does not have a 'superclass' parameter, as it
was not used anyway.

Note that originally 'itkTypeMacro' did not use its 'superclass' parameter
either, looking at commit 699b66cb04d410e555656828e8892107add38ccb, Will
Schroeder, June 27, 2001:
https://github.com/InsightSoftwareConsortium/ITK/blob/699b66cb04d410e555656828e8892107add38ccb/Code/Common/itkMacro.h#L331-L337
Use static constexpr directly now that C++11 conformance
is required by all compilers.

:%s/itkStaticConstMacro *( *\([^,]*\),[ \_s]*\([^,]*\),\_s*\([^)]*\)) */static constexpr \2 \1 = \3/ge

'itkStaticConstMacro(name, type, value)' became unconditionally
identical to 'static constexpr type name = value' with ITK commit
aec95193ab00e1322039911e1032da00f3a103b6 "ENH: Update compiler macros (#810)",
maekclena, 7 May 2019.

'itkGetStaticConstMacro(name)' became unconditionally identical to
'(Self::name)' with ITK commit 84e490b81e3f3c2b0edb89ae7b9de53bfc52f2b2
"Removing some outdated compiler conditionals", Hans Johnson, 31 July
2010.

Most 'itkStaticConstMacro' calls were removed by ITK commit 5c14741e1e063a132ea7e7ee69c5bd0a4e49af74
For the sake of code readability, a new  alias is added for
each nested  alias. The old  aliases will still be
available with ITK 6.0, but it is recommended to use  instead.
The  aliases will be removed when  is
enabled. Similarly, , , and
 replace , ,
and , respectively.
@hjmjohnson hjmjohnson force-pushed the replace-itkstaticconstmacro-with-constexpr branch from 09024ae to 0832617 Compare May 9, 2025 01:12
Copy link
Member

@dzenanz dzenanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good.

The convention of only specifying the MAJOR version
is the indicator that the latest version in that
series should be used.

By not specifying the MINOR and PATCH, the exact versions
is not pinned, but the latest in that series is chosen.
(i.e. the v5 tag is updated every time a new MINOR or PATCH
tag is generated).

This allows benefiting from minor patch fixes without needing
to update workflows.

Update CI module to newest MeshToPolyData v0.11.1.
In preparation for release.

Ensure that cmake is 3.16.3 or greater to
match v5.4.2 minimum requirements.

Set minimum python to 3.9

Increment version number.

Replace keyword of "ITK" with lowercase "itk"
in some instances to be consistent.
@hjmjohnson hjmjohnson force-pushed the replace-itkstaticconstmacro-with-constexpr branch from 0832617 to cf07b63 Compare May 26, 2025 16:32
The ITKRemoteModuleBuildTestPackageAction repo does not have a v5.4.2 tag.
@hjmjohnson hjmjohnson merged commit 90975fa into main May 27, 2025
123 of 129 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants