Back to index

salome-med  6.5.0
MEDCouplingFieldTemplateServant.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #include "MEDCouplingFieldTemplateServant.hxx"
00021 #include "MEDCouplingFieldTemplate.hxx"
00022 
00023 #include "MEDCouplingMemArray.hxx"
00024 
00025 using namespace ParaMEDMEM;
00026 
00027 MEDCouplingFieldTemplateServant::MEDCouplingFieldTemplateServant(const MEDCouplingFieldTemplate *cppPointerOfMesh):MEDCouplingFieldServant(cppPointerOfMesh)
00028 {
00029 }
00030 
00031 void MEDCouplingFieldTemplateServant::getTinyInfo(SALOME_TYPES::ListOfLong_out la, SALOME_TYPES::ListOfDouble_out da, SALOME_TYPES::ListOfString_out sa)
00032 {
00033   la=new SALOME_TYPES::ListOfLong;
00034   std::vector<int> tinyInfo;
00035   getPointer()->getTinySerializationIntInformation(tinyInfo);
00036   la->length(tinyInfo.size());
00037   for(int i=0;i<(int)tinyInfo.size();i++)
00038     (*la)[i]=tinyInfo[i];
00039   //
00040   da=new SALOME_TYPES::ListOfDouble;
00041   std::vector<double> tinyInfo2;
00042   getPointer()->getTinySerializationDbleInformation(tinyInfo2);
00043   da->length(tinyInfo2.size());
00044   for(int i=0;i<(int)tinyInfo2.size();i++)
00045     (*da)[i]=tinyInfo2[i];
00046   //
00047   sa=new SALOME_TYPES::ListOfString;
00048   std::vector<std::string> tinyInfo3;
00049   getPointer()->getTinySerializationStrInformation(tinyInfo3);
00050   sa->length(tinyInfo3.size());
00051   for(int i=0;i<(int)tinyInfo3.size();i++)
00052     (*sa)[i]=CORBA::string_dup(tinyInfo3[i].c_str());
00053 }
00054 
00055 void MEDCouplingFieldTemplateServant::getSerialisationData(SALOME_TYPES::ListOfLong_out la)
00056 {
00057   DataArrayInt *dataInt;
00058   getPointer()->serialize(dataInt);
00059   //
00060   la=new SALOME_TYPES::ListOfLong;
00061   if(dataInt)
00062     {
00063       int lgth=dataInt->getNbOfElems();
00064       const int *ptr=dataInt->getConstPointer();
00065       la->length(lgth);
00066       for(int i=0;i<lgth;i++)
00067         (*la)[i]=ptr[i];
00068     }
00069   else
00070     la->length(0);
00071 }
00072 
00073 CORBA::Boolean MEDCouplingFieldTemplateServant::ExportDataAs(const char *format, SALOME::GenericObj_out exporter)
00074 {
00075   std::string frmCpp(format);
00076   if(frmCpp=="MEDCorba")
00077     {
00078       exporter=getMesh();
00079       return true;
00080     }
00081   return false;
00082 }