Salome HOME
85d0d8747111f5d62aecc4a3ebba2272f0e78972
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_SComponent_i.cxx
1 //  File   : SALOMEDS_SComponent_i.cxx
2 //  Author : Sergey RUIN
3 //  Module : SALOME
4
5
6 #include "SALOMEDS_SComponent_i.hxx"
7 #include "SALOMEDS.hxx"
8 #include "utilities.h"
9 #include <map>
10
11 using namespace std;
12
13 SALOMEDS::SComponent_ptr SALOMEDS_SComponent_i::New(const Handle(SALOMEDSImpl_SComponent)& theImpl, CORBA::ORB_ptr theORB)
14 {
15 /*
16   static std::map<SALOMEDSImpl_SComponent*, SALOMEDS_SComponent_i*> _mapOfSCO;
17   SALOMEDS::SComponent_var sco;
18   SALOMEDS_SComponent_i* sco_servant = NULL;
19
20   if(_mapOfSCO.find(theImpl.operator->()) != _mapOfSCO.end()) {
21     sco_servant = _mapOfSCO[theImpl.operator->()];
22   }
23   else {
24     sco_servant = new SALOMEDS_SComponent_i(theImpl, theORB);
25     _mapOfSCO[theImpl.operator->()] = sco_servant;
26   }
27
28   sco  = SALOMEDS::SComponent::_narrow(sco_servant->SComponent::_this()); 
29 */
30   SALOMEDS_SComponent_i* sco_servant = new SALOMEDS_SComponent_i(theImpl, theORB);
31   SALOMEDS::SComponent_var sco  = SALOMEDS::SComponent::_narrow(sco_servant->SComponent::_this()); 
32
33   return sco._retn();
34 }    
35
36 //============================================================================
37 /*! Function : constructor
38  *  Purpose  : 
39  */
40 //============================================================================
41 SALOMEDS_SComponent_i::SALOMEDS_SComponent_i(const Handle(SALOMEDSImpl_SComponent)& theImpl, CORBA::ORB_ptr orb)
42   :SALOMEDS_SObject_i(theImpl, orb)
43 {}
44   
45 //============================================================================
46 /*! Function : destructor
47  *  Purpose  : 
48  */
49 //============================================================================
50 SALOMEDS_SComponent_i::~SALOMEDS_SComponent_i()
51 {}
52    
53 //============================================================================
54 /*! Function : ComponentDataType
55  *  Purpose  : 
56  */
57 //============================================================================
58 char* SALOMEDS_SComponent_i::ComponentDataType()
59 {
60   SALOMEDS::Locker lock;
61   TCollection_AsciiString aType = Handle(SALOMEDSImpl_SComponent)::DownCast(_impl)->ComponentDataType();
62   return CORBA::string_dup(aType.ToCString());
63 }
64   
65
66 //============================================================================
67 /*! Function : ComponentIOR
68  *  Purpose  : 
69  */
70 //============================================================================
71 CORBA::Boolean SALOMEDS_SComponent_i::ComponentIOR(CORBA::String_out IOR)
72 {
73   SALOMEDS::Locker lock;
74   TCollection_AsciiString ior;
75   if(!Handle(SALOMEDSImpl_SComponent)::DownCast(_impl)->ComponentIOR(ior)) {
76     IOR = CORBA::string_dup("");
77     return false;
78   }
79   IOR = CORBA::string_dup(ior.ToCString());
80   return true;
81 }