1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
18 // See http://www.salome-platform.org/
20 // File : SALOMEDS_GenericAttribute.cxx
21 // Author : Sergey RUIN
27 #include <TCollection_AsciiString.hxx>
29 #include "SALOMEDS_GenericAttribute.hxx"
30 #include "SALOMEDSImpl_SObject.hxx"
31 #include "SALOMEDS_SObject.hxx"
32 #include "SALOMEDS_ClientAttributes.hxx"
37 #include <sys/types.h>
45 SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA)
49 _corba_impl = SALOMEDS::GenericAttribute::_nil();
52 SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(SALOMEDS::GenericAttribute_ptr theGA)
55 long pid = (long)_getpid();
57 long pid = (long)getpid();
60 long addr = theGA->GetLocalImpl(GetHostname().c_str(), pid, _isLocal);
62 _local_impl = ((SALOMEDSImpl_GenericAttribute*)(addr));
63 _corba_impl = SALOMEDS::GenericAttribute::_nil();
67 _corba_impl = SALOMEDS::GenericAttribute::_duplicate(theGA);
71 SALOMEDS_GenericAttribute::~SALOMEDS_GenericAttribute()
74 _corba_impl->Destroy();
78 void SALOMEDS_GenericAttribute::CheckLocked()
82 _local_impl->CheckLocked();
85 throw SALOMEDS::GenericAttribute::LockProtection();
89 _corba_impl->CheckLocked();
93 std::string SALOMEDS_GenericAttribute::Type()
97 aType = _local_impl->Type().ToCString();
100 aType = _corba_impl->Type();
105 std::string SALOMEDS_GenericAttribute::GetClassType()
109 aType = _local_impl->GetClassType().ToCString();
112 aType = _corba_impl->GetClassType();
117 _PTR(SObject) SALOMEDS_GenericAttribute::GetSObject()
119 SALOMEDSClient_SObject* aSO = NULL;
121 aSO = new SALOMEDS_SObject(_local_impl->GetSObject());
124 aSO = new SALOMEDS_SObject(_corba_impl->GetSObject());
127 return _PTR(SObject)(aSO);
131 SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA)
133 SALOMEDS_GenericAttribute* aGA = NULL;
134 std::string aTypeOfAttribute = theGA->GetClassType().ToCString();
135 __CreateGenericClientAttributeLocal
139 SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute(SALOMEDS::GenericAttribute_ptr theGA)
141 SALOMEDS_GenericAttribute* aGA = NULL;
142 std::string aTypeOfAttribute = theGA->GetClassType();
143 __CreateGenericClientAttributeCORBA