0023310: No IsEqual function for Handles
authoromy <omy@opencascade.com>
Fri, 1 Feb 2013 12:47:50 +0000 (16:47 +0400)
committeromy <omy@opencascade.com>
Fri, 1 Feb 2013 12:47:50 +0000 (16:47 +0400)
IsEqual function for Handle(Standard_Transient) was added to global scope.
Getting rid of compilation errors (removed additional IsEqual functions)

src/AIS/AIS_NDataMapOfTransientIteratorOfListTransient.hxx
src/OpenGl/OpenGl_FontMgr.cxx
src/Standard/Handle_Standard_Transient.hxx
src/TObj/TObj_Common.hxx
src/TopTools/TopTools_MutexForShapeProvider.hxx

index 5c362d7..b45f628 100755 (executable)
 #include <AIS_NListIteratorOfListTransient.hxx>
 #include <NCollection_DefineDataMap.hxx>
 
-inline Standard_Boolean IsEqual (const Handle_Standard_Transient& theH1,
-                                const Handle_Standard_Transient& theH2)
-{
-  return (theH1 == theH2);
-}
-
 DEFINE_BASECOLLECTION(AIS_BaseCollItListTransient,
                       AIS_NListIteratorOfListTransient)
 DEFINE_DATAMAP       (AIS_NDataMapOfTransientIteratorOfListTransient,
index b461a42..596355a 100755 (executable)
@@ -33,32 +33,6 @@ float h_scale = 0;
 
 void dump_texture( int id);
 
-class Font_DataMap:
-  public NCollection_DataMap< Handle(TCollection_HAsciiString),
-  Handle(TCollection_HAsciiString)>
-{
-public:
-  inline Font_DataMap
-    (const Standard_Integer NbBuckets = 1,
-    const Handle(NCollection_BaseAllocator)& theAllocator = 0L)
-    :  NCollection_DataMap<Handle(TCollection_HAsciiString),
-    Handle(TCollection_HAsciiString)> (NbBuckets, theAllocator)
-  {}
-
-  inline Font_DataMap (const Font_DataMap& theOther)
-    :  NCollection_DataMap<Handle(TCollection_HAsciiString),
-    Handle(TCollection_HAsciiString)> (theOther)
-  {}  
-  friend Standard_Boolean IsEqual( const Handle(TCollection_HAsciiString)& h1,
-    const Handle(TCollection_HAsciiString)& h2 );
-};
-inline Standard_Boolean
-IsEqual( const Handle(TCollection_HAsciiString)& h1,
-        const Handle(TCollection_HAsciiString)& h2 )
-{
-  return (!h1->IsLess(h2) && !h1->IsGreater(h2));
-}
-
 OpenGl_FontMgr::OpenGl_FontMgr()
 : myCurrentFontId(-1),
 myXCurrentScale(1.f),
index eafae6f..3f45d51 100755 (executable)
@@ -236,6 +236,16 @@ private:
   Standard_Transient *entity;
 };
 
+//! Function in global scope to check handles for equality.
+//! Will be used with standard OCCT collections like NCollection_DataMap within NCollection_DefaultHasher
+//! when there are no specialization defined for concrete type.
+//! Notice that this implementation compares only pointers to objects!
+inline Standard_Boolean IsEqual (const Handle(Standard_Transient)& theFirst,
+                                 const Handle(Standard_Transient)& theSecond)
+{
+  return theFirst == theSecond;
+}
+
 #ifdef _WIN32
 #pragma warning (pop)
 #endif
index 248cd0f..f6c24ac 100755 (executable)
 #include <TCollection_HExtendedString.hxx>
 #include <Standard_Failure.hxx>
 
-//! The function IsEqual explicitly defined for Handle(Standard_Transient)
-//! in order to avoid the problem with implicit using of IsEqual() defined 
-//! for Standard_Address. The problem is that Handle(Standard_Transient)
-//! have only operator of type casting to (non-const) Standard_Transient*,
-//! hence this implicit way cannot be used for const Handle(Standard_Transient)
-inline Standard_Boolean IsEqual(const Handle(Standard_Transient)& One,
-                                const Handle(Standard_Transient)& Two)
-{
-  return One == Two;
-}
-
 //! Methods inline implimentation for HExtendedString
 
 inline Standard_Integer HashCode (const Handle(TCollection_HExtendedString)& theStr,
index 98753f7..762b9ed 100644 (file)
@@ -32,9 +32,6 @@ class TopoDS_Shape;
 //!   This class is used to create and store mutexes associated with shapes.
 class TopTools_MutexForShapeProvider
 {
-  friend Standard_Boolean IsEqual(const Handle_TopoDS_TShape & theFirstHandle,
-                                  const Handle_TopoDS_TShape & theSecondHandle);
-
 public:
   //! Constructor
   Standard_EXPORT TopTools_MutexForShapeProvider();
@@ -66,10 +63,4 @@ private:
 
 };
 
-inline Standard_Boolean IsEqual(const Handle_TopoDS_TShape & theFirstHandle,
-                                const Handle_TopoDS_TShape & theSecondHandle)
-{
-  return (theFirstHandle == theSecondHandle);
-}
-
 #endif
\ No newline at end of file