Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0026397Open CASCADE[OCCT] OCCT:Foundation Classespublic2015-07-03 10:372020-09-11 16:13
Assigned Toabv 
PlatformOSOS Version
Product Version 
Target Version[OCCT] 7.6.0*Fixed in Version 
Summary0026397: Change method DownCast() of Handle to return a pointer rather than a Handle
DescriptionMethod DownCast() of opencascade::handle<> can be changed to return a pointer instead of constructing a new handle. The benefits would be:

- No overhead for incrementing / decrementing reference counter if result of DownCast() is used to access the object directly

- Possible more efficient code when new Handle() is initialized by result of DownCast()

- Safer code -- compiler may complain if result of DownCast() is assigned to reference to a handle

- Possibility to avoid double type checking in expressions like this:

if (myCurve->IsKind(STANDARD_TYPE(Geom_BSplineCurve))
  Handle(Geom_BSplineCurve) aBSplCurve = Handle(Geom_BSplineCurve)::DownCast (myCurve);
  ... // work with bspline

this can be replaced by more compact and faster variant:

if (const Geom_BSplineCurve* aBSplCurve = Handle(Geom_BSplineCurve)::DownCast (myCurve))
  ... // work with bspline

One drawback of returning a pointer is that it will break compatibility with existing code which now can use method IsNull() to the result of DownCast() to check if the value is of a goo type. Such checks however should be better replaced by equivalent check of IsNull() of original object followed by IsKind().
TagsNo tags attached.
Test case numberNot required
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2015-07-03 10:37 abv New Issue
2015-07-03 10:37 abv Assigned To => abv
2015-12-14 22:39 abv Target Version 7.0.0 => 7.1.0
2016-11-03 17:13 abv Target Version 7.1.0 => 7.2.0
2017-07-27 09:43 abv Target Version 7.2.0 => 7.4.0
2017-08-14 11:14 apv Test case number => Not required
2017-10-09 13:39 abv Description Updated View Revisions
2019-07-10 22:29 abv Target Version 7.4.0 => 7.5.0
2020-09-11 16:13 utverdov Target Version 7.5.0 => 7.6.0*

Copyright © 2000 - 2021 MantisBT Team
Powered by Mantis Bugtracker