X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FTools%2Fpadder%2Fmeshjob%2Fimpl%2FSMeshPadderHelper.cxx;fp=src%2FTools%2Fpadder%2Fmeshjob%2Fimpl%2FSMeshPadderHelper.cxx;h=cc51e5ad2fdcdba04be23248c64fe07b6acc4304;hb=5a4b9b3413c6dcfbfa396094802a3a9dca0d93f5;hp=0000000000000000000000000000000000000000;hpb=6ca43e11b284a67077badf5958e9ec76838f83b7;p=modules%2Fsmesh.git diff --git a/src/Tools/padder/meshjob/impl/SMeshPadderHelper.cxx b/src/Tools/padder/meshjob/impl/SMeshPadderHelper.cxx new file mode 100644 index 000000000..cc51e5ad2 --- /dev/null +++ b/src/Tools/padder/meshjob/impl/SMeshPadderHelper.cxx @@ -0,0 +1,62 @@ +// Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE +// +// 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 "SMeshPadderHelper.h" + +#include "MeshJobManager_i.hxx" +#include "SALOME_Container_i.hxx" +#include "SALOME_KernelServices.hxx" + +#include "SALOME_Fake_NamingService.hxx" + +static Engines::EngineComponent_var _unique_compo; + +Engines::EngineComponent_var BuildPadderMeshJobManagerInstance() +{ + if (CORBA::is_nil(_unique_compo)) + { + CORBA::ORB_var orb; + { + int argc(0); + orb = CORBA::ORB_init(argc, nullptr); + } + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); + PortableServer::POA_var poa = PortableServer::POA::_narrow(obj); + PortableServer::POAManager_var pman = poa->the_POAManager(); + CORBA::PolicyList policies; + policies.length(0); + auto *cont(KERNEL::getContainerSA()); + PortableServer::ObjectId *conId(cont->getCORBAId()); + // + pman->activate(); + // + MeshJobManager_i *servant = new MeshJobManager_i(orb, poa, conId, "MeshJobManager_inst_3", "MeshJobManager", false, false); + PortableServer::ObjectId *zeId = servant->getId(); + CORBA::Object_var zeRef = poa->id_to_reference(*zeId); + _unique_compo = Engines::EngineComponent::_narrow(zeRef); + } + return _unique_compo; +} + +std::string BuildPadderMeshJobManagerInstanceInternal() +{ + Engines::EngineComponent_var zeRef = BuildPadderMeshJobManagerInstance(); + CORBA::String_var ior = KERNEL::getORB()->object_to_string(zeRef); + return std::string(ior.in()); +}