X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_SWIG%2FSMeshHelper.cxx;h=7b9c7b1e6932c2df3718b108b796f96070423822;hp=036ef29735dd00c80d7a3c763ec0dde17afa623e;hb=499f29d24922cec66e41b41a0039a954993bc6df;hpb=382f2cc4abb2ee8553a911aeb27348e96c39d197 diff --git a/src/SMESH_SWIG/SMeshHelper.cxx b/src/SMESH_SWIG/SMeshHelper.cxx index 036ef2973..7b9c7b1e6 100644 --- a/src/SMESH_SWIG/SMeshHelper.cxx +++ b/src/SMESH_SWIG/SMeshHelper.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2021-2022 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 @@ -19,32 +19,31 @@ #include "SMeshHelper.h" -#include "SMESH_Gen_No_Session_i.hxx" -#include "SALOME_Container_i.hxx" #include "SALOME_KernelServices.hxx" #include -std::string BuildSMESHInstanceInternal() +#include +#include + +std::string GetMGLicenseKeyImpl(const char* gmfFile) { - 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(); - PortableServer::ObjectId_var conId; - // - { - char *argv[4] = {"Container","FactoryServer","SMESH",nullptr}; - Engines_Container_i *cont = new Engines_Container_i(orb,poa,"FactoryServer",2,argv,false,false); - conId = poa->activate_object(cont); - } - // - pman->activate(); - // - SMESH_Gen_No_Session_i *servant = new SMESH_Gen_No_Session_i(orb,poa,const_cast(&conId.in()),"SMESH_inst_2","SMESH"); - PortableServer::ObjectId *zeId = servant->getId(); - CORBA::Object_var zeRef = poa->id_to_reference(*zeId); - CORBA::String_var ior = orb->object_to_string(zeRef); - return std::string(ior.in()); + smIdType nbVertex, nbEdge, nbFace, nbVol; + DriverGMF_Read gmfReader; + gmfReader.SetFile( gmfFile ); + gmfReader.GetMeshInfo( nbVertex, nbEdge, nbFace, nbVol ); + + std::string errorTxt; + std::string key = SMESHUtils_MGLicenseKeyGen::GetKey( gmfFile, + FromSmIdType( nbVertex ), + FromSmIdType( nbEdge ), + FromSmIdType( nbFace ), + FromSmIdType( nbVol ), + errorTxt ); + if ( !errorTxt.empty() ) + { + std::cerr << "Error: Pb with MeshGems license: " << errorTxt << std::endl; + key = "<" + errorTxt + ">"; + } + return key; }