X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FResourcesManager%2FSALOME_ResourcesManager_Common.cxx;fp=src%2FResourcesManager%2FSALOME_ResourcesManager_Common.cxx;h=7969362ed2227768066be491fb1c16b8c696a04e;hb=6ba22390ee3d60fabbb7fcfca5a0911feca55717;hp=0000000000000000000000000000000000000000;hpb=485e5e1deca366a5d823e861d85f0317767a1b92;p=modules%2Fkernel.git diff --git a/src/ResourcesManager/SALOME_ResourcesManager_Common.cxx b/src/ResourcesManager/SALOME_ResourcesManager_Common.cxx new file mode 100644 index 000000000..7969362ed --- /dev/null +++ b/src/ResourcesManager/SALOME_ResourcesManager_Common.cxx @@ -0,0 +1,114 @@ +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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 "SALOME_ResourcesManager_Common.hxx" + +using namespace std; + +template +vector strvec_CORBAtoCPP(const T & strvecCorba) +{ + vector strvecCpp; + for(unsigned int i=0; i +typename T::_var_type strvec_CPPtoCORBA(const vector & strvecCpp) +{ + typename T::_var_type strvecCorba = new T; + strvecCorba->length(strvecCpp.size()); + for(unsigned int i=0;i(params.componentList); + p.resourceList = resourceList_CORBAtoCPP(params.resList); + return p; +} + +Engines::ResourceParameters_var resourceParameters_CPPtoCORBA(const resourceParams & params) +{ + Engines::ResourceParameters_var p = new Engines::ResourceParameters; + p->name = params.name.c_str(); + p->hostname = params.hostname.c_str(); + p->can_launch_batch_jobs = params.can_launch_batch_jobs; + p->can_run_containers = params.can_run_containers; + p->OS = params.OS.c_str(); + p->nb_proc = params.nb_proc; + p->nb_node = params.nb_node; + p->nb_proc_per_node = params.nb_proc_per_node; + p->cpu_clock = params.cpu_clock; + p->mem_mb = params.mem_mb; + p->componentList = strvec_CPPtoCORBA(params.componentList); + p->resList = resourceList_CPPtoCORBA(params.resourceList); + return p; +} + +vector resourceList_CORBAtoCPP(const Engines::ResourceList & resList) +{ + return strvec_CORBAtoCPP(resList); +} + +Engines::ResourceList_var resourceList_CPPtoCORBA(const vector & resList) +{ + return strvec_CPPtoCORBA(resList); +} + +ParserResourcesType resourceDefinition_CORBAtoCPP(const Engines::ResourceDefinition & resDef) +{ + ParserResourcesType resource; + resource.Name = resDef.name; + resource.HostName = resDef.hostname; + resource.setResourceTypeStr(resDef.type.in()); + resource.OS = resDef.OS; + resource.AppliPath = resDef.applipath; + resource.DataForSort._memInMB = resDef.mem_mb; + resource.DataForSort._CPUFreqMHz = resDef.cpu_clock; + resource.DataForSort._nbOfNodes = resDef.nb_node; + resource.DataForSort._nbOfProcPerNode = resDef.nb_proc_per_node; + resource.UserName = resDef.username; + resource.can_launch_batch_jobs = resDef.can_launch_batch_jobs; + resource.can_run_containers = resDef.can_run_containers; + resource.working_directory = resDef.working_directory; + resource.setBatchTypeStr(resDef.batch.in()); + resource.setMpiImplTypeStr(resDef.mpiImpl.in()); + resource.setAccessProtocolTypeStr(resDef.protocol.in()); + resource.setClusterInternalProtocolStr(resDef.iprotocol.in()); + resource.ComponentsList = strvec_CORBAtoCPP(resDef.componentList); + return resource; +}