Skip to content

Data Exchange, STEP - Refactor StepType selection#786

Merged
dpasukhi merged 2 commits intoOpen-Cascade-SAS:IRfrom
dpasukhi:step_type_static_variable
Nov 1, 2025
Merged

Data Exchange, STEP - Refactor StepType selection#786
dpasukhi merged 2 commits intoOpen-Cascade-SAS:IRfrom
dpasukhi:step_type_static_variable

Conversation

@dpasukhi
Copy link
Copy Markdown
Member

Replace static lastvalue and mutex with mutable member theLastValue; simplify Value() logic and use early returns

Replace static lastvalue and mutex with mutable member theLastValue; simplify Value() logic and use early returns
@dpasukhi dpasukhi added this to the Release 8.0 milestone Oct 31, 2025
@dpasukhi dpasukhi requested a review from Copilot October 31, 2025 09:10
@dpasukhi dpasukhi self-assigned this Oct 31, 2025
@dpasukhi dpasukhi added 2. Enhancement New feature or request 1. Data Exchange Import/Export or iterating of the CAD data 1. Coding Coding rules, trivial changes and misprints labels Oct 31, 2025
Copy link
Copy Markdown

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 refactors the StepSelect_StepType::Value() method by eliminating thread-unsafe static variables and simplifying control flow. The main objective is to improve thread safety and code maintainability by replacing a static lastvalue variable (protected by a mutex) with an instance-level mutable member theLastValue.

Key changes:

  • Removed static lastvalue variable and mutex-based synchronization, replacing them with a mutable member field theLastValue
  • Restructured logic with early returns to reduce nesting and improve readability
  • Updated variable naming to follow OCCT conventions (e.g., moduleaModule, CNaCN)

Reviewed Changes

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

File Description
StepSelect_StepType.hxx Added theLastValue mutable member field and TCollection_AsciiString include
StepSelect_StepType.cxx Refactored Value() method to use instance-level storage, applied early returns, and modernized variable naming

Comment thread src/DataExchange/TKDESTEP/StepSelect/StepSelect_StepType.cxx
Comment thread src/DataExchange/TKDESTEP/StepSelect/StepSelect_StepType.cxx
@dpasukhi dpasukhi merged commit 4262423 into Open-Cascade-SAS:IR Nov 1, 2025
23 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Maintenance Nov 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1. Coding Coding rules, trivial changes and misprints 1. Data Exchange Import/Export or iterating of the CAD data 2. Enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants