Salome HOME
Merge C++ part of kleontev/38044_auto_repair
[modules/geom.git] / src / GEOM / GEOM_BaseObject.cxx
index 6c56f0f7109dfbdd123f2776ff0cea15ad0fbe74..a833e7e40ca3b70fb20911b8f0f1d1790b633afb 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -36,7 +36,6 @@
 #include <TDataStd_UAttribute.hxx>
 #include <TDocStd_Document.hxx>
 #include <TDocStd_Owner.hxx>
-#include <TFunction_Driver.hxx>
 #include <TFunction_DriverTable.hxx>
 
 #include "utilities.h"
@@ -86,15 +85,9 @@ Handle(GEOM_BaseObject) GEOM_BaseObject::GetObject(const TDF_Label& theLabel)
   TCollection_AsciiString anEntry;
   TDF_Tool::Entry(theLabel, anEntry);
 
-  Handle(TDocStd_Document) aDoc = TDocStd_Owner::GetDocument(theLabel.Data());
-  if(aDoc.IsNull()) return NULL;
-
-  Handle(TDataStd_Integer) anID;
-  if(!aDoc->Main().FindAttribute(TDataStd_Integer::GetID(), anID)) return NULL;
-
   GEOM_Engine* anEngine = GEOM_Engine::GetEngine();
   if(anEngine == NULL) return NULL;
-  return anEngine->GetObject(anID->Get(), anEntry.ToCString());
+  return anEngine->GetObject(anEntry.ToCString());
 }
 
 //=============================================================================
@@ -168,14 +161,8 @@ int GEOM_BaseObject::GetType(const TDF_Label& theLabel)
  */
 //=============================================================================
 GEOM_BaseObject::GEOM_BaseObject(const TDF_Label& theEntry)
-  : _label(theEntry), _ior(""), _docID(-1)
+  : _label(theEntry), _ior("")
 {
-  Handle(TDocStd_Document) aDoc = TDocStd_Owner::GetDocument(_label.Data());
-  if(!aDoc.IsNull()) {
-    Handle(TDataStd_Integer) anID;
-    if(aDoc->Main().FindAttribute(TDataStd_Integer::GetID(), anID)) _docID = anID->Get();
-  }
-
   if(!theEntry.FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), _root))
     _root = TDataStd_TreeNode::Set(theEntry);
 }
@@ -186,14 +173,8 @@ GEOM_BaseObject::GEOM_BaseObject(const TDF_Label& theEntry)
  */
 //=============================================================================
 GEOM_BaseObject::GEOM_BaseObject(const TDF_Label& theEntry, int theType)
-: _label(theEntry), _ior(""), _docID(-1)
+: _label(theEntry), _ior("")
 {
-  Handle(TDocStd_Document) aDoc = TDocStd_Owner::GetDocument(_label.Data());
-  if(!aDoc.IsNull()) {
-    Handle(TDataStd_Integer) anID;
-    if(aDoc->Main().FindAttribute(TDataStd_Integer::GetID(), anID)) _docID = anID->Get();
-  }
-
   theEntry.ForgetAllAttributes(Standard_True);
 
   if(!theEntry.FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), _root))
@@ -211,7 +192,7 @@ GEOM_BaseObject::GEOM_BaseObject(const TDF_Label& theEntry, int theType)
 //=============================================================================
 GEOM_BaseObject::~GEOM_BaseObject()
 {
-  MESSAGE("GEOM_BaseObject::~GEOM_BaseObject()");
+  //MESSAGE("GEOM_BaseObject::~GEOM_BaseObject()");
 }
 
 //=============================================================================
@@ -289,17 +270,6 @@ void GEOM_BaseObject::IncrementTic()
   TDataStd_Integer::Set(aTicLabel, aTic + 1);
 }
 
-
-//=============================================================================
-/*!
- *  GetDocID
- */
-//=============================================================================
-int GEOM_BaseObject::GetDocID()
-{
-  return _docID;
-}
-
 //=============================================================================
 /*!
  *  SetName
@@ -323,7 +293,7 @@ TCollection_AsciiString GEOM_BaseObject::GetName()
     aName = aNameAttr->Get();
   // do not return pointer of local variable
   // return aName.ToCString();
-  // the following code could lead to memory leak, so take care about recieved pointer
+  // the following code could lead to memory leak, so take care about received pointer
   return aName;
 }
 
@@ -493,18 +463,17 @@ Handle(TColStd_HSequenceOfTransient) GEOM_BaseObject::GetLastDependency()
  */
 //================================================================================
 
-Handle(TFunction_Driver) GEOM_BaseObject::GetCreationDriver()
+Handle(TFunction_Driver) GEOM_BaseObject::GetCreationDriver(int funNb)
 {
-  Handle(TFunction_Driver) aDriver;
-
-  Handle(GEOM_Function) function = GetFunction(1);
+  Handle(TFunction_Driver) driver;
+  Handle(GEOM_Function) function = GetFunction(funNb);
   if ( !function.IsNull() )
   {
     Standard_GUID aGUID = function->GetDriverGUID();
-    if ( TFunction_DriverTable::Get()->FindDriver(aGUID, aDriver))
-      aDriver->Init( function->GetEntry() );
+    if ( TFunction_DriverTable::Get()->FindDriver(aGUID, driver ))
+      driver->Init( function->GetEntry() );
   }
-  return aDriver;
+  return driver;
 }
 
 //=============================================================================
@@ -517,5 +486,4 @@ TDF_Label GEOM_BaseObject::GetFreeLabel()
   return _label.FindChild(FREE_LABEL);
 }
 
-IMPLEMENT_STANDARD_HANDLE (GEOM_BaseObject, Standard_Transient );
-IMPLEMENT_STANDARD_RTTIEXT(GEOM_BaseObject, Standard_Transient );
+IMPLEMENT_STANDARD_RTTIEXT(GEOM_BaseObject, Standard_Transient )