1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : SALOMEDSImpl_GenericAttribute.hxx
21 // Author : SERGEY_RUIN
25 #include "SALOMEDSImpl_Attributes.hxx"
26 #include "SALOMEDSImpl_Study.hxx"
27 #include "SALOMEDSImpl_StudyBuilder.hxx"
31 IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_GenericAttribute, TDF_Attribute )
32 IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_GenericAttribute, TDF_Attribute )
34 char* SALOMEDSImpl_GenericAttribute::Impl_GetType(const Handle(TDF_Attribute)& theAttr)
36 Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr);
37 return ga->Type().ToCString();
40 char* SALOMEDSImpl_GenericAttribute::Impl_GetClassType(const Handle(TDF_Attribute)& theAttr)
42 Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr);
43 return ga->GetClassType().ToCString();
46 void SALOMEDSImpl_GenericAttribute::Impl_CheckLocked(const Handle(TDF_Attribute)& theAttr)
48 Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr);
52 TCollection_AsciiString SALOMEDSImpl_GenericAttribute::Type()
58 void SALOMEDSImpl_GenericAttribute::CheckLocked()
60 TDF_Label aLabel = Label();
61 if(aLabel.IsNull()) return;
63 Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(aLabel);
64 if(aStudy.IsNull() || aStudy->NewBuilder()->HasOpenCommand()) return;
65 if(aStudy->IsLocked()) {
66 aStudy->_errorCode = "LockProtection";
67 throw LockProtection("LockProtection");
71 Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_GenericAttribute::GetSObject()
73 TDF_Label aLabel = Label();
74 if(aLabel.IsNull()) return NULL;
75 return SALOMEDSImpl_Study::SObject(aLabel);
78 void SALOMEDSImpl_GenericAttribute::SetModifyFlag()
80 TDF_Label aLabel = Label();
81 if(aLabel.IsNull()) return;
83 Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(aLabel);
84 if(!aStudy.IsNull()) aStudy->Modify();