1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : SALOMEDSImpl_GenericAttribute.hxx
24 // Author : SERGEY_RUIN
27 #include "SALOMEDSImpl_Attributes.hxx"
28 #include "SALOMEDSImpl_Study.hxx"
29 #include "SALOMEDSImpl_StudyBuilder.hxx"
31 std::string SALOMEDSImpl_GenericAttribute::Impl_GetType(DF_Attribute* theAttr)
33 SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr);
40 std::string SALOMEDSImpl_GenericAttribute::Impl_GetClassType(DF_Attribute* theAttr)
42 SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr);
44 return ga->GetClassType();
49 void SALOMEDSImpl_GenericAttribute::Impl_CheckLocked(DF_Attribute* theAttr)
51 SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr);
55 std::string SALOMEDSImpl_GenericAttribute::Type()
61 void SALOMEDSImpl_GenericAttribute::CheckLocked()
63 DF_Label aLabel = Label();
64 if(aLabel.IsNull()) return;
66 SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(aLabel);
68 if(aStudy->IsLocked()) {
69 aStudy->_errorCode = "LockProtection";
70 throw LockProtection("LockProtection");
74 SALOMEDSImpl_SObject SALOMEDSImpl_GenericAttribute::GetSObject()
76 SALOMEDSImpl_SObject so;
77 DF_Label aLabel = Label();
78 if(aLabel.IsNull()) return so;
79 return SALOMEDSImpl_Study::SObject(aLabel);
83 * Set modification flag of the Attribute.
84 * param reason reason of the modification (by default equal to 0)
86 void SALOMEDSImpl_GenericAttribute::SetModifyFlag(int reason)
88 DF_Label aLabel = Label();
89 if(aLabel.IsNull()) return;
91 SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(aLabel);
92 if(aStudy) aStudy->modifySO_Notification(GetSObject(), reason);
93 if(aStudy) aStudy->Modify();