PortableServer::POA_ptr poa,
char * containerName ,
int argc, char* argv[],
- SALOME_NamingService_Container_Abstract *ns = nullptr,
+ SALOME_NamingService_Container_Abstract *ns = nullptr,
bool isServantAloneInProcess = true);
virtual ~Engines_Container_i();
SALOME_Fake_NamingService.cxx
SALOME_NamingService_Abstract.cxx
SALOME_Embedded_NamingService.cxx
+ SALOME_Embedded_NamingService_Common.cxx
+ SALOME_Embedded_NamingService_Client.cxx
)
ADD_DEFINITIONS(${OMNIORB_DEFINITIONS})
-// Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2021 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
#include "SALOME_Embedded_NamingService.hxx"
+#include "SALOME_Embedded_NamingService_Common.hxx"
#include "SALOME_Fake_NamingService.hxx"
-#include "SALOME_KernelORB.hxx"
#include <memory>
#include <cstring>
-CORBA::Object_var IORToObject(const Engines::IORType& ObjRef)
-{
- CORBA::ORB_ptr orb(KERNEL::getORB());
- CORBA::ULong size(ObjRef.length());
- std::unique_ptr<char[]> pt(new char[size+1]);
- pt[size] = '\0';
- for(CORBA::ULong i = 0 ; i < size ; ++i)
- pt[i] = ObjRef[i];
- CORBA::Object_var obj = orb->string_to_object(pt.get());
- return obj;
-}
-
-Engines::IORType *ObjectToIOR(CORBA::Object_ptr obj)
-{
- std::unique_ptr<Engines::IORType> ret(new Engines::IORType);
- CORBA::ORB_ptr orb(KERNEL::getORB());
- CORBA::String_var ior = orb->object_to_string(obj);
- auto len( strlen(ior) );
- ret->length( len );
- for(std::size_t i = 0 ; i < len ; ++i)
- (*ret)[i] = ior[i];
- return ret.release();
-}
-
void SALOME_Embedded_NamingService::Register(const Engines::IORType& ObjRef, const char *Path)
{
SALOME_Fake_NamingService ns;
-// Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2021 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
--- /dev/null
+// Copyright (C) 2021 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "SALOME_Embedded_NamingService_Client.hxx"
+#include "SALOME_Embedded_NamingService_Common.hxx"
+
+#include <memory>
+
+void SALOME_Embedded_NamingService_Client::init_orb(CORBA::ORB_ptr orb)
+{
+}
+
+SALOME_NamingService_Container_Abstract *SALOME_Embedded_NamingService_Client::clone()
+{
+ return new SALOME_Embedded_NamingService_Client(*this);
+}
+
+void SALOME_Embedded_NamingService_Client::Register(CORBA::Object_ptr ObjRef, const char* Path)
+{
+ std::unique_ptr<Engines::IORType> ior( ObjectToIOR(ObjRef) );
+ this->_remote_ns_serv->Register( *(ior.get()), Path);
+}
+
+void SALOME_Embedded_NamingService_Client::Destroy_FullDirectory(const char* Path)
+{
+ this->_remote_ns_serv->Destroy_FullDirectory(Path);
+}
+
+void SALOME_Embedded_NamingService_Client::Destroy_Name(const char* Path)
+{
+ this->_remote_ns_serv->Destroy_Name(Path);
+}
+
+CORBA::Object_ptr SALOME_Embedded_NamingService_Client::Resolve(const char* Path)
+{
+ std::unique_ptr<Engines::IORType> ior( this->_remote_ns_serv->Resolve(Path) );
+ CORBA::Object_var ret( IORToObject( *(ior.get()) ) );
+ return CORBA::Object::_duplicate(ret);
+}
+
+CORBA::Object_ptr SALOME_Embedded_NamingService_Client::ResolveFirst(const char* Path)
+{
+ std::unique_ptr<Engines::IORType> ior( this->_remote_ns_serv->ResolveFirst(Path) );
+ CORBA::Object_var ret( IORToObject( *(ior.get()) ) );
+ return CORBA::Object::_duplicate(ret);
+}
--- /dev/null
+// Copyright (C) 2021 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#pragma once
+
+#include "SALOME_NamingService_defs.hxx"
+#include "SALOME_NamingService_Abstract.hxx"
+
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOME_Embedded_NamingService)
+
+class NAMINGSERVICE_EXPORT SALOME_Embedded_NamingService_Client : public SALOME_NamingService_Container_Abstract
+{
+public:
+ SALOME_Embedded_NamingService_Client(Engines::EmbeddedNamingService_var remoteNSServ):_remote_ns_serv(remoteNSServ) { }
+ void init_orb(CORBA::ORB_ptr orb=0) override;
+ SALOME_NamingService_Container_Abstract *clone() override;
+ void Register(CORBA::Object_ptr ObjRef, const char* Path) override;
+ void Destroy_FullDirectory(const char* Path) override;
+ void Destroy_Name(const char* Path) override;
+ CORBA::Object_ptr Resolve(const char* Path) override;
+ CORBA::Object_ptr ResolveFirst(const char* Path) override;
+private:
+ SALOME_Embedded_NamingService_Client(const SALOME_Embedded_NamingService_Client& other) = default;
+private:
+ Engines::EmbeddedNamingService_var _remote_ns_serv;
+};
--- /dev/null
+// Copyright (C) 2021 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "SALOME_Embedded_NamingService_Common.hxx"
+#include "SALOME_KernelORB.hxx"
+
+#include <memory>
+#include <cstring>
+
+CORBA::Object_var IORToObject(const Engines::IORType& ObjRef)
+{
+ CORBA::ORB_ptr orb(KERNEL::getORB());
+ CORBA::ULong size(ObjRef.length());
+ std::unique_ptr<char[]> pt(new char[size+1]);
+ pt[size] = '\0';
+ for(CORBA::ULong i = 0 ; i < size ; ++i)
+ pt[i] = ObjRef[i];
+ CORBA::Object_var obj = orb->string_to_object(pt.get());
+ return obj;
+}
+
+Engines::IORType *ObjectToIOR(CORBA::Object_ptr obj)
+{
+ std::unique_ptr<Engines::IORType> ret(new Engines::IORType);
+ CORBA::ORB_ptr orb(KERNEL::getORB());
+ CORBA::String_var ior = orb->object_to_string(obj);
+ auto len( strlen(ior) );
+ ret->length( len );
+ for(std::size_t i = 0 ; i < len ; ++i)
+ (*ret)[i] = ior[i];
+ return ret.release();
+}
--- /dev/null
+// Copyright (C) 2021 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#pragma once
+
+#include "SALOME_NamingService_defs.hxx"
+
+#include <SALOMEconfig.h>
+
+#include CORBA_CLIENT_HEADER(SALOME_Embedded_NamingService)
+
+CORBA::Object_var IORToObject(const Engines::IORType& ObjRef);
+
+Engines::IORType *ObjectToIOR(CORBA::Object_ptr obj);