Salome HOME
Edit createStudy method
[modules/kernel.git] / src / HDFPersist / test4.cxx
index 9c85af23ff0d08bcd228e7e64d05421c20f3a6a6..997d1f3974c5c1228eaf687818b06e6550594630 100644 (file)
@@ -1,30 +1,29 @@
-//  SALOME HDFPersist : implementation of HDF persitent ( save/ restore )
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
 //
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  SALOME HDFPersist : implementation of HDF persitent ( save/ restore )
 //  File   : test4.cxx
 //  Module : SALOME
-
-using namespace std;
+//
 #include <iostream.h>
 #include "HDFOI.hxx"
 #include <stdlib.h>
@@ -55,30 +54,30 @@ int main()
       // It is possible to read the name of all (objects) sons in the file
       n = hdf_file->nInternalObjects(); 
       for (i=0;i<n;i++) 
-       {
-         hdf_file->InternalObjectIndentify(i,name);
-         MESSAGE( "--> First Level Internal Object Name : " << name );
-       }   
+        {
+          hdf_file->InternalObjectIndentify(i,name);
+          MESSAGE( "--> First Level Internal Object Name : " << name );
+        }   
 
       // Or it is possible to ask if an object is in the file
       if (hdf_file->ExistInternalObject("MESH"))
-         MESSAGE( "--> The object naming 'MESH' is in the file " );
+          MESSAGE( "--> The object naming 'MESH' is in the file " );
 
       // it is possible to determine the type of an object
       type = hdf_file->InternalObjectType("MESH");
       switch (type)
-       {
-       case HDF_GROUP :
-         MESSAGE( "--> Its type is HDF_GROUP" );
-         break;
-         
-       case HDF_DATASET :
-         MESSAGE( "--> Its type is HDF_DATASET" );
-         break;
-         
-       default :
-         MESSAGE( "--> !!!! PANIC !!!" );
-       }
+        {
+        case HDF_GROUP :
+          MESSAGE( "--> Its type is HDF_GROUP" );
+          break;
+          
+        case HDF_DATASET :
+          MESSAGE( "--> Its type is HDF_DATASET" );
+          break;
+          
+        default :
+          MESSAGE( "--> !!!! PANIC !!!" );
+        }
 
       hdf_group = new HDFgroup(name,hdf_file); 
       MESSAGE( ">> A new HDF group object " << name << " is created in memory")
@@ -90,24 +89,24 @@ int main()
       n = hdf_group->nInternalObjects();  
       MESSAGE( ">> There are " << n << " objects in this group " );
       for (i=0;i<n;i++)     
-       {
-         hdf_group->InternalObjectIndentify(i,name);
-         type = hdf_group->InternalObjectType(name);
-         MESSAGE( "--> First Level Internal Object Name : " << name );
-         switch (type)
-           {
-           case HDF_GROUP :
-             MESSAGE( "--> Its type is HDF_GROUP" );
-             break;
-             
-           case HDF_DATASET :
-             MESSAGE( "--> Its type is HDF_DATASET" );
-             break;
-             
-           default :
-             MESSAGE( "--> !!!! PANIC !!!" );
-           }
-       } 
+        {
+          hdf_group->InternalObjectIndentify(i,name);
+          type = hdf_group->InternalObjectType(name);
+          MESSAGE( "--> First Level Internal Object Name : " << name );
+          switch (type)
+            {
+            case HDF_GROUP :
+              MESSAGE( "--> Its type is HDF_GROUP" );
+              break;
+              
+            case HDF_DATASET :
+              MESSAGE( "--> Its type is HDF_DATASET" );
+              break;
+              
+            default :
+              MESSAGE( "--> !!!! PANIC !!!" );
+            }
+        
 
       // The first dataset object 'COORDINATES'
       hdf_dataset1 = new HDFdataset("COORDINATES",hdf_group);
@@ -118,19 +117,19 @@ int main()
 
       data_type = hdf_dataset1->GetType();
       switch(data_type)
-       {
-       case HDF_INT32 :
-         MESSAGE( "--> Type of data : HDF_INT32 " );
-         break; 
-       case HDF_INT64 :
-         MESSAGE( "--> Type of data : HDF_INT64 " );
-         break; 
-       case HDF_FLOAT64 :
-         MESSAGE( "--> Type of data : HDF_FLOAT64 " );
-         break;
-       default :
-         MESSAGE( "--> Type of data : HDF_STRING " );
-       }
+        {
+        case HDF_INT32 :
+          MESSAGE( "--> Type of data : HDF_INT32 " );
+          break; 
+        case HDF_INT64 :
+          MESSAGE( "--> Type of data : HDF_INT64 " );
+          break; 
+        case HDF_FLOAT64 :
+          MESSAGE( "--> Type of data : HDF_FLOAT64 " );
+          break;
+        default :
+          MESSAGE( "--> Type of data : HDF_STRING " );
+        }
  
       ndim = hdf_dataset1->nDim();
       MESSAGE( "--> Number of dimensions : " << ndim );
@@ -138,7 +137,7 @@ int main()
       dim = new hdf_size[ndim];
       hdf_dataset1->GetDim(dim);
       for (i=0;i<ndim;i++)
-       MESSAGE( "--> Dimension " << i+1 << " of size : " << dim[i] );
+        MESSAGE( "--> Dimension " << i+1 << " of size : " << dim[i] );
       delete dim;
 
       size = hdf_dataset1->GetSize();
@@ -146,7 +145,7 @@ int main()
       hdf_dataset1->ReadFromDisk(val1);
       MESSAGE( "--> The values are : ");
       for (i=0;i<size;i++)
-       MESSAGE( " " << val1[i]);
+        MESSAGE( " " << val1[i]);
       MESSAGE();
       delete val1;
 
@@ -162,19 +161,19 @@ int main()
 
       data_type = hdf_dataset2->GetType();
       switch(data_type)
-       {
-       case HDF_INT32 :
-         MESSAGE( "--> Type of data : HDF_INT32 " );
-         break;
-       case HDF_INT64 :
-         MESSAGE( "--> Type of data : HDF_INT64 " );
-         break;
-       case HDF_FLOAT64 :
-         MESSAGE( "--> Type of data : HDF_FLOAT64 " );
-         break;
-       default :
-         MESSAGE( "--> Type of data : HDF_STRING " );
-       }
+        {
+        case HDF_INT32 :
+          MESSAGE( "--> Type of data : HDF_INT32 " );
+          break;
+        case HDF_INT64 :
+          MESSAGE( "--> Type of data : HDF_INT64 " );
+          break;
+        case HDF_FLOAT64 :
+          MESSAGE( "--> Type of data : HDF_FLOAT64 " );
+          break;
+        default :
+          MESSAGE( "--> Type of data : HDF_STRING " );
+        }
 
       ndim = hdf_dataset2->nDim();
       MESSAGE( "--> Number of dimensions : " << ndim );
@@ -182,7 +181,7 @@ int main()
       dim = new hdf_size[ndim];
       hdf_dataset2->GetDim(dim);
       for (i=0;i<ndim;i++)
-       MESSAGE( "--> Dimension " << i+1 << " of size : " << dim[i] );
+        MESSAGE( "--> Dimension " << i+1 << " of size : " << dim[i] );
       delete dim;
 
       size = hdf_dataset2->GetSize();
@@ -190,7 +189,7 @@ int main()
       hdf_dataset2->ReadFromDisk(val2);
       MESSAGE( "--> The values are : ");
       for (i=0;i<size;i++)
-       MESSAGE( " " << val2[i]);
+        MESSAGE( " " << val2[i]);
       MESSAGE();
       delete val2;