Back to index

salome-kernel  6.5.0
SALOMEDSImpl_GenericAttribute.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_GenericAttribute.hxx
00024 //  Author : SERGEY_RUIN
00025 //  Module : SALOME
00026 //
00027 #include "SALOMEDSImpl_Attributes.hxx"
00028 #include "SALOMEDSImpl_Study.hxx"
00029 #include "SALOMEDSImpl_StudyBuilder.hxx"
00030 
00031 std::string SALOMEDSImpl_GenericAttribute::Impl_GetType(DF_Attribute* theAttr)
00032 {
00033   SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr);  
00034   if (ga)
00035     return ga->Type();
00036 
00037   return "";
00038 }
00039 
00040 std::string SALOMEDSImpl_GenericAttribute::Impl_GetClassType(DF_Attribute* theAttr)
00041 {
00042   SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr);
00043   if (ga)
00044     return ga->GetClassType();
00045   
00046   return "";
00047 } 
00048 
00049 void SALOMEDSImpl_GenericAttribute::Impl_CheckLocked(DF_Attribute* theAttr)
00050 {
00051   SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr);
00052   ga->CheckLocked();
00053 }
00054 
00055 std::string SALOMEDSImpl_GenericAttribute::Type() 
00056 { 
00057     return _type; 
00058 }
00059 
00060 
00061 void SALOMEDSImpl_GenericAttribute::CheckLocked()
00062 {
00063   DF_Label aLabel = Label();
00064   if(aLabel.IsNull()) return;
00065 
00066   SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(aLabel);
00067   if(!aStudy) return;
00068   if(aStudy->IsLocked()) {
00069     aStudy->_errorCode = "LockProtection";
00070     throw LockProtection("LockProtection");
00071   }                                         
00072 }
00073 
00074 SALOMEDSImpl_SObject SALOMEDSImpl_GenericAttribute::GetSObject()
00075 {
00076   SALOMEDSImpl_SObject so; 
00077   DF_Label aLabel = Label();
00078   if(aLabel.IsNull()) return so;
00079   return SALOMEDSImpl_Study::SObject(aLabel);
00080 }
00081 
00086 void SALOMEDSImpl_GenericAttribute::SetModifyFlag(int reason)
00087 {
00088    DF_Label aLabel = Label();
00089    if(aLabel.IsNull()) return; 
00090 
00091   SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(aLabel);
00092   if(aStudy) aStudy->modifySO_Notification(GetSObject(), reason);
00093   if(aStudy) aStudy->Modify();
00094 }