Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_SComponent.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_SComponent.cxx
21 //  Author : Sergey RUIN
22 //  Module : SALOME
23
24
25 #include "SALOMEDSImpl_SComponent.hxx"
26 #include "SALOMEDSImpl_AttributeComment.hxx"
27 #include "SALOMEDSImpl_AttributeIOR.hxx" 
28
29 using namespace std;
30
31 IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_SComponent, SALOMEDSImpl_SObject )
32 IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_SComponent, SALOMEDSImpl_SObject )
33
34 //============================================================================
35 /*! Function : constructor
36  *  Purpose  : 
37  */
38 //============================================================================
39 SALOMEDSImpl_SComponent::SALOMEDSImpl_SComponent(const TDF_Label& theLabel)
40   :SALOMEDSImpl_SObject(theLabel)
41 {
42 }
43   
44 //============================================================================
45 /*! Function : destructor
46  *  Purpose  : 
47  */
48 //============================================================================
49 SALOMEDSImpl_SComponent::~SALOMEDSImpl_SComponent()
50 {}
51   
52   
53 //============================================================================
54 /*! Function : ComponentDataType
55  *  Purpose  : 
56  */
57 //============================================================================
58 TCollection_AsciiString SALOMEDSImpl_SComponent::ComponentDataType()
59 {
60   TCollection_AsciiString res = "";
61   Handle(SALOMEDSImpl_AttributeComment) type;
62   if ( _lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(),type) ) {
63     res = type->Value();
64   }
65
66   return res;
67 }
68   
69
70 //============================================================================
71 /*! Function : ComponentIOR
72  *  Purpose  : 
73  */
74 //============================================================================
75 bool SALOMEDSImpl_SComponent::ComponentIOR(TCollection_AsciiString& IOR)
76 {
77   Handle(SALOMEDSImpl_AttributeIOR) ior;
78   if (!_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),ior) )
79       return false;
80   IOR = ior->Value();
81   return true;
82 }
83   
84
85 //============================================================================
86 /*! Function : IsA
87  *  Purpose  : 
88  */
89 //============================================================================
90 bool SALOMEDSImpl_SComponent::IsA(const TDF_Label& theLabel)
91 {
92   // scomponent must contain comment and belong to the 2th depth label
93   if ( theLabel.IsAttribute(SALOMEDSImpl_AttributeComment::GetID()) && theLabel.Depth() == 2) {
94     return true;
95   }
96   return false;
97 }