Salome HOME
83d3ea7f8e6860909ecdb720881d9e4f7e6daa55
[modules/med.git] / src / MEDCouplingCorba / DataArrayDoubleServant.cxx
1 // Copyright (C) 2007-2022  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (CEA/DEN)
20
21 #include "DataArrayDoubleServant.hxx"
22 #include "MEDCouplingMemArray.hxx"
23
24 using namespace MEDCoupling;
25
26 DataArrayDoubleServant::DataArrayDoubleServant(const DataArrayDouble *cppPointer):DataArrayServant(cppPointer)
27 {
28 }
29
30 void DataArrayDoubleServant::getTinyInfo(SALOME_TYPES::ListOfLong_out la, SALOME_TYPES::ListOfString_out sa)
31 {
32   la=new SALOME_TYPES::ListOfLong;
33   std::vector<mcIdType> tinyInfo;
34   getPointer()->getTinySerializationIntInformation(tinyInfo);
35   la->length(tinyInfo.size());
36   for(int i=0;i<(int)tinyInfo.size();i++)
37     (*la)[i]=tinyInfo[i];
38   //
39   sa=new SALOME_TYPES::ListOfString;
40   std::vector<std::string> tinyInfo3;
41   getPointer()->getTinySerializationStrInformation(tinyInfo3);
42   sa->length(tinyInfo3.size());
43   for(int i=0;i<(int)tinyInfo3.size();i++)
44     (*sa)[i]=CORBA::string_dup(tinyInfo3[i].c_str());
45 }
46
47 void DataArrayDoubleServant::getSerialisationData(SALOME_TYPES::ListOfDouble_out da)
48 {
49   da=new SALOME_TYPES::ListOfDouble;
50   if(getPointer()->isAllocated())
51     {
52       int nbElem=getPointer()->getNbOfElems();
53       const double *data=getPointer()->getConstPointer();
54       da->length(nbElem);
55       for(int i=0;i<nbElem;i++)
56         (*da)[i]=data[i];
57     }
58   else
59     {
60       da->length(0);
61     }
62 }
63
64 SALOME::StringSeq *DataArrayDoubleServant::GetExportableFormats()
65 {
66   SALOME::StringSeq *ret=new SALOME::StringSeq;
67   ret->length(0);
68   return ret;
69 }
70
71 CORBA::Boolean DataArrayDoubleServant::ExportDataAs(const char * /*format*/, SALOME::GenericObj_out exporter)
72 {
73   exporter=SALOME::GenericObj::_nil();
74   return false;
75 }