1 // Copyright (C) 2021 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "SALOME_Embedded_NamingService.hxx"
21 #include "SALOME_Embedded_NamingService_Common.hxx"
22 #include "SALOME_Fake_NamingService.hxx"
27 static Engines::EmbeddedNamingService_var _embedded_ns_singleton;
29 Engines::EmbeddedNamingService_var GetEmbeddedNamingService()
31 if( CORBA::is_nil(_embedded_ns_singleton) )
33 std::unique_ptr<SALOME_Embedded_NamingService> servant(new SALOME_Embedded_NamingService);
34 _embedded_ns_singleton = servant->_this();
35 servant->_remove_ref();
38 return _embedded_ns_singleton;
41 void SALOME_Embedded_NamingService::Register(const Engines::IORType& ObjRef, const char *Path)
43 SALOME_Fake_NamingService ns;
44 ns.Register(IORToObject(ObjRef),Path);
47 void SALOME_Embedded_NamingService::Destroy_FullDirectory(const char *Path)
49 SALOME_Fake_NamingService ns;
50 ns.Destroy_FullDirectory(Path);
53 void SALOME_Embedded_NamingService::Destroy_Name(const char *Path)
55 SALOME_Fake_NamingService ns;
56 ns.Destroy_Name(Path);
59 Engines::IORType *SALOME_Embedded_NamingService::Resolve(const char *Path)
61 SALOME_Fake_NamingService ns;
62 CORBA::Object_var obj = ns.Resolve(Path);
63 return ObjectToIOR(obj);
66 Engines::IORType *SALOME_Embedded_NamingService::ResolveFirst(const char *Path)
68 SALOME_Fake_NamingService ns;
69 CORBA::Object_var obj = ns.ResolveFirst(Path);
70 return ObjectToIOR(obj);