Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STYLE: Improve ivar printing in PrintSelf methods #4763

Conversation

jhlegarreta
Copy link
Member

@jhlegarreta jhlegarreta commented Jun 28, 2024

Improve ivar printing in PrintSelf methods:

  • Use the itkPrintSelfObjectMacro macro to avoid boilerplate code when printing smart pointers/objects that can be null pointers.
  • Rely on the enum classes ostream insertion operator overload to directly print such variables. Avoid boilerplate code.
  • Increase consistency when printing boolean ivars: use the ({ivar} ? "On" : "Off") recipe in agreement with the ITK SW Guide.
  • Do not check whether std::string types ivars are empty to conditionally print their contents; rely on the ostream insertion operator overload to print the appropriate content.
  • Print the member variable names verbatim to conform to the ITK SW Guide.
  • Prefer using std::endl instead of \n to add a new line for the sake of consistency.

Take advantage of the commit to print ivars that had been missed in the modified classes.

PR Checklist

@github-actions github-actions bot added area:Filtering Issues affecting the Filtering module area:IO Issues affecting the IO module area:Registration Issues affecting the Registration module type:Style Style changes: no logic impact (indentation, comments, naming) labels Jun 28, 2024
@jhlegarreta
Copy link
Member Author

Realized about these when resuming work on #3908. By no means this PR is intended to be extensive in the changes: separate, incremental PRs as code is inspected can be done.

@jhlegarreta jhlegarreta force-pushed the MiscClassesPrintSelfImprovements branch 4 times, most recently from 8f498c3 to 1039e0b Compare June 29, 2024 00:14
@jhlegarreta
Copy link
Member Author

/azp ITK.macOS

@jhlegarreta jhlegarreta changed the title STYLE: Improve the ivar printing in PrintSelf methods STYLE: Improve ivar printing in PrintSelf methods Jun 29, 2024
@jhlegarreta jhlegarreta force-pushed the MiscClassesPrintSelfImprovements branch 2 times, most recently from e67f925 to 9d72316 Compare June 29, 2024 15:02
@github-actions github-actions bot added the area:Core Issues affecting the Core module label Jun 29, 2024
Copy link
Member

@thewtex thewtex left a comment

Choose a reason for hiding this comment

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

CI errors should be addressed in current master.

@hjmjohnson
Copy link
Member

@jhlegarreta Can you please rebase on the recent master branch?

Improve ivar printing in `PrintSelf` methods:
- Use the `itkPrintSelfObjectMacro` macro to avoid boilerplate code when
  printing smart pointers/objects that can be null pointers.
- Rely on the enum classes ostream insertion operator overload to
  directly print such variables. Avoid boilerplate code.
- Increase consistency when printing boolean ivars: use the
  `({ivar} ? "On" : "Off")`  recipe in agreement with the ITK SW Guide.
- Do not check whether `std::string` types ivars are empty to
  conditionally print their contents; rely on the ostream insertion
  operator overload to print the appropriate content.
- Print the member variable names verbatim to conform to the ITK SW
  Guide.
- Prefer using `std::endl` instead of `\n` to add a new line for the
  sake of consistency.

Take advantage of the commit to print ivars that had been missed in the
modified classes.
@jhlegarreta jhlegarreta force-pushed the MiscClassesPrintSelfImprovements branch from 9d72316 to ee5fbe7 Compare July 1, 2024 19:42
@jhlegarreta
Copy link
Member Author

@jhlegarreta Can you please rebase on the recent master branch?

Done.

@jhlegarreta
Copy link
Member Author

/azp run ITK.Windows

@hjmjohnson hjmjohnson merged commit af55e5f into InsightSoftwareConsortium:master Jul 2, 2024
13 checks passed
@jhlegarreta jhlegarreta deleted the MiscClassesPrintSelfImprovements branch July 2, 2024 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:Core Issues affecting the Core module area:Filtering Issues affecting the Filtering module area:IO Issues affecting the IO module area:Registration Issues affecting the Registration module type:Style Style changes: no logic impact (indentation, comments, naming)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants