Salome HOME
2c1f8d62d7dd0db44c7c5365c393446e908f2e43
[modules/med.git] / src / MEDCouplingCorba / DataArrayDoubleServant.cxx
1 // Copyright (C) 2007-2012  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.
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
20 #include "DataArrayDoubleServant.hxx"
21 #include "MEDCouplingMemArray.hxx"
22
23 using namespace ParaMEDMEM;
24
25 DataArrayDoubleServant::DataArrayDoubleServant(const DataArrayDouble *cppPointer):DataArrayServant(cppPointer)
26 {
27 }
28
29 void DataArrayDoubleServant::getTinyInfo(SALOME_TYPES::ListOfLong_out la, SALOME_TYPES::ListOfString_out sa)
30 {
31   la=new SALOME_TYPES::ListOfLong;
32   std::vector<int> tinyInfo;
33   getPointer()->getTinySerializationIntInformation(tinyInfo);
34   la->length(tinyInfo.size());
35   for(int i=0;i<(int)tinyInfo.size();i++)
36     (*la)[i]=tinyInfo[i];
37   //
38   sa=new SALOME_TYPES::ListOfString;
39   std::vector<std::string> tinyInfo3;
40   getPointer()->getTinySerializationStrInformation(tinyInfo3);
41   sa->length(tinyInfo3.size());
42   for(int i=0;i<(int)tinyInfo3.size();i++)
43     (*sa)[i]=CORBA::string_dup(tinyInfo3[i].c_str());
44 }
45
46 void DataArrayDoubleServant::getSerialisationData(SALOME_TYPES::ListOfDouble_out da)
47 {
48   da=new SALOME_TYPES::ListOfDouble;
49   if(getPointer()->isAllocated())
50     {
51       int nbElem=getPointer()->getNbOfElems();
52       const double *data=getPointer()->getConstPointer();
53       da->length(nbElem);
54       for(int i=0;i<nbElem;i++)
55         (*da)[i]=data[i];
56     }
57   else
58     {
59       da->length(0);
60     }
61 }
62
63 SALOME::StringSeq *DataArrayDoubleServant::GetExportableFormats()
64 {
65   SALOME::StringSeq *ret=new SALOME::StringSeq;
66   ret->length(0);
67   return ret;
68 }
69
70 CORBA::Boolean DataArrayDoubleServant::ExportDataAs(const char *format, SALOME::GenericObj_out exporter)
71 {
72   exporter=SALOME::GenericObj::_nil();
73   return false;
74 }