1 // File : SALOMEDS_GenericAttribute.cxx
2 // Author : Sergey RUIN
8 #include <TCollection_AsciiString.hxx>
10 #include "SALOMEDS_GenericAttribute.hxx"
11 #include "SALOMEDSImpl_SObject.hxx"
12 #include "SALOMEDS_SObject.hxx"
13 #include "SALOMEDS_ClientAttributes.hxx"
18 #include <sys/types.h>
26 SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA)
30 _corba_impl = SALOMEDS::GenericAttribute::_nil();
33 SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(SALOMEDS::GenericAttribute_ptr theGA)
36 long pid = (long)_getpid();
38 long pid = (long)getpid();
41 long addr = theGA->GetLocalImpl(GetHostname().c_str(), pid, _isLocal);
43 _local_impl = ((SALOMEDSImpl_GenericAttribute*)(addr));
44 _corba_impl = SALOMEDS::GenericAttribute::_nil();
48 _corba_impl = SALOMEDS::GenericAttribute::_duplicate(theGA);
52 SALOMEDS_GenericAttribute::~SALOMEDS_GenericAttribute()
55 _corba_impl->Destroy();
59 void SALOMEDS_GenericAttribute::CheckLocked()
63 _local_impl->CheckLocked();
66 throw SALOMEDS::GenericAttribute::LockProtection();
70 _corba_impl->CheckLocked();
74 std::string SALOMEDS_GenericAttribute::Type()
78 aType = _local_impl->Type().ToCString();
81 aType = _corba_impl->Type();
86 std::string SALOMEDS_GenericAttribute::GetClassType()
90 aType = _local_impl->GetClassType().ToCString();
93 aType = _corba_impl->GetClassType();
98 _PTR(SObject) SALOMEDS_GenericAttribute::GetSObject()
100 SALOMEDSClient_SObject* aSO = NULL;
102 aSO = new SALOMEDS_SObject(_local_impl->GetSObject());
105 aSO = new SALOMEDS_SObject(_corba_impl->GetSObject());
108 return _PTR(SObject)(aSO);
112 SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA)
114 SALOMEDS_GenericAttribute* aGA = NULL;
115 std::string aTypeOfAttribute = theGA->GetClassType().ToCString();
116 __CreateGenericClientAttributeLocal
120 SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute(SALOMEDS::GenericAttribute_ptr theGA)
122 SALOMEDS_GenericAttribute* aGA = NULL;
123 std::string aTypeOfAttribute = theGA->GetClassType();
124 __CreateGenericClientAttributeCORBA