Salome HOME
[bos #29336] problem in inertia calculus
[modules/geom.git] / src / GEOM_SWIG / GeomHelper.cxx
index 1b9eaa27fe880ac404b4505318b68fa8a232e9ed..9633a001b9ecd2c71392f47f2454bab033146c88 100644 (file)
 
 #include "GeomHelper.h"
 
-#include "GEOM_Gen_No_Session_i.hh"
-#include "SALOME_Container_i.hxx"
 #include "SALOME_KernelServices.hxx"
 
-#include <cstring>
+#include "GEOM_Component_Generator.hxx"
 
 std::string BuildGEOMInstance()
 {
-    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);
-    PortableServer::ObjectId_var conId;
-    //
-    {
-        char *argv[4] = {"Container","FactoryServer","GEOM",nullptr};
-        Engines_Container_i *cont = new Engines_Container_i(orb,poa,"FactoryServer",2,argv,false,false);
-        conId = poa->activate_object(cont);
-    }
-    //
-    pman->activate();
-    //
-    GEOM_Gen_No_Session_i *servant = new GEOM_Gen_No_Session_i(orb,poa,const_cast<PortableServer::ObjectId*>(&conId.in()),"GEOM_inst_2","GEOM");
-    PortableServer::ObjectId *zeId = servant->getId();
-    CORBA::Object_var zeRef = poa->id_to_reference(*zeId);
-    char *interfaceName = servant->interfaceName();
-    std::string interfaceNameCpp(interfaceName);
-    CORBA::string_free(interfaceName);
-    KERNEL::RegisterCompo(interfaceNameCpp,zeRef);
-    CORBA::String_var ior = orb->object_to_string(zeRef);
-    return std::string(ior.in());
+  Engines::EngineComponent_var zeRef = RetrieveGEOMInstance();
+  CORBA::String_var ior = KERNEL::getORB()->object_to_string(zeRef);
+  return std::string(ior.in());
 }