Back to index

salome-kernel  6.5.0
test5.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SALOME HDFPersist : implementation of HDF persitent ( save/ restore )
00024 //  File   : test5.cxx
00025 //  Module : SALOME
00026 //
00027 #include <iostream.h>
00028 #include "HDFOI.hxx"
00029 #include <stdlib.h>
00030 
00031 
00032 int main()
00033 {
00034   HDFfile *hdf_file;
00035   HDFgroup *hdf_group;
00036 
00037   try
00038   {
00039     // A file study.hdf with 2 groups : MESH and GEOM
00040     hdf_file = new HDFfile("study.hdf");
00041 
00042     hdf_file->CreateOnDisk();
00043 
00044     hdf_group = new HDFgroup("GEOM",hdf_file);
00045 
00046     hdf_group->CreateOnDisk();
00047 
00048     hdf_group->CloseOnDisk();
00049 
00050     delete hdf_group;
00051 
00052     hdf_group = new HDFgroup("MESH",hdf_file); 
00053 
00054     hdf_group->CreateOnDisk();
00055 
00056     hdf_group->CloseOnDisk();
00057 
00058     delete hdf_group;    
00059 
00060     hdf_file->CloseOnDisk();
00061     
00062     delete hdf_file;
00063 
00064     // a file mesh.hdf with 2 groups MESH_1 and MESH_2
00065     hdf_file = new HDFfile("mesh.hdf");
00066 
00067     hdf_file->CreateOnDisk();
00068 
00069     hdf_group = new HDFgroup("MESH_1",hdf_file);
00070 
00071     hdf_group->CreateOnDisk();
00072 
00073     hdf_group->CloseOnDisk();
00074 
00075     delete hdf_group;
00076 
00077     hdf_group = new HDFgroup("MESH_2",hdf_file);
00078 
00079     hdf_group->CreateOnDisk();
00080 
00081     hdf_group->CloseOnDisk();
00082 
00083     delete hdf_group;    
00084 
00085     hdf_file->CloseOnDisk();
00086     
00087     delete hdf_file;
00088 
00089     // a file geom.hdf with 2 groups GEOM_1 and GEOM_2
00090     hdf_file = new HDFfile("geom.hdf");
00091 
00092     hdf_file->CreateOnDisk();
00093 
00094     hdf_group = new HDFgroup("GEOM_1",hdf_file);
00095 
00096     hdf_group->CreateOnDisk();
00097 
00098     hdf_group->CloseOnDisk();
00099 
00100     delete hdf_group;
00101 
00102     hdf_group = new HDFgroup("GEOM_2",hdf_file);
00103 
00104     hdf_group->CreateOnDisk();
00105 
00106     hdf_group->CloseOnDisk();
00107 
00108     delete hdf_group;    
00109 
00110     hdf_file->CloseOnDisk();
00111     
00112     delete hdf_file;
00113   }
00114   catch (HDFexception)
00115     {
00116       MESSAGE( "!!!! HDFexception !!!" )
00117     }
00118 
00119   return 0;
00120 }