Salome HOME
This commit was generated by cvs2git to track changes on a CVS vendor
[modules/kernel.git] / src / HDFPersist / test5.cxx
1 //  SALOME HDFPersist : implementation of HDF persitent ( save/ restore )
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : test5.cxx
25 //  Module : SALOME
26
27 using namespace std;
28 #include <iostream.h>
29 #include "HDFOI.hxx"
30 #include <stdlib.h>
31
32
33 int main()
34 {
35   HDFfile *hdf_file;
36   HDFgroup *hdf_group;
37
38   try
39   {
40     // A file study.hdf with 2 groups : MESH and GEOM
41     hdf_file = new HDFfile("study.hdf");
42
43     hdf_file->CreateOnDisk();
44
45     hdf_group = new HDFgroup("GEOM",hdf_file);
46
47     hdf_group->CreateOnDisk();
48
49     hdf_group->CloseOnDisk();
50
51     delete hdf_group;
52
53     hdf_group = new HDFgroup("MESH",hdf_file); 
54
55     hdf_group->CreateOnDisk();
56
57     hdf_group->CloseOnDisk();
58
59     delete hdf_group;    
60
61     hdf_file->CloseOnDisk();
62     
63     delete hdf_file;
64
65     // a file mesh.hdf with 2 groups MESH_1 and MESH_2
66     hdf_file = new HDFfile("mesh.hdf");
67
68     hdf_file->CreateOnDisk();
69
70     hdf_group = new HDFgroup("MESH_1",hdf_file);
71
72     hdf_group->CreateOnDisk();
73
74     hdf_group->CloseOnDisk();
75
76     delete hdf_group;
77
78     hdf_group = new HDFgroup("MESH_2",hdf_file);
79
80     hdf_group->CreateOnDisk();
81
82     hdf_group->CloseOnDisk();
83
84     delete hdf_group;    
85
86     hdf_file->CloseOnDisk();
87     
88     delete hdf_file;
89
90     // a file geom.hdf with 2 groups GEOM_1 and GEOM_2
91     hdf_file = new HDFfile("geom.hdf");
92
93     hdf_file->CreateOnDisk();
94
95     hdf_group = new HDFgroup("GEOM_1",hdf_file);
96
97     hdf_group->CreateOnDisk();
98
99     hdf_group->CloseOnDisk();
100
101     delete hdf_group;
102
103     hdf_group = new HDFgroup("GEOM_2",hdf_file);
104
105     hdf_group->CreateOnDisk();
106
107     hdf_group->CloseOnDisk();
108
109     delete hdf_group;    
110
111     hdf_file->CloseOnDisk();
112     
113     delete hdf_file;
114   }
115   catch (HDFexception)
116     {
117       MESSAGE( "!!!! HDFexception !!!" )
118     }
119
120   return 0;
121 }