1 // Copyright (C) 2007-2016 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 /*----------------------------------------------------------------------------
24 SALOME HDFPersist : implementation of HDF persitent ( save/ restore )
27 ----------------------------------------------------------------------------*/
32 #define MESSAGE(msg) printf(msg);
33 //__FILE__,":[",__LINE__,"]: ",
36 hdf_idt fid,gid,did,atid;
39 hdf_int32 data[10] = { 1,2,3,4,5,6,7,8,9,10};
40 hdf_int32 attr_val = 2;
42 system("rm titi.HDF");
46 if ((fid = HDFfileCreate("titi.HDF")) < 0)
48 MESSAGE("Creation du fichier")
50 if ((gid = HDFgroupCreate(fid,"GROUP")) < 0)
52 MESSAGE("Creation d'un groupe")
54 if ((atid = HDFattrCreate(gid,"ATTR",HDF_INT32))< 0)
56 MESSAGE("Creation d'un attribut")
58 if ((ret = HDFattrWrite(atid,&attr_val)) < 0)
60 MESSAGE("Ecriture de l'attribut")
62 if ((ret = HDFattrClose(atid)) < 0)
64 MESSAGE("Fermeture de l'attribut")
67 if ((did = HDFdatasetCreate(gid,"DATASET",HDF_INT32,size)) < 0)
69 MESSAGE("Creation d'un dataset")
71 if ((ret = HDFdatasetWrite(did,data)) < 0)
73 MESSAGE("Ecriture du dataset")
75 if ((ret = HDFdatasetClose(did)) < 0)
77 MESSAGE("Fermeture du datset")
79 if ((ret = HDFgroupClose(gid)) < 0)
81 MESSAGE("Fermeture du groupe")
83 if ((ret = HDFfileClose(fid)) < 0)
85 MESSAGE("Fermeture du fichier")
87 if ((fid = HDFfileCreate("toto.HDF")) < 0)
89 MESSAGE("Creation du fichier")
91 if ((ret = HDFfileClose(fid)) < 0)
93 MESSAGE("Fermeture du fichier")