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/ or email : webmaster.salome@opencascade.com
20 // File : SALOMEDS_GenericAttribute.cxx
21 // Author : Sergey RUIN
28 #include "SALOMEDS_GenericAttribute.hxx"
29 #include "SALOMEDSImpl_SObject.hxx"
30 #include "SALOMEDS_SObject.hxx"
31 #include "SALOMEDS_ClientAttributes.hxx"
32 #include "SALOMEDS.hxx"
37 #include <sys/types.h>
45 SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(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 CORBA::LongLong 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()
81 SALOMEDS::Locker lock;
83 _local_impl->CheckLocked();
86 throw SALOMEDS::GenericAttribute::LockProtection();
90 _corba_impl->CheckLocked();
94 std::string SALOMEDS_GenericAttribute::Type()
98 SALOMEDS::Locker lock;
99 aType = _local_impl->Type();
102 aType = _corba_impl->Type();
107 std::string SALOMEDS_GenericAttribute::GetClassType()
111 SALOMEDS::Locker lock;
112 aType = _local_impl->GetClassType();
115 aType = _corba_impl->GetClassType();
120 _PTR(SObject) SALOMEDS_GenericAttribute::GetSObject()
122 SALOMEDSClient_SObject* aSO = NULL;
124 SALOMEDS::Locker lock;
125 aSO = new SALOMEDS_SObject(_local_impl->GetSObject());
128 aSO = new SALOMEDS_SObject(_corba_impl->GetSObject());
131 return _PTR(SObject)(aSO);
135 SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute(SALOMEDSImpl_GenericAttribute* theGA)
137 SALOMEDS::Locker lock;
139 SALOMEDS_GenericAttribute* aGA = NULL;
141 std::string aTypeOfAttribute = theGA->GetClassType();
142 __CreateGenericClientAttributeLocal
147 SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute(SALOMEDS::GenericAttribute_ptr theGA)
149 SALOMEDS_GenericAttribute* aGA = NULL;
150 if(!CORBA::is_nil(theGA)) {
151 std::string aTypeOfAttribute = theGA->GetClassType();
152 __CreateGenericClientAttributeCORBA