Salome HOME
This commit was generated by cvs2git to track changes on a CVS vendor
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_SComponent_i.cxx
1 using namespace std;
2 //  File      : SALOMEDS_SComponent_i.cxx
3 //  Created   : Wed Nov 28 16:24:34 2001
4 //  Author    : Yves FRICAUD
5
6 //  Project   : SALOME
7 //  Module    : SALOMEDS
8 //  Copyright : Open CASCADE 2001
9 //  $Header$
10
11 #include "SALOMEDS_SComponent_i.hxx"
12 #include "utilities.h"
13
14
15 //============================================================================
16 /*! Function : constructor
17  *  Purpose  : 
18  */
19 //============================================================================
20 SALOMEDS_SComponent_i::SALOMEDS_SComponent_i(const TDF_Label lab, CORBA::ORB_ptr orb)
21   :SALOMEDS_SObject_i(lab,orb)
22 {
23 }
24   
25 //============================================================================
26 /*! Function : destructor
27  *  Purpose  : 
28  */
29 //============================================================================
30 SALOMEDS_SComponent_i::~SALOMEDS_SComponent_i()
31 {
32 }
33   
34   
35 //============================================================================
36 /*! Function : ComponentDataType
37  *  Purpose  : 
38  */
39 //============================================================================
40 char* SALOMEDS_SComponent_i::ComponentDataType()
41 {
42   //DEB
43   //    MESSAGE("In SALOMEDS_SComponent_i::ComponentDataType");
44   //    TCollection_AsciiString anEntry;
45   //    TDF_Tool::Entry (_lab,anEntry);
46   //    MESSAGE("in SALOMEDS_SComponent_i, Entry :"<<anEntry);
47   // END DEB
48
49   Standard_CString res = "";
50   Handle(TDataStd_Comment) type;
51   if ( _lab.FindAttribute(TDataStd_Comment::GetID(),type) ) {
52     TCollection_AsciiString ch(type->Get());
53     res = ch.ToCString();
54   }
55
56   return CORBA::string_dup(res);
57 }
58   
59
60 //============================================================================
61 /*! Function : ComponentIOR
62  *  Purpose  : 
63  */
64 //============================================================================
65 CORBA::Boolean SALOMEDS_SComponent_i::ComponentIOR(CORBA::String_out IOR)
66 {
67   Handle(SALOMEDS_IORAttribute) ior;
68   if (!_lab.FindAttribute(SALOMEDS_IORAttribute::GetID(),ior) )
69       return false;
70   TCollection_AsciiString ch(ior->Get());
71   IOR = strdup(ch.ToCString());
72   return true;
73 }
74   
75
76 //============================================================================
77 /*! Function : IsA
78  *  Purpose  : 
79  */
80 //============================================================================
81 Standard_Boolean SALOMEDS_SComponent_i::IsA(const TDF_Label Lab)
82 {
83   Handle(TDF_Attribute) Att;
84   // scomponent must contain comment and belong to the 2th depth label
85   if ( Lab.FindAttribute(TDataStd_Comment::GetID(), Att) && Lab.Depth() == 2) {
86     return Standard_True;
87   }
88   return Standard_False;
89 }
90   
91