Coding - Modernize handle APIs and deprecate out-parameter overloads (#1185)

Introduce return-by-value APIs for handle-returning methods across touched toolkits, with nodiscard where appropriate, and keep legacy out-parameter signatures as deprecated wrappers for source compatibility.

- Add new return-by-value overloads for previously output-parameter methods in key classes across ApplicationFramework, DataExchange, ModelingAlgorithms, ModelingData, and Visualization
- Mark legacy output-parameter methods as deprecated and route them through the new overloads
- Update call sites to use the new APIs and simplify temporary-variable patterns
- Extend method documentation in OCCT Doxygen style with param/return sections and deprecation guidance
- Apply const-correctness updates for read-only handle arguments in STEP reader related interfaces
- Preserve compatibility for deprecated public wrappers by keeping exported out-of-line definitions where needed
- Perform minor cleanup of comments and parameter naming consistency

No functional behavior change is intended; this is an API modernization and migration-facilitation update.
This commit is contained in:
Pasukhin Dmitry
2026-04-04 12:09:46 +01:00
committed by GitHub
parent 83929118e7
commit 0f57a42d89
86 changed files with 1094 additions and 368 deletions

View File

@@ -40,6 +40,15 @@ public:
Standard_EXPORT virtual void SetCurve(const occ::handle<FEmTool_Curve>& C) = 0;
//! Returns the curve associated with this criterion.
//! @return handle to the FEmTool curve
[[nodiscard]] occ::handle<FEmTool_Curve> Curve() const
{
occ::handle<FEmTool_Curve> aCurve;
GetCurve(aCurve);
return aCurve;
}
Standard_EXPORT virtual void GetCurve(occ::handle<FEmTool_Curve>& C) const = 0;
Standard_EXPORT virtual void SetEstimation(const double E1, const double E2, const double E3) = 0;

View File

@@ -1471,7 +1471,7 @@ void AppDef_Variational::Optimization(occ::handle<AppDef_SmoothCriterion>& J,
int el, dim;
A.GetAssemblyTable(AssTable);
AssTable = A.AssemblyTable();
int NbConstr = myNbPassPoints + myNbTangPoints + myNbCurvPoints;
double CBLONG = J->EstLength();

View File

@@ -440,7 +440,7 @@ int FEmTool_Assembly::NbGlobVar() const
void FEmTool_Assembly::GetAssemblyTable(
occ::handle<NCollection_HArray2<occ::handle<NCollection_HArray1<int>>>>& AssTable) const
{
AssTable = myRefTable;
AssTable = AssemblyTable();
}
void FEmTool_Assembly::ResetConstraint()

View File

@@ -79,6 +79,17 @@ public:
Standard_EXPORT int NbGlobVar() const;
//! Returns the assembly table mapping element-local indices to global indices.
//! @return const reference to the assembly table
[[nodiscard]] const occ::handle<NCollection_HArray2<occ::handle<NCollection_HArray1<int>>>>&
AssemblyTable() const
{
return myRefTable;
}
//! Returns the assembly table via output parameter.
//! @deprecated Use AssemblyTable() returning const reference instead.
Standard_DEPRECATED("Use AssemblyTable() returning const reference instead")
Standard_EXPORT void GetAssemblyTable(
occ::handle<NCollection_HArray2<occ::handle<NCollection_HArray1<int>>>>& AssTable) const;