Skip to content

Conversation

N-Dekker
Copy link
Contributor

@N-Dekker N-Dekker commented Jul 21, 2025

Aims to share the common source code between InputBinaryStream and InputTextStream.

@N-Dekker N-Dekker force-pushed the InputStreamBase branch 2 times, most recently from e3813ec to 6277983 Compare July 21, 2025 15:53
@thewtex thewtex requested a review from Copilot July 21, 2025 21:17
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new base class InputStreamBase to provide common functionality for InputBinaryStream and InputTextStream classes, reducing code duplication and improving maintainability. The refactoring consolidates shared stream management logic into the base class while maintaining the same public API.

Key changes:

  • Created InputStreamBase as a common base class with shared stream management functionality
  • Refactored InputTextStream and InputBinaryStream to inherit from the base class
  • Consolidated the lexical_cast function implementation into the base class

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
include/itkInputStreamBase.h New base class containing common stream management methods and member variables
include/itkInputTextStream.h Refactored to inherit from InputStreamBase, removing duplicated code
include/itkInputBinaryStream.h Refactored to inherit from InputStreamBase, removing duplicated code
src/itkInputStreamBase.cxx Updated to implement lexical_cast for the base class instead of text stream
src/itkInputBinaryStream.cxx Removed file as functionality moved to base class
src/CMakeLists.txt Updated build configuration to include base class and remove binary stream source

@N-Dekker N-Dekker force-pushed the InputStreamBase branch 5 times, most recently from 4f2ba74 to 3a08ecd Compare July 22, 2025 15:33
N-Dekker added 2 commits July 22, 2025 18:03
Paved the way to share its source code with InputBinaryStream.
Very much reduces the amount of duplicate code.

Adds the ability to call `GetPointer()` on an InputBinaryStream, just like it
was already supported on an InputTextStream.
@N-Dekker N-Dekker marked this pull request as ready for review July 22, 2025 16:33
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.

@N-Dekker thanks!

One issue noted inline

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.

Thanks, Niels!

@thewtex thewtex merged commit d09f5e7 into InsightSoftwareConsortium:main Jul 23, 2025
81 checks passed
N-Dekker added a commit to N-Dekker/ITK-Wasm that referenced this pull request Jul 24, 2025
Follow-up to pull request InsightSoftwareConsortium#1426
commit b737cf4 "feat: Add InputStreamBase, base class of InputTextStream"
N-Dekker added a commit to N-Dekker/ITK-Wasm that referenced this pull request Jul 24, 2025
Follow-up to pull request InsightSoftwareConsortium#1426
commit 6aac66e "feat: Let InputBinaryStream inherit from InputStreamBase"
N-Dekker added a commit to N-Dekker/ITK-Wasm that referenced this pull request Jul 25, 2025
Follow-up to pull request InsightSoftwareConsortium#1426
commit 6aac66e "feat: Let InputBinaryStream inherit from InputStreamBase"
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.

2 participants