0024947: Redesign OCCT legacy type system
authorabv <abv@opencascade.com>
Fri, 22 May 2015 03:40:28 +0000 (06:40 +0300)
committerabv <abv@opencascade.com>
Sat, 11 Jul 2015 08:05:31 +0000 (11:05 +0300)
commit69ff08ff28b7d226623da4b401beb09905d1bfa1
tree692abac3d9067b7b326316373966c705eb59470a
parent4052fe71d9a90fd0e358f64223afef1973e38679
0024947: Redesign OCCT legacy type system

Global static functions instantiating RTTI descriptors for class types (used though STANDARD_TYPE macro) are replaced by template static method Instance() of the class Standard_Type.
Implementation of RTTI is revised accordingly (global registry of type descriptors added to ensure single instance of each type descriptor shared by all dynamic libraries).
Obsolete methods of Standard_Type class (IsInstance(), Ancestors()) are removed; new method Parent() is added returning type descriptor of the parent class.
Class Standard_AncestorIterator is removed; this iteration can be easily done by recursive calls to Standard_Type::Parent().

Definition of macro STANDARD_TYPE() moved from Standard_Macro.hxx to Standard_DefineHandle.hxx.
Inclusion of Standard_Type.hxx and the class header is now necessary for use of method DownCast() and function STANDARD_TYPE() for the class.
In general, Standard_Type.hxx should be included now instead of Standard_DefineHandle.hxx in places where these macros are used.

Macro DEFINE_STANDARD_EXCEPTION changed to define all methods inline; macro IMPLEMENT_STANDARD_EXCEPTION becomes obsolete.
Macros IMPLEMENT_DOWNCAST, IMPLEMENT_STANDARD_* become deprecated, they are still defined (as empty) for compatibility.

Implementation of Handle classes became fully inline.
Method get() is added in Handle classes returning pointer to the contained object.

RTTI removed from NCollection_Handle class.

Standard_Persistent is made empty descendant of Standard_Transient, instead of implementing its own hierarchy with reference counting.

Unused enumerations Standard_InternalType, Standard_WayOfLife, Standard_KindOfType are removed.
Global function HashCode() accepting Handle(Standard_Transient) is removed; HashCode() for Standard_CString with length should be used instead.

DRAW command dtryload is added for testing dynamic load / unload of the specified library.
New test perf fclasses bug24947 uses this command to measure performance of multiple (1000 times) loading / unloading OCCT libs on example of TKSTEP.
38 files changed:
src/DDF/DDF_DataCommands.cxx
src/Draw/Draw_PloadCommands.cxx
src/IFSelect/IFSelect_BasicDumper.cxx
src/IntImp/IntImp_ComputeTangence.cxx
src/Message/Message_Algorithm.cxx
src/NCollection/NCollection_Handle.cxx
src/NCollection/NCollection_Handle.hxx
src/Precision/Precision.cxx
src/SelectMgr/SelectMgr_SelectableObject.cxx
src/Standard/FILES
src/Standard/Handle_Standard_Persistent.cxx
src/Standard/Handle_Standard_Persistent.hxx
src/Standard/Handle_Standard_Transient.hxx
src/Standard/Standard.cdl
src/Standard/Standard_AncestorIterator.cdl [deleted file]
src/Standard/Standard_AncestorIterator.cxx [deleted file]
src/Standard/Standard_CString.cxx
src/Standard/Standard_DefineException.hxx
src/Standard/Standard_DefineHandle.hxx
src/Standard/Standard_Failure.cdl
src/Standard/Standard_Failure.cxx
src/Standard/Standard_HashCode.cxx
src/Standard/Standard_Macro.hxx
src/Standard/Standard_Persistent.cxx
src/Standard/Standard_Persistent_proto.hxx
src/Standard/Standard_PrimitiveTypes.hxx
src/Standard/Standard_ShortReal.hxx
src/Standard/Standard_Transient.cdl
src/Standard/Standard_Transient.cxx
src/Standard/Standard_Transient.hxx
src/Standard/Standard_Transient_proto.hxx
src/Standard/Standard_Type.cdl [deleted file]
src/Standard/Standard_Type.cxx
src/Standard/Standard_Type.hxx [new file with mode: 0644]
src/Standard/Standard_Type.lxx [deleted file]
src/TDataStd/TDataStd_TreeNode.cxx
tests/perf/fclasses/bug24947 [new file with mode: 0644]
tests/perf/grids.list