Salome HOME
524f99a99433e2fc40c17396a5855cb7d7a8968f
[modules/kernel.git] / src / NamingService / SALOME_Embedded_NamingService_Client.cxx
1 // Copyright (C) 2021-2023  CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "SALOME_Embedded_NamingService_Client.hxx"
21 #include "SALOME_Embedded_NamingService_Common.hxx"
22
23 #include <memory>
24
25 void SALOME_Embedded_NamingService_Client::init_orb(CORBA::ORB_ptr orb)
26 {
27 }
28
29 SALOME_NamingService_Container_Abstract *SALOME_Embedded_NamingService_Client::clone()
30 {
31   return new SALOME_Embedded_NamingService_Client(*this);
32 }
33
34 void SALOME_Embedded_NamingService_Client::Register(CORBA::Object_ptr ObjRef, const char* Path)
35 {
36   std::unique_ptr<Engines::IORType> ior( ObjectToIOR(ObjRef) );
37   this->_remote_ns_serv->Register( *(ior.get()), Path);
38 }
39
40 void SALOME_Embedded_NamingService_Client::Destroy_FullDirectory(const char* Path)
41 {
42   this->_remote_ns_serv->Destroy_FullDirectory(Path);
43 }
44
45 void SALOME_Embedded_NamingService_Client::Destroy_Name(const char* Path)
46 {
47   this->_remote_ns_serv->Destroy_Name(Path);
48 }
49
50 CORBA::Object_ptr SALOME_Embedded_NamingService_Client::Resolve(const char* Path)
51 {
52   std::unique_ptr<Engines::IORType> ior( this->_remote_ns_serv->Resolve(Path) );
53   CORBA::Object_var ret( IORToObject( *(ior.get()) ) );
54   return CORBA::Object::_duplicate(ret);
55 }
56
57 CORBA::Object_ptr SALOME_Embedded_NamingService_Client::ResolveFirst(const char* Path)
58 {
59   std::unique_ptr<Engines::IORType> ior( this->_remote_ns_serv->ResolveFirst(Path) );
60   CORBA::Object_var ret( IORToObject( *(ior.get()) ) );
61   return CORBA::Object::_duplicate(ret);
62 }