1 // SALOME HDFPersist : implementation of HDF persitent ( save/ restore )
3 // Copyright (C) 2003 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
35 HDFgroup *geom, *mesh;
36 HDFgroup *geom1, *geom2, *mesh1, *mesh2;
38 char name[HDF_NAME_MAX_LEN+1];
42 // the groups 'GEOM' and 'MESH' become mounted points for
43 // the files 'geom.hdf' and 'mesh.hdf' in the 'study.hdf' file
45 study = new HDFfile("study.hdf");
46 MESSAGE( ">> The HDFfile object for 'study.hdf' is created" );
48 study->OpenOnDisk(HDF_RDONLY);
49 MESSAGE( "--> The file is opened" );
51 geom = new HDFgroup("GEOM",study);
52 MESSAGE( ">> The HDFgroup object for 'GEOM' is created" );
54 geom->FileMount("geom.hdf",HDF_RDONLY);
55 MESSAGE( ">> 'GEOM' becomes a mounted point for the file 'geom.hdf'" );
58 MESSAGE( "--> The group is opened" );
60 m = geom->nInternalObjects();
61 MESSAGE( "--> There are " << m << " objects in the group" );
65 geom->InternalObjectIndentify(i,name);
66 MESSAGE( "--> First Level Internal Object Name : " << name );
69 geom1 = new HDFgroup("GEOM_1",geom);
70 MESSAGE( ">> The HDF group object is created for 'GEOM_1' with 'GEOM' as father" );
71 MESSAGE( "--> This group is in fact in the file 'geom.hdf'");
74 MESSAGE( "-> The group 'GEOM_1' is opened" );
77 MESSAGE( "-> The group 'GEOM_1' is closed" );
79 geom2 = new HDFgroup("GEOM_2",geom);
80 MESSAGE( ">> The HDF group object is created for 'GEOM_2' with 'GEOM' as father" );
81 MESSAGE( "--> This group is in fact in the file 'geom.hdf'");
84 MESSAGE( "-> The group 'GEOM_2' is opened" );
87 MESSAGE( "-> The group 'GEOM_2' is closed" );
90 MESSAGE( "-> The group 'GEOM' is closed" );
93 MESSAGE( ">> The file 'geom.hdf' is unmounted from 'GEOM' " );
95 mesh = new HDFgroup("MESH",study);
97 mesh->FileMount("mesh.hdf",HDF_RDONLY);
101 mesh1 = new HDFgroup("MESH_1",mesh);
105 mesh1->CloseOnDisk();
107 mesh2 = new HDFgroup("MESH_2",mesh);
111 mesh2->CloseOnDisk();
117 MESSAGE( ">> The same operations have been done for the file 'mesh.hdf'" )
118 MESSAGE( " and the groups MESH_1 and MESH_2" )
119 MESSAGE( "--> This file has been mounted on the group 'MESH' of the file 'study.hdf' ")
121 study->CloseOnDisk();
122 MESSAGE( ">> The study.hdf file is closed" );
124 MESSAGE( ">> Memory clean" );
135 MESSAGE( "!!! HDFexception !!! ")