Back to index

salome-kernel  6.5.0
SALOMEDSImpl_StudyHandle.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  File   : SALOMEDSImpl_StudyHandle.cxx
00024 //  Author : Sergey LITONIN
00025 //  Module : SALOME
00026 //
00027 #include "SALOMEDSImpl_StudyHandle.hxx"
00028 
00029 /*
00030   Class       : SALOMEDSImpl_StudyHandle
00031   Description : This class is intended for storing information about
00032                 graphic representation of objects in dirrent views
00033 */
00034 
00035 
00036 //=======================================================================
00037 //function : GetID
00038 //purpose  : Get GUID of this attribute
00039 //=======================================================================
00040 const std::string& SALOMEDSImpl_StudyHandle::GetID()
00041 {
00042   static std::string SALOMEDSImpl_StudyHandleID( "050C9555-4BA8-49bf-8F1C-086F0469A40B" );
00043   return SALOMEDSImpl_StudyHandleID;
00044 }
00045 
00046 //=======================================================================
00047 //function : SALOMEDSImpl_StudyHandle
00048 //purpose  : Empty Constructor
00049 //=======================================================================
00050 SALOMEDSImpl_StudyHandle::SALOMEDSImpl_StudyHandle()
00051 {
00052   myHandle = NULL;
00053 }
00054 
00055 //=======================================================================
00056 //function : Set
00057 //purpose  : 
00058 //=======================================================================
00059 SALOMEDSImpl_StudyHandle* SALOMEDSImpl_StudyHandle::Set(const DF_Label& theLabel, 
00060                                                         SALOMEDSImpl_Study* theStudy)
00061 {
00062   SALOMEDSImpl_StudyHandle* A = NULL;
00063   if (!(A=(SALOMEDSImpl_StudyHandle*)theLabel.FindAttribute(GetID()))) {
00064     A = new SALOMEDSImpl_StudyHandle; 
00065     theLabel.AddAttribute(A);
00066   }
00067 
00068   A->Set(theStudy);
00069   return A;  
00070 }
00071 
00072 
00073 //=======================================================================
00074 //function : ID
00075 //purpose  : Get GUID of this attribute
00076 //=======================================================================
00077 const std::string& SALOMEDSImpl_StudyHandle::ID () const
00078 {
00079   return GetID();
00080 }
00081 
00082 
00083 //=======================================================================
00084 //function : NewEmpty
00085 //purpose  : Create new empty attribute
00086 //=======================================================================
00087 DF_Attribute* SALOMEDSImpl_StudyHandle::NewEmpty () const
00088 {
00089   return new SALOMEDSImpl_StudyHandle ();
00090 }
00091 
00092 
00093 //=======================================================================
00094 //function : Restore
00095 //purpose  : Restore value of attribute with value of theWith one
00096 //=======================================================================
00097 void SALOMEDSImpl_StudyHandle::Restore( DF_Attribute* theWith )
00098 {
00099   SALOMEDSImpl_StudyHandle* anAttr = dynamic_cast<SALOMEDSImpl_StudyHandle*>( theWith );
00100   if ( anAttr ) Set ( anAttr->Get() );
00101 }
00102 
00103 //=======================================================================
00104 //function : Paste
00105 //purpose  : Paste value of current attribute to the value of entry one
00106 //=======================================================================
00107 void SALOMEDSImpl_StudyHandle::Paste( DF_Attribute* theInto)
00108 {
00109   SALOMEDSImpl_StudyHandle* anAttr =  dynamic_cast<SALOMEDSImpl_StudyHandle*>( theInto );
00110   if ( anAttr ) anAttr->Set ( myHandle );
00111 }
00112