Salome HOME
add method NameChanged to update title name
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_StudyHandle.cxx
index d2809192daa1a2074042417ef4e80cc98f2a60fa..5846bd74d2ad04463a6ff0355ea71d2fe38fe506 100644 (file)
@@ -1,29 +1,30 @@
-// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// 
+//
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either 
-// version 2.1 of the License.
-// 
-// This library is distributed in the hope that it will be useful 
-// but WITHOUT ANY WARRANTY; without even the implied warranty of 
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 // Lesser General Public License for more details.
 //
-// You should have received a copy of the GNU Lesser General Public  
-// License along with this library; if not, write to the Free Software 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  File   : SALOMEDSImpl_StudyHandle.cxx
 //  Author : Sergey LITONIN
 //  Module : SALOME
-
+//
 #include "SALOMEDSImpl_StudyHandle.hxx"
-#include <TDF_Attribute.hxx>
-#include <Standard_GUID.hxx>
 
 /*
   Class       : SALOMEDSImpl_StudyHandle
                 graphic representation of objects in dirrent views
 */
 
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_StudyHandle, TDF_Attribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_StudyHandle, TDF_Attribute )
 
 //=======================================================================
 //function : GetID
 //purpose  : Get GUID of this attribute
 //=======================================================================
-const Standard_GUID& SALOMEDSImpl_StudyHandle::GetID()
+const std::string& SALOMEDSImpl_StudyHandle::GetID()
 {
-  static Standard_GUID SALOMEDSImpl_StudyHandleID( "050C9555-4BA8-49bf-8F1C-086F0469A40B" );
+  static std::string SALOMEDSImpl_StudyHandleID( "050C9555-4BA8-49bf-8F1C-086F0469A40B" );
   return SALOMEDSImpl_StudyHandleID;
 }
 
@@ -50,23 +49,23 @@ const Standard_GUID& SALOMEDSImpl_StudyHandle::GetID()
 //=======================================================================
 SALOMEDSImpl_StudyHandle::SALOMEDSImpl_StudyHandle()
 {
-  myHandle.Nullify();
+  myHandle = NULL;
 }
 
 //=======================================================================
 //function : Set
 //purpose  : 
 //=======================================================================
-Handle(SALOMEDSImpl_StudyHandle) SALOMEDSImpl_StudyHandle::Set(const TDF_Label& theLabel, 
-                                                              const Handle(SALOMEDSImpl_Study)& theStudy)
+SALOMEDSImpl_StudyHandle* SALOMEDSImpl_StudyHandle::Set(const DF_Label& theLabel, 
+                                                        SALOMEDSImpl_Study* theStudy)
 {
-  Handle(SALOMEDSImpl_StudyHandle) A;
-  if (!theLabel.FindAttribute(GetID(), A)) {
-    A = new  SALOMEDSImpl_StudyHandle()
+  SALOMEDSImpl_StudyHandle* A = NULL;
+  if (!(A=(SALOMEDSImpl_StudyHandle*)theLabel.FindAttribute(GetID()))) {
+    A = new SALOMEDSImpl_StudyHandle
     theLabel.AddAttribute(A);
   }
 
-  A->SetHandle(theStudy);
+  A->Set(theStudy);
   return A;  
 }
 
@@ -75,7 +74,7 @@ Handle(SALOMEDSImpl_StudyHandle) SALOMEDSImpl_StudyHandle::Set(const TDF_Label&
 //function : ID
 //purpose  : Get GUID of this attribute
 //=======================================================================
-const Standard_GUID& SALOMEDSImpl_StudyHandle::ID () const
+const std::string& SALOMEDSImpl_StudyHandle::ID () const
 {
   return GetID();
 }
@@ -85,7 +84,7 @@ const Standard_GUID& SALOMEDSImpl_StudyHandle::ID () const
 //function : NewEmpty
 //purpose  : Create new empty attribute
 //=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_StudyHandle::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_StudyHandle::NewEmpty () const
 {
   return new SALOMEDSImpl_StudyHandle ();
 }
@@ -95,20 +94,19 @@ Handle(TDF_Attribute) SALOMEDSImpl_StudyHandle::NewEmpty () const
 //function : Restore
 //purpose  : Restore value of attribute with value of theWith one
 //=======================================================================
-void SALOMEDSImpl_StudyHandle::Restore( const Handle(TDF_Attribute)& theWith )
+void SALOMEDSImpl_StudyHandle::Restore( DF_Attribute* theWith )
 {
-  Handle(SALOMEDSImpl_StudyHandle) anAttr = Handle(SALOMEDSImpl_StudyHandle)::DownCast( theWith );
-  if ( !anAttr.IsNull() ) SetHandle( anAttr->GetHandle() );
+  SALOMEDSImpl_StudyHandle* anAttr = dynamic_cast<SALOMEDSImpl_StudyHandle*>( theWith );
+  if ( anAttr ) Set ( anAttr->Get() );
 }
 
 //=======================================================================
 //function : Paste
 //purpose  : Paste value of current attribute to the value of entry one
 //=======================================================================
-void SALOMEDSImpl_StudyHandle::Paste( const Handle(TDF_Attribute)& theInto,
-                                       const Handle(TDF_RelocationTable)& ) const
+void SALOMEDSImpl_StudyHandle::Paste( DF_Attribute* theInto)
 {
-  Handle(SALOMEDSImpl_StudyHandle) anAttr =  Handle(SALOMEDSImpl_StudyHandle)::DownCast( theInto );
-  if ( !anAttr.IsNull() ) anAttr->SetHandle( myHandle );
+  SALOMEDSImpl_StudyHandle* anAttr =  dynamic_cast<SALOMEDSImpl_StudyHandle*>( theInto );
+  if ( anAttr ) anAttr->Set ( myHandle );
 }