smesh/src/SMESH_SWIG/SMeshHelper.cxx

51 lines
2.0 KiB
C++
Raw Permalink Normal View History

2021-01-12 12:01:34 +01:00
// 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 "SMeshHelper.h"
2021-01-21 17:19:35 +01:00
#include "SMESH_Gen_No_Session_i.hxx"
2021-01-12 17:19:38 +01:00
#include "SALOME_Container_i.hxx"
2021-01-14 07:27:11 +01:00
#include "SALOME_KernelServices.hxx"
2021-01-12 17:19:38 +01:00
#include <cstring>
2021-01-21 17:19:35 +01:00
std::string BuildSMESHInstanceInternal()
2021-01-12 12:01:34 +01:00
{
2021-01-12 17:31:25 +01:00
CORBA::ORB_var orb;
2021-01-12 14:30:55 +01:00
{ 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);
2021-01-12 17:19:38 +01:00
PortableServer::POAManager_var pman = poa->the_POAManager();
2021-01-13 11:58:20 +01:00
PortableServer::ObjectId_var conId;
2021-01-12 17:19:38 +01:00
//
{
char *argv[4] = {"Container","FactoryServer","toto",nullptr};
2021-01-21 17:19:35 +01:00
Engines_Container_i *cont = new Engines_Container_i(orb,poa,"FactoryServer",2,argv,false,false);
conId = poa->activate_object(cont);
2021-01-12 17:19:38 +01:00
}
//
pman->activate();
//
2021-01-21 17:19:35 +01:00
SMESH_Gen_No_Session_i *servant = new SMESH_Gen_No_Session_i(orb,poa,const_cast<PortableServer::ObjectId*>(&conId.in()),"SMESH_inst_2","SMESH");
2021-01-12 14:30:55 +01:00
PortableServer::ObjectId *zeId = servant->getId();
CORBA::Object_var zeRef = poa->id_to_reference(*zeId);
2021-01-12 17:19:38 +01:00
CORBA::String_var ior = orb->object_to_string(zeRef);
return std::string(ior.in());
2021-01-12 12:01:34 +01:00
}