Salome HOME
Use the prefix std:: instead of the directive using namespace std;
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_GenericAttribute.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  File   : SALOMEDSImpl_GenericAttribute.hxx
23 //  Author : SERGEY_RUIN
24 //  Module : SALOME
25 //
26 #include "SALOMEDSImpl_Attributes.hxx"
27 #include "SALOMEDSImpl_Study.hxx"
28 #include "SALOMEDSImpl_StudyBuilder.hxx"
29
30 std::string SALOMEDSImpl_GenericAttribute::Impl_GetType(DF_Attribute* theAttr)
31 {
32   SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr);  
33   if (ga)
34     return ga->Type();
35
36   return "";
37 }
38
39 std::string SALOMEDSImpl_GenericAttribute::Impl_GetClassType(DF_Attribute* theAttr)
40 {
41   SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr);
42   if (ga)
43     return ga->GetClassType();
44   
45   return "";
46
47
48 void SALOMEDSImpl_GenericAttribute::Impl_CheckLocked(DF_Attribute* theAttr)
49 {
50   SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr);
51   ga->CheckLocked();
52 }
53
54 std::string SALOMEDSImpl_GenericAttribute::Type() 
55
56     return _type; 
57 }
58
59
60 void SALOMEDSImpl_GenericAttribute::CheckLocked()
61 {
62   DF_Label aLabel = Label();
63   if(aLabel.IsNull()) return;
64
65   SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(aLabel);
66   if(!aStudy) return;
67   if(aStudy->IsLocked()) {
68     aStudy->_errorCode = "LockProtection";
69     throw LockProtection("LockProtection");
70   }                                         
71 }
72
73 SALOMEDSImpl_SObject SALOMEDSImpl_GenericAttribute::GetSObject()
74 {
75   SALOMEDSImpl_SObject so; 
76   DF_Label aLabel = Label();
77   if(aLabel.IsNull()) return so;
78   return SALOMEDSImpl_Study::SObject(aLabel);
79 }
80
81 void SALOMEDSImpl_GenericAttribute::SetModifyFlag()
82 {
83    DF_Label aLabel = Label();
84    if(aLabel.IsNull()) return; 
85
86   SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(aLabel);
87   if(aStudy) aStudy->Modify();
88 }
89