Salome HOME
PR: merge from branch BR_UnitTests tag mergeto_trunk_17oct05
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_SComponent.cxx
1 //  File   : SALOMEDSImpl_SComponent.cxx
2 //  Author : Sergey RUIN
3 //  Module : SALOME
4
5
6 #include "SALOMEDSImpl_SComponent.hxx"
7 #include "SALOMEDSImpl_AttributeComment.hxx"
8 #include "SALOMEDSImpl_AttributeIOR.hxx" 
9
10 using namespace std;
11
12 IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_SComponent, SALOMEDSImpl_SObject )
13 IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_SComponent, SALOMEDSImpl_SObject )
14
15 //============================================================================
16 /*! Function : constructor
17  *  Purpose  : 
18  */
19 //============================================================================
20 SALOMEDSImpl_SComponent::SALOMEDSImpl_SComponent(const TDF_Label& theLabel)
21   :SALOMEDSImpl_SObject(theLabel)
22 {
23 }
24   
25 //============================================================================
26 /*! Function : destructor
27  *  Purpose  : 
28  */
29 //============================================================================
30 SALOMEDSImpl_SComponent::~SALOMEDSImpl_SComponent()
31 {}
32   
33   
34 //============================================================================
35 /*! Function : ComponentDataType
36  *  Purpose  : 
37  */
38 //============================================================================
39 TCollection_AsciiString SALOMEDSImpl_SComponent::ComponentDataType()
40 {
41   TCollection_AsciiString res = "";
42   Handle(SALOMEDSImpl_AttributeComment) type;
43   if ( _lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(),type) ) {
44     res = type->Value();
45   }
46
47   return res;
48 }
49   
50
51 //============================================================================
52 /*! Function : ComponentIOR
53  *  Purpose  : 
54  */
55 //============================================================================
56 bool SALOMEDSImpl_SComponent::ComponentIOR(TCollection_AsciiString& IOR)
57 {
58   Handle(SALOMEDSImpl_AttributeIOR) ior;
59   if (!_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),ior) )
60       return false;
61   IOR = ior->Value();
62   return true;
63 }
64   
65
66 //============================================================================
67 /*! Function : IsA
68  *  Purpose  : 
69  */
70 //============================================================================
71 bool SALOMEDSImpl_SComponent::IsA(const TDF_Label& theLabel)
72 {
73   // scomponent must contain comment and belong to the 2th depth label
74   if ( theLabel.IsAttribute(SALOMEDSImpl_AttributeComment::GetID()) && theLabel.Depth() == 2) {
75     return true;
76   }
77   return false;
78 }