From 906eec75292417dd859bd07238aaf2a1d9f3def0 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Tue, 12 Jan 2021 17:19:38 +0100 Subject: [PATCH] WIP --- src/SMESH_SWIG/SMeshHelper.cxx | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/SMESH_SWIG/SMeshHelper.cxx b/src/SMESH_SWIG/SMeshHelper.cxx index 23a925971..5004b6635 100644 --- a/src/SMESH_SWIG/SMeshHelper.cxx +++ b/src/SMESH_SWIG/SMeshHelper.cxx @@ -20,16 +20,34 @@ #include "SMeshHelper.h" #include "SMESH_Gen_i.hxx" +#include "SALOME_Container_i.hxx" + +#include + +CORBA::ORB_var orb; std::string BuildSMESHInstance() { - 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::ObjectId * id = nullptr ; - SMESH_Gen_i *servant = new SMESH_Gen_i(orb,poa,id,"SMESH_inst_2","SMESH"); + PortableServer::POAManager_var pman = poa->the_POAManager(); + CORBA::PolicyList policies; + policies.length(0); + PortableServer::POA_var poa2 = poa->create_POA("POA2",pman,policies); + PortableServer::ObjectId_var conId; + // + { + char *argv[4] = {"Container","FactoryServer","toto",nullptr}; + Engines_Container_i *cont = new Engines_Container_i(orb,poa2,"FactoryServer",2,argv,false,false); + conId = poa2->activate_object(cont); + } + // + pman->activate(); + // + SMESH_Gen_i *servant = new SMESH_Gen_i(orb,poa2,const_cast(&conId.in()),"SMESH_inst_2","SMESH"); PortableServer::ObjectId *zeId = servant->getId(); - CORBA::Object_var zeRef = poa->id_to_reference(*zeId); - return "%%%%%%%%"; + CORBA::Object_var zeRef = poa2->id_to_reference(*zeId); + CORBA::String_var ior = orb->object_to_string(zeRef); + return std::string(ior.in()); } -- 2.39.2