1 // Copyright (C) 2007-2008 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.
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
22 /*----------------------------------------------------------------------------
23 SALOME HDFPersist : implementation of HDF persitent ( save/ restore )
26 ----------------------------------------------------------------------------*/
31 #define MESSAGE(msg) printf(msg);
32 //__FILE__,":[",__LINE__,"]: ",
35 hdf_idt fid,gid,did,atid;
38 hdf_int32 data[10] = { 1,2,3,4,5,6,7,8,9,10};
39 hdf_int32 attr_val = 2;
41 system("rm titi.HDF");
45 if ((fid = HDFfileCreate("titi.HDF")) < 0)
47 MESSAGE("Creation du fichier")
49 if ((gid = HDFgroupCreate(fid,"GROUP")) < 0)
51 MESSAGE("Creation d'un groupe")
53 if ((atid = HDFattrCreate(gid,"ATTR",HDF_INT32))< 0)
55 MESSAGE("Creation d'un attribut")
57 if ((ret = HDFattrWrite(atid,&attr_val)) < 0)
59 MESSAGE("Ecriture de l'attribut")
61 if ((ret = HDFattrClose(atid)) < 0)
63 MESSAGE("Fermeture de l'attribut")
66 if ((did = HDFdatasetCreate(gid,"DATASET",HDF_INT32,size)) < 0)
68 MESSAGE("Creation d'un dataset")
70 if ((ret = HDFdatasetWrite(did,data)) < 0)
72 MESSAGE("Ecriture du dataset")
74 if ((ret = HDFdatasetClose(did)) < 0)
76 MESSAGE("Fermeture du datset")
78 if ((ret = HDFgroupClose(gid)) < 0)
80 MESSAGE("Fermeture du groupe")
82 if ((ret = HDFfileClose(fid)) < 0)
84 MESSAGE("Fermeture du fichier")
86 if ((fid = HDFfileCreate("toto.HDF")) < 0)
88 MESSAGE("Creation du fichier")
90 if ((ret = HDFfileClose(fid)) < 0)
92 MESSAGE("Fermeture du fichier")