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