1 // Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SALOME HDFPersist : implementation of HDF persitent ( save/ restore )
27 #include "HDFarray.hxx"
28 #include "HDFexception.hxx"
32 HDFarray::HDFarray( HDFobject* father, hdf_type dataType, int ndim, hdf_size *dim )
41 HDFarray::HDFarray( HDFobject* father)
50 _id = HDFarrayGetTypeId(father->GetId());
61 hdf_type HDFarray::GetDataType() {
62 if (_datatype == HDF_NONE)
63 if ((_datatype = HDFarrayGetType(_id)) == HDF_NONE )
64 throw HDFexception("Can't determine the type of array data");
69 void HDFarray::CreateOnDisk() {
70 if( (_id = HDFarrayCreate(_datatype,_ndim, _dim)) < 0 )
71 throw HDFexception("Can't create HDF array");
74 void HDFarray::CloseOnDisk() {
75 if( HDFarrayClose(_id) < 0 )
76 throw HDFexception("Can't close HDF array");
79 int HDFarray::nDim() {
81 if ((_ndim = HDFarrayGetnDim(_id)) < 0)
82 throw HDFexception("Can't determine the array dimensions number");
89 void HDFarray::GetDim(hdf_size dim[]) {
97 ndim = HDFdatasetGetnDim(_id);
100 _dim = new hdf_size[ndim];
101 if ((ret = HDFarrayGetDim(_id,_dim)) < 0)
102 throw HDFexception("Can't determine the size dimensions of the array ");
105 for (i=0;i<_ndim;i++)
110 hdf_object_type HDFarray::GetObjectType() {
111 return HDF_ARRAY_TYPE;