summaryrefslogtreecommitdiffstats
path: root/c++
diff options
context:
space:
mode:
Diffstat (limited to 'c++')
-rw-r--r--c++/examples/chunks.cpp84
-rw-r--r--c++/examples/compound.cpp323
-rw-r--r--c++/examples/create.cpp194
-rw-r--r--c++/examples/extend_ds.cpp386
-rw-r--r--c++/examples/h5group.cpp86
-rw-r--r--c++/examples/h5tutr_cmprss.cpp84
-rw-r--r--c++/examples/h5tutr_crtatt.cpp65
-rw-r--r--c++/examples/h5tutr_crtdat.cpp32
-rw-r--r--c++/examples/h5tutr_crtgrp.cpp12
-rw-r--r--c++/examples/h5tutr_crtgrpar.cpp18
-rw-r--r--c++/examples/h5tutr_crtgrpd.cpp66
-rw-r--r--c++/examples/h5tutr_extend.cpp87
-rw-r--r--c++/examples/h5tutr_rdwt.cpp30
-rw-r--r--c++/examples/h5tutr_subset.cpp67
-rw-r--r--c++/examples/readdata.cpp348
-rw-r--r--c++/examples/writedata.cpp190
-rw-r--r--c++/src/H5AbstractDs.cpp93
-rw-r--r--c++/src/H5AbstractDs.h86
-rw-r--r--c++/src/H5ArrayType.cpp38
-rw-r--r--c++/src/H5ArrayType.h60
-rw-r--r--c++/src/H5AtomType.cpp81
-rw-r--r--c++/src/H5AtomType.h68
-rw-r--r--c++/src/H5Attribute.cpp223
-rw-r--r--c++/src/H5Attribute.h105
-rw-r--r--c++/src/H5Classes.h54
-rw-r--r--c++/src/H5CommonFG.cpp90
-rw-r--r--c++/src/H5CommonFG.h73
-rw-r--r--c++/src/H5CompType.cpp161
-rw-r--r--c++/src/H5CompType.h140
-rw-r--r--c++/src/H5Cpp.h4
-rw-r--r--c++/src/H5DaccProp.cpp36
-rw-r--r--c++/src/H5DaccProp.h52
-rw-r--r--c++/src/H5DataSet.cpp292
-rw-r--r--c++/src/H5DataSet.h214
-rw-r--r--c++/src/H5DataSpace.cpp251
-rw-r--r--c++/src/H5DataSpace.h163
-rw-r--r--c++/src/H5DataType.cpp274
-rw-r--r--c++/src/H5DataType.h211
-rw-r--r--c++/src/H5DcreatProp.cpp293
-rw-r--r--c++/src/H5DcreatProp.h167
-rw-r--r--c++/src/H5DxferProp.cpp236
-rw-r--r--c++/src/H5DxferProp.h141
-rw-r--r--c++/src/H5EnumType.cpp95
-rw-r--r--c++/src/H5EnumType.h84
-rw-r--r--c++/src/H5Exception.cpp179
-rw-r--r--c++/src/H5Exception.h218
-rw-r--r--c++/src/H5FaccProp.cpp244
-rw-r--r--c++/src/H5FaccProp.h186
-rw-r--r--c++/src/H5FcreatProp.cpp151
-rw-r--r--c++/src/H5FcreatProp.h106
-rw-r--r--c++/src/H5File.cpp192
-rw-r--r--c++/src/H5File.h150
-rw-r--r--c++/src/H5FloatType.cpp78
-rw-r--r--c++/src/H5FloatType.h78
-rw-r--r--c++/src/H5Group.cpp66
-rw-r--r--c++/src/H5Group.h76
-rw-r--r--c++/src/H5IdComponent.cpp101
-rw-r--r--c++/src/H5IdComponent.h109
-rw-r--r--c++/src/H5Include.h9
-rw-r--r--c++/src/H5IntType.cpp40
-rw-r--r--c++/src/H5IntType.h54
-rw-r--r--c++/src/H5LaccProp.cpp40
-rw-r--r--c++/src/H5LaccProp.h54
-rw-r--r--c++/src/H5LcreatProp.cpp56
-rw-r--r--c++/src/H5LcreatProp.h64
-rw-r--r--c++/src/H5Library.cpp87
-rw-r--r--c++/src/H5Library.h57
-rw-r--r--c++/src/H5Location.cpp762
-rw-r--r--c++/src/H5Location.h575
-rw-r--r--c++/src/H5Object.cpp206
-rw-r--r--c++/src/H5Object.h118
-rw-r--r--c++/src/H5OcreatProp.cpp54
-rw-r--r--c++/src/H5OcreatProp.h61
-rw-r--r--c++/src/H5PredType.cpp681
-rw-r--r--c++/src/H5PredType.h642
-rw-r--r--c++/src/H5PropList.cpp262
-rw-r--r--c++/src/H5PropList.h166
-rw-r--r--c++/src/H5StrType.cpp57
-rw-r--r--c++/src/H5StrType.h70
-rw-r--r--c++/src/H5VarLenType.cpp29
-rw-r--r--c++/src/H5VarLenType.h48
-rw-r--r--c++/test/dsets.cpp728
-rw-r--r--c++/test/h5cpputil.cpp108
-rw-r--r--c++/test/h5cpputil.h106
-rw-r--r--c++/test/tarray.cpp212
-rw-r--r--c++/test/tattr.cpp856
-rw-r--r--c++/test/tcompound.cpp470
-rw-r--r--c++/test/tdspl.cpp68
-rw-r--r--c++/test/testhdf5.cpp65
-rw-r--r--c++/test/tfile.cpp550
-rw-r--r--c++/test/tfilter.cpp102
-rw-r--r--c++/test/th5s.cpp268
-rw-r--r--c++/test/titerate.cpp246
-rw-r--r--c++/test/tlinks.cpp327
-rw-r--r--c++/test/tobject.cpp186
-rw-r--r--c++/test/trefer.cpp385
-rw-r--r--c++/test/ttypes.cpp339
-rw-r--r--c++/test/tvlstr.cpp265
98 files changed, 8718 insertions, 8546 deletions
diff --git a/c++/examples/chunks.cpp b/c++/examples/chunks.cpp
index 03e2855..fdcb6d3 100644
--- a/c++/examples/chunks.cpp
+++ b/c++/examples/chunks.cpp
@@ -28,20 +28,20 @@ using std::endl;
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME( "SDSextendible.h5" );
-const H5std_string DATASET_NAME( "ExtendibleArray" );
-const int NX = 10;
-const int NY = 5;
-const int RANK = 2;
-const int RANKC = 1;
-
-int main (void)
+const H5std_string FILE_NAME("SDSextendible.h5");
+const H5std_string DATASET_NAME("ExtendibleArray");
+const int NX = 10;
+const int NY = 5;
+const int RANK = 2;
+const int RANKC = 1;
+
+int
+main(void)
{
- hsize_t i, j;
+ hsize_t i, j;
// Try block to detect exceptions raised by any of the calls inside it
- try
- {
+ try {
/*
* Turn off the auto-printing when failure occurs so that we can
* handle the errors appropriately
@@ -51,8 +51,8 @@ int main (void)
/*
* Open the file and the dataset.
*/
- H5File file( FILE_NAME, H5F_ACC_RDONLY );
- DataSet dataset = file.openDataSet( DATASET_NAME );
+ H5File file(FILE_NAME, H5F_ACC_RDONLY);
+ DataSet dataset = file.openDataSet(DATASET_NAME);
/*
* Get filespace for rank and dimension
@@ -67,10 +67,9 @@ int main (void)
/*
* Get and print the dimension sizes of the file dataspace
*/
- hsize_t dims[2]; // dataset dimensions
- rank = filespace.getSimpleExtentDims( dims );
- cout << "dataset rank = " << rank << ", dimensions "
- << (unsigned long)(dims[0]) << " x "
+ hsize_t dims[2]; // dataset dimensions
+ rank = filespace.getSimpleExtentDims(dims);
+ cout << "dataset rank = " << rank << ", dimensions " << (unsigned long)(dims[0]) << " x "
<< (unsigned long)(dims[1]) << endl;
/*
@@ -81,13 +80,12 @@ int main (void)
/*
* Read dataset back and display.
*/
- int data_out[NX][NY]; // buffer for dataset to be read
- dataset.read( data_out, PredType::NATIVE_INT, mspace1, filespace );
+ int data_out[NX][NY]; // buffer for dataset to be read
+ dataset.read(data_out, PredType::NATIVE_INT, mspace1, filespace);
cout << "\n";
cout << "Dataset: \n";
- for (j = 0; j < dims[0]; j++)
- {
+ for (j = 0; j < dims[0]; j++) {
for (i = 0; i < dims[1]; i++)
cout << data_out[j][i] << " ";
cout << endl;
@@ -117,20 +115,20 @@ int main (void)
*/
hsize_t col_dims[1];
col_dims[0] = 10;
- DataSpace mspace2( RANKC, col_dims );
+ DataSpace mspace2(RANKC, col_dims);
/*
* Define the column (hyperslab) to read.
*/
- hsize_t offset[2] = { 0, 2 };
- hsize_t count[2] = { 10, 1 };
- int column[10]; // buffer for column to be read
+ hsize_t offset[2] = {0, 2};
+ hsize_t count[2] = {10, 1};
+ int column[10]; // buffer for column to be read
/*
* Define hyperslab and read.
*/
- filespace.selectHyperslab( H5S_SELECT_SET, count, offset );
- dataset.read( column, PredType::NATIVE_INT, mspace2, filespace );
+ filespace.selectHyperslab(H5S_SELECT_SET, count, offset);
+ dataset.read(column, PredType::NATIVE_INT, mspace2, filespace);
cout << endl;
cout << "Third column: " << endl;
@@ -161,20 +159,18 @@ int main (void)
*/
hsize_t chunk_dims[2];
int rank_chunk;
- if( H5D_CHUNKED == cparms.getLayout() )
- {
+ if (H5D_CHUNKED == cparms.getLayout()) {
/*
* Get chunking information: rank and dimensions
*/
- rank_chunk = cparms.getChunk( 2, chunk_dims);
- cout << "chunk rank " << rank_chunk << "dimensions "
- << (unsigned long)(chunk_dims[0]) << " x "
- << (unsigned long)(chunk_dims[1]) << endl;
+ rank_chunk = cparms.getChunk(2, chunk_dims);
+ cout << "chunk rank " << rank_chunk << "dimensions " << (unsigned long)(chunk_dims[0]) << " x "
+ << (unsigned long)(chunk_dims[1]) << endl;
/*
* Define the memory space to read a chunk.
*/
- DataSpace mspace3( rank_chunk, chunk_dims );
+ DataSpace mspace3(rank_chunk, chunk_dims);
/*
* Define chunk in the file (hyperslab) to read.
@@ -183,17 +179,16 @@ int main (void)
offset[1] = 0;
count[0] = chunk_dims[0];
count[1] = chunk_dims[1];
- filespace.selectHyperslab( H5S_SELECT_SET, count, offset );
+ filespace.selectHyperslab(H5S_SELECT_SET, count, offset);
/*
* Read chunk back and display.
*/
- int chunk_out[2][5]; // buffer for chunk to be read
- dataset.read( chunk_out, PredType::NATIVE_INT, mspace3, filespace );
+ int chunk_out[2][5]; // buffer for chunk to be read
+ dataset.read(chunk_out, PredType::NATIVE_INT, mspace3, filespace);
cout << endl;
cout << "Chunk:" << endl;
- for (j = 0; j < chunk_dims[0]; j++)
- {
+ for (j = 0; j < chunk_dims[0]; j++) {
for (i = 0; i < chunk_dims[1]; i++)
cout << chunk_out[j][i] << " ";
cout << endl;
@@ -204,25 +199,22 @@ int main (void)
* 2 0 0 0 0
*/
}
- } // end of try block
+ } // end of try block
// catch failure caused by the H5File operations
- catch( FileIException error )
- {
+ catch (FileIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSet operations
- catch( DataSetIException error )
- {
+ catch (DataSetIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSpace operations
- catch( DataSpaceIException error )
- {
+ catch (DataSpaceIException error) {
error.printErrorStack();
return -1;
}
diff --git a/c++/examples/compound.cpp b/c++/examples/compound.cpp
index 4b116e0..45b001e 100644
--- a/c++/examples/compound.cpp
+++ b/c++/examples/compound.cpp
@@ -29,175 +29,170 @@ using std::endl;
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME( "SDScompound.h5" );
-const H5std_string DATASET_NAME( "ArrayOfStructures" );
-const H5std_string MEMBER1( "a_name" );
-const H5std_string MEMBER2( "b_name" );
-const H5std_string MEMBER3( "c_name" );
-const int LENGTH = 10;
-const int RANK = 1;
-
-int main(void)
+const H5std_string FILE_NAME("SDScompound.h5");
+const H5std_string DATASET_NAME("ArrayOfStructures");
+const H5std_string MEMBER1("a_name");
+const H5std_string MEMBER2("b_name");
+const H5std_string MEMBER3("c_name");
+const int LENGTH = 10;
+const int RANK = 1;
+
+int
+main(void)
{
- /* First structure and dataset*/
- typedef struct s1_t {
+ /* First structure and dataset*/
+ typedef struct s1_t {
int a;
float b;
double c;
- } s1_t;
+ } s1_t;
- /* Second structure (subset of s1_t) and dataset*/
- typedef struct s2_t {
+ /* Second structure (subset of s1_t) and dataset*/
+ typedef struct s2_t {
double c;
int a;
- } s2_t;
-
- // Try block to detect exceptions raised by any of the calls inside it
- try
- {
- /*
- * Initialize the data
- */
- int i;
- s1_t s1[LENGTH];
- for (i = 0; i< LENGTH; i++)
- {
- s1[i].a = i;
- s1[i].b = i*i;
- s1[i].c = 1./(i+1);
- }
-
- /*
- * Turn off the auto-printing when failure occurs so that we can
- * handle the errors appropriately
- */
- Exception::dontPrint();
-
- /*
- * Create the data space.
- */
- hsize_t dim[] = {LENGTH}; /* Dataspace dimensions */
- DataSpace space( RANK, dim );
-
- /*
- * Create the file.
- */
- H5File* file = new H5File( FILE_NAME, H5F_ACC_TRUNC );
-
- /*
- * Create the memory datatype.
- */
- CompType mtype1( sizeof(s1_t) );
- mtype1.insertMember( MEMBER1, HOFFSET(s1_t, a), PredType::NATIVE_INT);
- mtype1.insertMember( MEMBER3, HOFFSET(s1_t, c), PredType::NATIVE_DOUBLE);
- mtype1.insertMember( MEMBER2, HOFFSET(s1_t, b), PredType::NATIVE_FLOAT);
-
- /*
- * Create the dataset.
- */
- DataSet* dataset;
- dataset = new DataSet(file->createDataSet(DATASET_NAME, mtype1, space));
-
- /*
- * Write data to the dataset;
- */
- dataset->write( s1, mtype1 );
-
- /*
- * Release resources
- */
- delete dataset;
- delete file;
-
- /*
- * Open the file and the dataset.
- */
- file = new H5File( FILE_NAME, H5F_ACC_RDONLY );
- dataset = new DataSet (file->openDataSet( DATASET_NAME ));
-
- /*
- * Create a datatype for s2
- */
- CompType mtype2( sizeof(s2_t) );
-
- mtype2.insertMember( MEMBER3, HOFFSET(s2_t, c), PredType::NATIVE_DOUBLE);
- mtype2.insertMember( MEMBER1, HOFFSET(s2_t, a), PredType::NATIVE_INT);
-
- /*
- * Read two fields c and a from s1 dataset. Fields in the file
- * are found by their names "c_name" and "a_name".
- */
- s2_t s2[LENGTH];
- dataset->read( s2, mtype2 );
-
- /*
- * Display the fields
- */
- cout << endl << "Field c : " << endl;
- for( i = 0; i < LENGTH; i++)
- cout << s2[i].c << " ";
- cout << endl;
-
- cout << endl << "Field a : " << endl;
- for( i = 0; i < LENGTH; i++)
- cout << s2[i].a << " ";
- cout << endl;
-
- /*
- * Create a datatype for s3.
- */
- CompType mtype3( sizeof(float) );
-
- mtype3.insertMember( MEMBER2, 0, PredType::NATIVE_FLOAT);
-
- /*
- * Read field b from s1 dataset. Field in the file is found by its name.
- */
- float s3[LENGTH]; // Third "structure" - used to read float field of s1
- dataset->read( s3, mtype3 );
-
- /*
- * Display the field
- */
- cout << endl << "Field b : " << endl;
- for( i = 0; i < LENGTH; i++)
- cout << s3[i] << " ";
- cout << endl;
-
- /*
- * Release resources
- */
- delete dataset;
- delete file;
- } // end of try block
-
- // catch failure caused by the H5File operations
- catch( FileIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSet operations
- catch( DataSetIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSpace operations
- catch( DataSpaceIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSpace operations
- catch( DataTypeIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- return 0;
+ } s2_t;
+
+ // Try block to detect exceptions raised by any of the calls inside it
+ try {
+ /*
+ * Initialize the data
+ */
+ int i;
+ s1_t s1[LENGTH];
+ for (i = 0; i < LENGTH; i++) {
+ s1[i].a = i;
+ s1[i].b = i * i;
+ s1[i].c = 1. / (i + 1);
+ }
+
+ /*
+ * Turn off the auto-printing when failure occurs so that we can
+ * handle the errors appropriately
+ */
+ Exception::dontPrint();
+
+ /*
+ * Create the data space.
+ */
+ hsize_t dim[] = {LENGTH}; /* Dataspace dimensions */
+ DataSpace space(RANK, dim);
+
+ /*
+ * Create the file.
+ */
+ H5File *file = new H5File(FILE_NAME, H5F_ACC_TRUNC);
+
+ /*
+ * Create the memory datatype.
+ */
+ CompType mtype1(sizeof(s1_t));
+ mtype1.insertMember(MEMBER1, HOFFSET(s1_t, a), PredType::NATIVE_INT);
+ mtype1.insertMember(MEMBER3, HOFFSET(s1_t, c), PredType::NATIVE_DOUBLE);
+ mtype1.insertMember(MEMBER2, HOFFSET(s1_t, b), PredType::NATIVE_FLOAT);
+
+ /*
+ * Create the dataset.
+ */
+ DataSet *dataset;
+ dataset = new DataSet(file->createDataSet(DATASET_NAME, mtype1, space));
+
+ /*
+ * Write data to the dataset;
+ */
+ dataset->write(s1, mtype1);
+
+ /*
+ * Release resources
+ */
+ delete dataset;
+ delete file;
+
+ /*
+ * Open the file and the dataset.
+ */
+ file = new H5File(FILE_NAME, H5F_ACC_RDONLY);
+ dataset = new DataSet(file->openDataSet(DATASET_NAME));
+
+ /*
+ * Create a datatype for s2
+ */
+ CompType mtype2(sizeof(s2_t));
+
+ mtype2.insertMember(MEMBER3, HOFFSET(s2_t, c), PredType::NATIVE_DOUBLE);
+ mtype2.insertMember(MEMBER1, HOFFSET(s2_t, a), PredType::NATIVE_INT);
+
+ /*
+ * Read two fields c and a from s1 dataset. Fields in the file
+ * are found by their names "c_name" and "a_name".
+ */
+ s2_t s2[LENGTH];
+ dataset->read(s2, mtype2);
+
+ /*
+ * Display the fields
+ */
+ cout << endl << "Field c : " << endl;
+ for (i = 0; i < LENGTH; i++)
+ cout << s2[i].c << " ";
+ cout << endl;
+
+ cout << endl << "Field a : " << endl;
+ for (i = 0; i < LENGTH; i++)
+ cout << s2[i].a << " ";
+ cout << endl;
+
+ /*
+ * Create a datatype for s3.
+ */
+ CompType mtype3(sizeof(float));
+
+ mtype3.insertMember(MEMBER2, 0, PredType::NATIVE_FLOAT);
+
+ /*
+ * Read field b from s1 dataset. Field in the file is found by its name.
+ */
+ float s3[LENGTH]; // Third "structure" - used to read float field of s1
+ dataset->read(s3, mtype3);
+
+ /*
+ * Display the field
+ */
+ cout << endl << "Field b : " << endl;
+ for (i = 0; i < LENGTH; i++)
+ cout << s3[i] << " ";
+ cout << endl;
+
+ /*
+ * Release resources
+ */
+ delete dataset;
+ delete file;
+ } // end of try block
+
+ // catch failure caused by the H5File operations
+ catch (FileIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSet operations
+ catch (DataSetIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSpace operations
+ catch (DataSpaceIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSpace operations
+ catch (DataTypeIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ return 0;
}
diff --git a/c++/examples/create.cpp b/c++/examples/create.cpp
index 06b981b..968c897 100644
--- a/c++/examples/create.cpp
+++ b/c++/examples/create.cpp
@@ -25,105 +25,99 @@
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME( "SDS.h5" );
-const H5std_string DATASET_NAME( "IntArray" );
-const int NX = 5; // dataset dimensions
-const int NY = 6;
-const int RANK = 2;
-
-int main (void)
+const H5std_string FILE_NAME("SDS.h5");
+const H5std_string DATASET_NAME("IntArray");
+const int NX = 5; // dataset dimensions
+const int NY = 6;
+const int RANK = 2;
+
+int
+main(void)
{
- /*
- * Data initialization.
- */
- int i, j;
- int data[NX][NY]; // buffer for data to write
- for (j = 0; j < NX; j++)
- {
- for (i = 0; i < NY; i++)
- data[j][i] = i + j;
- }
- /*
- * 0 1 2 3 4 5
- * 1 2 3 4 5 6
- * 2 3 4 5 6 7
- * 3 4 5 6 7 8
- * 4 5 6 7 8 9
- */
-
- // Try block to detect exceptions raised by any of the calls inside it
- try
- {
- /*
- * Turn off the auto-printing when failure occurs so that we can
- * handle the errors appropriately
- */
- Exception::dontPrint();
-
- /*
- * Create a new file using H5F_ACC_TRUNC access,
- * default file creation properties, and default file
- * access properties.
- */
- H5File file( FILE_NAME, H5F_ACC_TRUNC );
-
- /*
- * Define the size of the array and create the data space for fixed
- * size dataset.
- */
- hsize_t dimsf[2]; // dataset dimensions
- dimsf[0] = NX;
- dimsf[1] = NY;
- DataSpace dataspace( RANK, dimsf );
-
- /*
- * Define datatype for the data in the file.
- * We will store little endian INT numbers.
- */
- IntType datatype( PredType::NATIVE_INT );
- datatype.setOrder( H5T_ORDER_LE );
-
- /*
- * Create a new dataset within the file using defined dataspace and
- * datatype and default dataset creation properties.
- */
- DataSet dataset = file.createDataSet( DATASET_NAME, datatype, dataspace );
-
- /*
- * Write the data to the dataset using default memory space, file
- * space, and transfer properties.
- */
- dataset.write( data, PredType::NATIVE_INT );
- } // end of try block
-
- // catch failure caused by the H5File operations
- catch( FileIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSet operations
- catch( DataSetIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSpace operations
- catch( DataSpaceIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSpace operations
- catch( DataTypeIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- return 0; // successfully terminated
+ /*
+ * Data initialization.
+ */
+ int i, j;
+ int data[NX][NY]; // buffer for data to write
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++)
+ data[j][i] = i + j;
+ }
+ /*
+ * 0 1 2 3 4 5
+ * 1 2 3 4 5 6
+ * 2 3 4 5 6 7
+ * 3 4 5 6 7 8
+ * 4 5 6 7 8 9
+ */
+
+ // Try block to detect exceptions raised by any of the calls inside it
+ try {
+ /*
+ * Turn off the auto-printing when failure occurs so that we can
+ * handle the errors appropriately
+ */
+ Exception::dontPrint();
+
+ /*
+ * Create a new file using H5F_ACC_TRUNC access,
+ * default file creation properties, and default file
+ * access properties.
+ */
+ H5File file(FILE_NAME, H5F_ACC_TRUNC);
+
+ /*
+ * Define the size of the array and create the data space for fixed
+ * size dataset.
+ */
+ hsize_t dimsf[2]; // dataset dimensions
+ dimsf[0] = NX;
+ dimsf[1] = NY;
+ DataSpace dataspace(RANK, dimsf);
+
+ /*
+ * Define datatype for the data in the file.
+ * We will store little endian INT numbers.
+ */
+ IntType datatype(PredType::NATIVE_INT);
+ datatype.setOrder(H5T_ORDER_LE);
+
+ /*
+ * Create a new dataset within the file using defined dataspace and
+ * datatype and default dataset creation properties.
+ */
+ DataSet dataset = file.createDataSet(DATASET_NAME, datatype, dataspace);
+
+ /*
+ * Write the data to the dataset using default memory space, file
+ * space, and transfer properties.
+ */
+ dataset.write(data, PredType::NATIVE_INT);
+ } // end of try block
+
+ // catch failure caused by the H5File operations
+ catch (FileIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSet operations
+ catch (DataSetIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSpace operations
+ catch (DataSpaceIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSpace operations
+ catch (DataTypeIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ return 0; // successfully terminated
}
-
diff --git a/c++/examples/extend_ds.cpp b/c++/examples/extend_ds.cpp
index 9e005c6..9145088 100644
--- a/c++/examples/extend_ds.cpp
+++ b/c++/examples/extend_ds.cpp
@@ -32,201 +32,195 @@ using std::endl;
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME( "SDSextendible.h5" );
-const H5std_string DATASET_NAME( "ExtendibleArray" );
-const int NX = 10;
-const int NY = 5;
-const int RANK = 2;
-
-int main (void)
+const H5std_string FILE_NAME("SDSextendible.h5");
+const H5std_string DATASET_NAME("ExtendibleArray");
+const int NX = 10;
+const int NY = 5;
+const int RANK = 2;
+
+int
+main(void)
{
- /*
- * Try block to detect exceptions raised by any of the calls inside it
- */
- try
- {
- /*
- * Turn off the auto-printing when failure occurs so that we can
- * handle the errors appropriately
- */
- Exception::dontPrint();
-
- /*
- * Create the data space with unlimited dimensions.
- */
- hsize_t dims[2] = { 3, 3}; // dataset dimensions at creation
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- DataSpace mspace1( RANK, dims, maxdims);
-
- /*
- * Create a new file. If file exists its contents will be overwritten.
- */
- H5File file( FILE_NAME, H5F_ACC_TRUNC );
-
- /*
- * Modify dataset creation properties, i.e. enable chunking.
- */
- DSetCreatPropList cparms;
-
- hsize_t chunk_dims[2] ={2, 5};
- cparms.setChunk( RANK, chunk_dims );
-
- /*
- * Set fill value for the dataset
- */
- int fill_val = 0;
- cparms.setFillValue( PredType::NATIVE_INT, &fill_val);
-
- /*
- * Create a new dataset within the file using cparms
- * creation properties.
- */
- DataSet dataset = file.createDataSet( DATASET_NAME, PredType::NATIVE_INT, mspace1, cparms);
-
- /*
- * Extend the dataset. This call assures that dataset is at least 3 x 3.
- */
- hsize_t size[2];
- size[0] = 3;
- size[1] = 3;
- dataset.extend( size );
-
- /*
- * Select a hyperslab.
- */
- DataSpace fspace1 = dataset.getSpace ();
- hsize_t offset[2];
- offset[0] = 0;
- offset[1] = 0;
- hsize_t dims1[2] = { 3, 3}; /* data1 dimensions */
- fspace1.selectHyperslab( H5S_SELECT_SET, dims1, offset );
-
- /*
- * Write the data to the hyperslab.
- */
- int data1[3][3] = { {1, 1, 1}, /* data to write */
- {1, 1, 1},
- {1, 1, 1} };
- dataset.write( data1, PredType::NATIVE_INT, mspace1, fspace1 );
-
- /*
- * Extend the dataset. Dataset becomes 10 x 3.
- */
- hsize_t dims2[2] = { 7, 1}; /* data2 dimensions */
- dims[0] = dims1[0] + dims2[0];
- size[0] = dims[0];
- size[1] = dims[1];
- dataset.extend( size );
-
- /*
- * Select a hyperslab.
- */
- DataSpace fspace2 = dataset.getSpace ();
- offset[0] = 3;
- offset[1] = 0;
- fspace2.selectHyperslab( H5S_SELECT_SET, dims2, offset );
-
- /*
- * Define memory space
- */
- DataSpace mspace2( RANK, dims2 );
-
- /*
- * Write the data to the hyperslab.
- */
- int data2[7] = { 2, 2, 2, 2, 2, 2, 2};
- dataset.write( data2, PredType::NATIVE_INT, mspace2, fspace2 );
-
- /*
- * Extend the dataset. Dataset becomes 10 x 5.
- */
- hsize_t dims3[2] = { 2, 2}; /* data3 dimensions */
- dims[1] = dims1[1] + dims3[1];
- size[0] = dims[0];
- size[1] = dims[1];
- dataset.extend( size );
-
- /*
- * Select a hyperslab
- */
- DataSpace fspace3 = dataset.getSpace ();
- offset[0] = 0;
- offset[1] = 3;
- fspace3.selectHyperslab( H5S_SELECT_SET, dims3, offset );
-
- /*
- * Define memory space.
- */
- DataSpace mspace3( RANK, dims3 );
-
- /*
- * Write the data to the hyperslab.
- */
- int data3[2][2] = { {3, 3}, {3, 3} };
- dataset.write( data3, PredType::NATIVE_INT, mspace3, fspace3 );
-
- /*
- * Read the data from this dataset and display it.
- */
- int i, j;
- int data_out[NX][NY];
- for (i = 0; i < NX; i++)
- {
- for (j = 0; j < NY; j++)
- data_out[i][j] = 0;
- }
- dataset.read( data_out, PredType::NATIVE_INT );
- /*
- * Resulting dataset
- *
- * 1 1 1 3 3
- * 1 1 1 3 3
- * 1 1 1 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- */
- /*
- * Display the result.
- */
- for (i=0; i < NX; i++)
- {
- for(j=0; j < NY; j++)
- cout << data_out[i][j] << " ";
- cout << endl;
- }
- } // end of try block
-
- // catch failure caused by the H5File operations
- catch( FileIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSet operations
- catch( DataSetIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSpace operations
- catch( DataSpaceIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSpace operations
- catch( DataTypeIException error )
- {
- error.printErrorStack();
- return -1;
- }
- return 0;
+ /*
+ * Try block to detect exceptions raised by any of the calls inside it
+ */
+ try {
+ /*
+ * Turn off the auto-printing when failure occurs so that we can
+ * handle the errors appropriately
+ */
+ Exception::dontPrint();
+
+ /*
+ * Create the data space with unlimited dimensions.
+ */
+ hsize_t dims[2] = {3, 3}; // dataset dimensions at creation
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ DataSpace mspace1(RANK, dims, maxdims);
+
+ /*
+ * Create a new file. If file exists its contents will be overwritten.
+ */
+ H5File file(FILE_NAME, H5F_ACC_TRUNC);
+
+ /*
+ * Modify dataset creation properties, i.e. enable chunking.
+ */
+ DSetCreatPropList cparms;
+
+ hsize_t chunk_dims[2] = {2, 5};
+ cparms.setChunk(RANK, chunk_dims);
+
+ /*
+ * Set fill value for the dataset
+ */
+ int fill_val = 0;
+ cparms.setFillValue(PredType::NATIVE_INT, &fill_val);
+
+ /*
+ * Create a new dataset within the file using cparms
+ * creation properties.
+ */
+ DataSet dataset = file.createDataSet(DATASET_NAME, PredType::NATIVE_INT, mspace1, cparms);
+
+ /*
+ * Extend the dataset. This call assures that dataset is at least 3 x 3.
+ */
+ hsize_t size[2];
+ size[0] = 3;
+ size[1] = 3;
+ dataset.extend(size);
+
+ /*
+ * Select a hyperslab.
+ */
+ DataSpace fspace1 = dataset.getSpace();
+ hsize_t offset[2];
+ offset[0] = 0;
+ offset[1] = 0;
+ hsize_t dims1[2] = {3, 3}; /* data1 dimensions */
+ fspace1.selectHyperslab(H5S_SELECT_SET, dims1, offset);
+
+ /*
+ * Write the data to the hyperslab.
+ */
+ int data1[3][3] = {{1, 1, 1}, /* data to write */
+ {1, 1, 1},
+ {1, 1, 1}};
+ dataset.write(data1, PredType::NATIVE_INT, mspace1, fspace1);
+
+ /*
+ * Extend the dataset. Dataset becomes 10 x 3.
+ */
+ hsize_t dims2[2] = {7, 1}; /* data2 dimensions */
+ dims[0] = dims1[0] + dims2[0];
+ size[0] = dims[0];
+ size[1] = dims[1];
+ dataset.extend(size);
+
+ /*
+ * Select a hyperslab.
+ */
+ DataSpace fspace2 = dataset.getSpace();
+ offset[0] = 3;
+ offset[1] = 0;
+ fspace2.selectHyperslab(H5S_SELECT_SET, dims2, offset);
+
+ /*
+ * Define memory space
+ */
+ DataSpace mspace2(RANK, dims2);
+
+ /*
+ * Write the data to the hyperslab.
+ */
+ int data2[7] = {2, 2, 2, 2, 2, 2, 2};
+ dataset.write(data2, PredType::NATIVE_INT, mspace2, fspace2);
+
+ /*
+ * Extend the dataset. Dataset becomes 10 x 5.
+ */
+ hsize_t dims3[2] = {2, 2}; /* data3 dimensions */
+ dims[1] = dims1[1] + dims3[1];
+ size[0] = dims[0];
+ size[1] = dims[1];
+ dataset.extend(size);
+
+ /*
+ * Select a hyperslab
+ */
+ DataSpace fspace3 = dataset.getSpace();
+ offset[0] = 0;
+ offset[1] = 3;
+ fspace3.selectHyperslab(H5S_SELECT_SET, dims3, offset);
+
+ /*
+ * Define memory space.
+ */
+ DataSpace mspace3(RANK, dims3);
+
+ /*
+ * Write the data to the hyperslab.
+ */
+ int data3[2][2] = {{3, 3}, {3, 3}};
+ dataset.write(data3, PredType::NATIVE_INT, mspace3, fspace3);
+
+ /*
+ * Read the data from this dataset and display it.
+ */
+ int i, j;
+ int data_out[NX][NY];
+ for (i = 0; i < NX; i++) {
+ for (j = 0; j < NY; j++)
+ data_out[i][j] = 0;
+ }
+ dataset.read(data_out, PredType::NATIVE_INT);
+ /*
+ * Resulting dataset
+ *
+ * 1 1 1 3 3
+ * 1 1 1 3 3
+ * 1 1 1 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ */
+ /*
+ * Display the result.
+ */
+ for (i = 0; i < NX; i++) {
+ for (j = 0; j < NY; j++)
+ cout << data_out[i][j] << " ";
+ cout << endl;
+ }
+ } // end of try block
+
+ // catch failure caused by the H5File operations
+ catch (FileIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSet operations
+ catch (DataSetIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSpace operations
+ catch (DataSpaceIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSpace operations
+ catch (DataTypeIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+ return 0;
}
diff --git a/c++/examples/h5group.cpp b/c++/examples/h5group.cpp
index 271c538..3d2c6d9 100644
--- a/c++/examples/h5group.cpp
+++ b/c++/examples/h5group.cpp
@@ -32,22 +32,21 @@ using std::endl;
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME( "Group.h5" );
+const H5std_string FILE_NAME("Group.h5");
const int RANK = 2;
// Operator function
-extern "C" herr_t file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo,
- void *opdata);
+extern "C" herr_t file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata);
-int main(void)
+int
+main(void)
{
- hsize_t dims[2];
- hsize_t cdims[2];
+ hsize_t dims[2];
+ hsize_t cdims[2];
// Try block to detect exceptions raised by any of the calls inside it
- try
- {
+ try {
/*
* Turn off the auto-printing when failure occurs so that we can
* handle the errors appropriately
@@ -58,12 +57,12 @@ int main(void)
* Create the named file, truncating the existing one if any,
* using default create and access property lists.
*/
- H5File *file = new H5File( FILE_NAME, H5F_ACC_TRUNC );
+ H5File *file = new H5File(FILE_NAME, H5F_ACC_TRUNC);
/*
* Create a group in the file
*/
- Group* group = new Group( file->createGroup( "/Data" ));
+ Group *group = new Group(file->createGroup("/Data"));
/*
* Create dataset "Compressed Data" in the group using absolute
@@ -71,21 +70,20 @@ int main(void)
* GZIP compression with the compression effort set to 6.
* Note that compression can be used only when dataset is chunked.
*/
- dims[0] = 1000;
- dims[1] = 20;
- cdims[0] = 20;
- cdims[1] = 20;
- DataSpace *dataspace = new DataSpace(RANK, dims); // create new dspace
- DSetCreatPropList ds_creatplist; // create dataset creation prop list
- ds_creatplist.setChunk( 2, cdims ); // then modify it for compression
- ds_creatplist.setDeflate( 6 );
+ dims[0] = 1000;
+ dims[1] = 20;
+ cdims[0] = 20;
+ cdims[1] = 20;
+ DataSpace * dataspace = new DataSpace(RANK, dims); // create new dspace
+ DSetCreatPropList ds_creatplist; // create dataset creation prop list
+ ds_creatplist.setChunk(2, cdims); // then modify it for compression
+ ds_creatplist.setDeflate(6);
/*
* Create the first dataset.
*/
- DataSet* dataset = new DataSet(file->createDataSet(
- "/Data/Compressed_Data", PredType::NATIVE_INT,
- *dataspace, ds_creatplist ));
+ DataSet *dataset = new DataSet(
+ file->createDataSet("/Data/Compressed_Data", PredType::NATIVE_INT, *dataspace, ds_creatplist));
/*
* Close the first dataset.
@@ -96,11 +94,10 @@ int main(void)
/*
* Create the second dataset.
*/
- dims[0] = 500;
- dims[1] = 20;
+ dims[0] = 500;
+ dims[1] = 20;
dataspace = new DataSpace(RANK, dims); // create second dspace
- dataset = new DataSet(file->createDataSet("/Data/Float_Data",
- PredType::NATIVE_FLOAT, *dataspace));
+ dataset = new DataSet(file->createDataSet("/Data/Float_Data", PredType::NATIVE_FLOAT, *dataspace));
delete dataset;
delete dataspace;
@@ -110,16 +107,16 @@ int main(void)
/*
* Now reopen the file and group in the file.
*/
- file = new H5File(FILE_NAME, H5F_ACC_RDWR);
+ file = new H5File(FILE_NAME, H5F_ACC_RDWR);
group = new Group(file->openGroup("Data"));
/*
* Access "Compressed_Data" dataset in the group.
*/
- try { // to determine if the dataset exists in the group
- dataset = new DataSet( group->openDataSet( "Compressed_Data" ));
+ try { // to determine if the dataset exists in the group
+ dataset = new DataSet(group->openDataSet("Compressed_Data"));
}
- catch( GroupIException not_found_error ) {
+ catch (GroupIException not_found_error) {
cout << " Dataset is not found." << endl;
}
cout << "dataset \"/Data/Compressed_Data\" is open" << endl;
@@ -132,17 +129,16 @@ int main(void)
/*
* Create hard link to the Data group.
*/
- file->link( H5L_TYPE_HARD, "Data", "Data_new" );
+ file->link(H5L_TYPE_HARD, "Data", "Data_new");
/*
* We can access "Compressed_Data" dataset using created
* hard link "Data_new".
*/
- try { // to determine if the dataset exists in the file
- dataset = new DataSet(file->openDataSet( "/Data_new/Compressed_Data" ));
+ try { // to determine if the dataset exists in the file
+ dataset = new DataSet(file->openDataSet("/Data_new/Compressed_Data"));
}
- catch( FileIException not_found_error )
- {
+ catch (FileIException not_found_error) {
cout << " Dataset is not found." << endl;
}
cout << "dataset \"/Data_new/Compressed_Data\" is open" << endl;
@@ -165,11 +161,10 @@ int main(void)
* of the objects in the file root direvtory.
*/
cout << "Unlinking..." << endl;
- try { // attempt to unlink the dataset
- file->unlink( "Data" );
+ try { // attempt to unlink the dataset
+ file->unlink("Data");
}
- catch( FileIException unlink_error )
- {
+ catch (FileIException unlink_error) {
cout << " unlink failed." << endl;
}
cout << "\"Data\" is unlinked" << endl;
@@ -183,32 +178,28 @@ int main(void)
*/
delete group;
delete file;
- } // end of try block
+ } // end of try block
// catch failure caused by the H5File operations
- catch( FileIException error )
- {
+ catch (FileIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSet operations
- catch( DataSetIException error )
- {
+ catch (DataSetIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSpace operations
- catch( DataSpaceIException error )
- {
+ catch (DataSpaceIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the Attribute operations
- catch( AttributeIException error )
- {
+ catch (AttributeIException error) {
error.printErrorStack();
return -1;
}
@@ -236,4 +227,3 @@ file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata
H5Gclose(group);
return 0;
}
-
diff --git a/c++/examples/h5tutr_cmprss.cpp b/c++/examples/h5tutr_cmprss.cpp
index e3cf978..23a7aba 100644
--- a/c++/examples/h5tutr_cmprss.cpp
+++ b/c++/examples/h5tutr_cmprss.cpp
@@ -24,20 +24,20 @@ using std::endl;
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME("h5tutr_cmprss.h5");
-const H5std_string DATASET_NAME("Compressed_Data");
-const int DIM0 = 100;
-const int DIM1 = 20;
+const H5std_string FILE_NAME("h5tutr_cmprss.h5");
+const H5std_string DATASET_NAME("Compressed_Data");
+const int DIM0 = 100;
+const int DIM1 = 20;
-int main (void)
+int
+main(void)
{
- hsize_t dims[2] = { DIM0, DIM1 }; // dataset dimensions
- hsize_t chunk_dims[2] = { 20, 20 }; // chunk dimensions
- int i,j, buf[DIM0][DIM1];
+ hsize_t dims[2] = {DIM0, DIM1}; // dataset dimensions
+ hsize_t chunk_dims[2] = {20, 20}; // chunk dimensions
+ int i, j, buf[DIM0][DIM1];
// Try block to detect exceptions raised by any of the calls inside it
- try
- {
+ try {
// Turn off the auto-printing when failure occurs so that we can
// handle the errors appropriately
Exception::dontPrint();
@@ -49,7 +49,7 @@ int main (void)
DataSpace *dataspace = new DataSpace(2, dims);
// Modify dataset creation property to enable chunking
- DSetCreatPropList *plist = new DSetCreatPropList;
+ DSetCreatPropList *plist = new DSetCreatPropList;
plist->setChunk(2, chunk_dims);
// Set ZLIB (DEFLATE) Compression using level 6.
@@ -62,12 +62,12 @@ int main (void)
// plist->setSzip(szip_options_mask, szip_pixels_per_block);
// Create the dataset.
- DataSet *dataset = new DataSet(file.createDataSet( DATASET_NAME,
- PredType::STD_I32BE, *dataspace, *plist) );
+ DataSet *dataset =
+ new DataSet(file.createDataSet(DATASET_NAME, PredType::STD_I32BE, *dataspace, *plist));
- for (i = 0; i< DIM0; i++)
- for (j=0; j<DIM1; j++)
- buf[i][j] = i+j;
+ for (i = 0; i < DIM0; i++)
+ for (j = 0; j < DIM1; j++)
+ buf[i][j] = i + j;
// Write data to dataset.
dataset->write(buf, PredType::NATIVE_INT);
@@ -83,41 +83,41 @@ int main (void)
// information for dataset and read the data back.
// -----------------------------------------------
- int rbuf[DIM0][DIM1];
- int numfilt;
- size_t nelmts={1}, namelen={1};
- unsigned flags, filter_info, cd_values[1], idx;
- char name[1];
+ int rbuf[DIM0][DIM1];
+ int numfilt;
+ size_t nelmts = {1}, namelen = {1};
+ unsigned flags, filter_info, cd_values[1], idx;
+ char name[1];
H5Z_filter_t filter_type;
// Open the file and the dataset in the file.
file.openFile(FILE_NAME, H5F_ACC_RDONLY);
- dataset = new DataSet(file.openDataSet( DATASET_NAME));
+ dataset = new DataSet(file.openDataSet(DATASET_NAME));
// Get the create property list of the dataset.
- plist = new DSetCreatPropList(dataset->getCreatePlist ());
+ plist = new DSetCreatPropList(dataset->getCreatePlist());
// Get the number of filters associated with the dataset.
numfilt = plist->getNfilters();
cout << "Number of filters associated with dataset: " << numfilt << endl;
- for (idx=0; idx < numfilt; idx++) {
+ for (idx = 0; idx < numfilt; idx++) {
nelmts = 0;
- filter_type = plist->getFilter(idx, flags, nelmts, cd_values, namelen, name , filter_info);
+ filter_type = plist->getFilter(idx, flags, nelmts, cd_values, namelen, name, filter_info);
cout << "Filter Type: ";
switch (filter_type) {
- case H5Z_FILTER_DEFLATE:
- cout << "H5Z_FILTER_DEFLATE" << endl;
- break;
- case H5Z_FILTER_SZIP:
- cout << "H5Z_FILTER_SZIP" << endl;
- break;
- default:
- cout << "Other filter type included." << endl;
- }
+ case H5Z_FILTER_DEFLATE:
+ cout << "H5Z_FILTER_DEFLATE" << endl;
+ break;
+ case H5Z_FILTER_SZIP:
+ cout << "H5Z_FILTER_SZIP" << endl;
+ break;
+ default:
+ cout << "Other filter type included." << endl;
+ }
}
// Read data.
@@ -125,31 +125,27 @@ int main (void)
delete plist;
delete dataset;
- file.close(); // can be skipped
+ file.close(); // can be skipped
- } // end of try block
+ } // end of try block
// catch failure caused by the H5File operations
- catch(FileIException error)
- {
+ catch (FileIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSet operations
- catch(DataSetIException error)
- {
+ catch (DataSetIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSpace operations
- catch(DataSpaceIException error)
- {
+ catch (DataSpaceIException error) {
error.printErrorStack();
return -1;
}
- return 0; // successfully terminated
+ return 0; // successfully terminated
}
-
diff --git a/c++/examples/h5tutr_crtatt.cpp b/c++/examples/h5tutr_crtatt.cpp
index 409bd62..fdedadf 100644
--- a/c++/examples/h5tutr_crtatt.cpp
+++ b/c++/examples/h5tutr_crtatt.cpp
@@ -21,69 +21,62 @@
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME( "h5tutr_dset.h5" );
-const H5std_string DATASET_NAME( "dset" );
-const H5std_string ATTR_NAME( "Units" );
+const H5std_string FILE_NAME("h5tutr_dset.h5");
+const H5std_string DATASET_NAME("dset");
+const H5std_string ATTR_NAME("Units");
-const int DIM1 = 2;
+const int DIM1 = 2;
-int main (void)
+int
+main(void)
{
- int attr_data[2] = { 100, 200};
- hsize_t dims[1] = { DIM1 };
+ int attr_data[2] = {100, 200};
+ hsize_t dims[1] = {DIM1};
-
- // Try block to detect exceptions raised by any of the calls inside it
- try
- {
+ // Try block to detect exceptions raised by any of the calls inside it
+ try {
// Turn off the auto-printing when failure occurs so that we can
// handle the errors appropriately
Exception::dontPrint();
// Open an existing file and dataset.
- H5File file( FILE_NAME, H5F_ACC_RDWR );
- DataSet dataset = file.openDataSet( DATASET_NAME );
+ H5File file(FILE_NAME, H5F_ACC_RDWR);
+ DataSet dataset = file.openDataSet(DATASET_NAME);
// Create the data space for the attribute.
- DataSpace attr_dataspace = DataSpace (1, dims );
+ DataSpace attr_dataspace = DataSpace(1, dims);
// Create a dataset attribute.
- Attribute attribute = dataset.createAttribute( ATTR_NAME, PredType::STD_I32BE,
- attr_dataspace);
+ Attribute attribute = dataset.createAttribute(ATTR_NAME, PredType::STD_I32BE, attr_dataspace);
// Write the attribute data.
- attribute.write( PredType::NATIVE_INT, attr_data);
+ attribute.write(PredType::NATIVE_INT, attr_data);
- } // end of try block
+ } // end of try block
- // catch failure caused by the H5File operations
- catch( DataSpaceIException error )
- {
+ // catch failure caused by the H5File operations
+ catch (DataSpaceIException error) {
error.printErrorStack();
return -1;
- }
+ }
- // catch failure caused by the H5File operations
- catch( AttributeIException error )
- {
+ // catch failure caused by the H5File operations
+ catch (AttributeIException error) {
error.printErrorStack();
return -1;
- }
+ }
- // catch failure caused by the H5File operations
- catch( FileIException error )
- {
+ // catch failure caused by the H5File operations
+ catch (FileIException error) {
error.printErrorStack();
return -1;
- }
+ }
- // catch failure caused by the DataSet operations
- catch( DataSetIException error )
- {
+ // catch failure caused by the DataSet operations
+ catch (DataSetIException error) {
error.printErrorStack();
return -1;
- }
+ }
- return 0; // successfully terminated
+ return 0; // successfully terminated
}
-
diff --git a/c++/examples/h5tutr_crtdat.cpp b/c++/examples/h5tutr_crtdat.cpp
index 3257223..aef78d9 100644
--- a/c++/examples/h5tutr_crtdat.cpp
+++ b/c++/examples/h5tutr_crtdat.cpp
@@ -22,17 +22,17 @@
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME("h5tutr_dset.h5");
-const H5std_string DATASET_NAME("dset");
-const int NX = 4; // dataset dimensions
-const int NY = 6;
-const int RANK = 2;
+const H5std_string FILE_NAME("h5tutr_dset.h5");
+const H5std_string DATASET_NAME("dset");
+const int NX = 4; // dataset dimensions
+const int NY = 6;
+const int RANK = 2;
-int main (void)
+int
+main(void)
{
// Try block to detect exceptions raised by any of the calls inside it
- try
- {
+ try {
// Turn off the auto-printing when failure occurs so that we can
// handle the errors appropriately
Exception::dontPrint();
@@ -41,7 +41,7 @@ int main (void)
H5File file(FILE_NAME, H5F_ACC_TRUNC);
// Create the data space for the dataset.
- hsize_t dims[2]; // dataset dimensions
+ hsize_t dims[2]; // dataset dimensions
dims[0] = NX;
dims[1] = NY;
DataSpace dataspace(RANK, dims);
@@ -49,29 +49,25 @@ int main (void)
// Create the dataset.
DataSet dataset = file.createDataSet(DATASET_NAME, PredType::STD_I32BE, dataspace);
- } // end of try block
+ } // end of try block
// catch failure caused by the H5File operations
- catch(FileIException error)
- {
+ catch (FileIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSet operations
- catch(DataSetIException error)
- {
+ catch (DataSetIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSpace operations
- catch(DataSpaceIException error)
- {
+ catch (DataSpaceIException error) {
error.printErrorStack();
return -1;
}
- return 0; // successfully terminated
+ return 0; // successfully terminated
}
-
diff --git a/c++/examples/h5tutr_crtgrp.cpp b/c++/examples/h5tutr_crtgrp.cpp
index 43af08a..8e48eec 100644
--- a/c++/examples/h5tutr_crtgrp.cpp
+++ b/c++/examples/h5tutr_crtgrp.cpp
@@ -26,11 +26,11 @@ using namespace H5;
const H5std_string FILE_NAME("h5tutr_group.h5");
-int main(void)
+int
+main(void)
{
// Try block to detect exceptions raised by any of the calls inside it
- try
- {
+ try {
// Turn off the auto-printing when failure occurs so that we can
// handle the errors appropriately
Exception::dontPrint();
@@ -46,14 +46,12 @@ int main(void)
} // end of try block
// catch failure caused by the H5File operations
- catch(FileIException error)
- {
+ catch (FileIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the Group operations
- catch(GroupIException error)
- {
+ catch (GroupIException error) {
error.printErrorStack();
return -1;
}
diff --git a/c++/examples/h5tutr_crtgrpar.cpp b/c++/examples/h5tutr_crtgrpar.cpp
index 15cf1df..3414cee 100644
--- a/c++/examples/h5tutr_crtgrpar.cpp
+++ b/c++/examples/h5tutr_crtgrpar.cpp
@@ -26,12 +26,12 @@ using namespace H5;
const H5std_string FILE_NAME("h5tutr_groups.h5");
-int main(void)
+int
+main(void)
{
// Try block to detect exceptions raised by any of the calls inside it
- try
- {
+ try {
// Turn off the auto-printing when failure occurs so that we can
// handle the errors appropriately.
@@ -44,7 +44,7 @@ int main(void)
// Create group "MyGroup" in the root group using an absolute name.
- Group group1(file.createGroup( "/MyGroup"));
+ Group group1(file.createGroup("/MyGroup"));
// Create group "Group_A" in group "MyGroup" using an
// absolute name.
@@ -54,7 +54,7 @@ int main(void)
// Create group "Group_B" in group "MyGroup" using a
// relative name.
- Group group3(group1.createGroup ("Group_B"));
+ Group group3(group1.createGroup("Group_B"));
// Close the groups and file.
@@ -66,20 +66,16 @@ int main(void)
} // end of try block
// catch failure caused by the File operations
- catch(FileIException error)
- {
+ catch (FileIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the Group operations
- catch(GroupIException error)
- {
+ catch (GroupIException error) {
error.printErrorStack();
return -1;
}
return 0;
}
-
-
diff --git a/c++/examples/h5tutr_crtgrpd.cpp b/c++/examples/h5tutr_crtgrpd.cpp
index c28b666..8ada706 100644
--- a/c++/examples/h5tutr_crtgrpd.cpp
+++ b/c++/examples/h5tutr_crtgrpd.cpp
@@ -27,20 +27,20 @@ using namespace H5;
const H5std_string FILE_NAME("h5tutr_groups.h5");
const H5std_string DATASET_NAME1("/MyGroup/dset1");
const H5std_string DATASET_NAME2("dset2");
-const int RANK = 2;
-const int D1DIM1 = 3;
-const int D1DIM2 = 3;
-const int D2DIM1 = 2;
-const int D2DIM2 = 10;
-
-int main(void)
+const int RANK = 2;
+const int D1DIM1 = 3;
+const int D1DIM2 = 3;
+const int D2DIM1 = 2;
+const int D2DIM2 = 10;
+
+int
+main(void)
{
int dset1_data[D1DIM1][D1DIM2], dset2_data[D2DIM1][D2DIM2]; // data buffers
int i, j;
// Try block to catch exceptions raised by any of the calls inside it
- try
- {
+ try {
// Turn off the auto-printing when failure occurs so that we can
// handle the errors appropriately
Exception::dontPrint();
@@ -48,12 +48,12 @@ int main(void)
// Initialize the first dataset.
for (i = 0; i < D1DIM1; i++)
for (j = 0; j < D1DIM2; j++)
- dset1_data[i][j] = j + 1;
+ dset1_data[i][j] = j + 1;
// Initialize the second dataset.
for (i = 0; i < D2DIM1; i++)
- for (j = 0; j < D2DIM2; j++)
- dset2_data[i][j] = j + 1;
+ for (j = 0; j < D2DIM2; j++)
+ dset2_data[i][j] = j + 1;
// Open an existing file and dataset.
H5File file(FILE_NAME, H5F_ACC_RDWR);
@@ -62,15 +62,14 @@ int main(void)
// pointer for the instance 'dataspace'. It can be deleted and
// used again later for another data space. An HDF5 identifier is
// closed by the destructor or the method 'close()'.
- hsize_t dims[RANK]; // dataset dimensions
- dims[0] = D1DIM1;
- dims[1] = D1DIM2;
- DataSpace *dataspace = new DataSpace (RANK, dims);
+ hsize_t dims[RANK]; // dataset dimensions
+ dims[0] = D1DIM1;
+ dims[1] = D1DIM2;
+ DataSpace *dataspace = new DataSpace(RANK, dims);
// Create the dataset in group "MyGroup". Same note as for the
// dataspace above.
- DataSet *dataset = new DataSet (file.createDataSet(DATASET_NAME1,
- PredType::STD_I32BE, *dataspace));
+ DataSet *dataset = new DataSet(file.createDataSet(DATASET_NAME1, PredType::STD_I32BE, *dataspace));
// Write the data to the dataset using default memory space, file
// space, and transfer properties.
@@ -81,16 +80,15 @@ int main(void)
delete dataspace;
// Create the data space for the second dataset.
- dims[0] = D2DIM1;
- dims[1] = D2DIM2;
- dataspace = new DataSpace (RANK, dims);
+ dims[0] = D2DIM1;
+ dims[1] = D2DIM2;
+ dataspace = new DataSpace(RANK, dims);
// Create group "Group_A" in group "MyGroup".
Group group(file.openGroup("/MyGroup/Group_A"));
// Create the second dataset in group "Group_A".
- dataset = new DataSet (group.createDataSet(DATASET_NAME2,
- PredType::STD_I32BE, *dataspace));
+ dataset = new DataSet(group.createDataSet(DATASET_NAME2, PredType::STD_I32BE, *dataspace));
// Write the data to the dataset using default memory space, file
// space, and transfer properties.
@@ -104,31 +102,27 @@ int main(void)
} // end of try block
// catch failure caused by the H5File operations
- catch(FileIException error)
- {
- error.printErrorStack();
- return -1;
+ catch (FileIException error) {
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSet operations
- catch(DataSetIException error)
- {
- error.printErrorStack();
- return -1;
+ catch (DataSetIException error) {
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSpace operations
- catch(DataSpaceIException error)
- {
+ catch (DataSpaceIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the Group operations
- catch(GroupIException error)
- {
+ catch (GroupIException error) {
error.printErrorStack();
return -1;
}
- return 0;
+ return 0;
}
diff --git a/c++/examples/h5tutr_extend.cpp b/c++/examples/h5tutr_extend.cpp
index 94e9acf..71a8ffb 100644
--- a/c++/examples/h5tutr_extend.cpp
+++ b/c++/examples/h5tutr_extend.cpp
@@ -24,34 +24,28 @@ using std::endl;
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME("h5tutr_extend.h5");
-const H5std_string DATASETNAME("ExtendibleArray");
+const H5std_string FILE_NAME("h5tutr_extend.h5");
+const H5std_string DATASETNAME("ExtendibleArray");
-int main (void)
+int
+main(void)
{
- hsize_t dims[2] = {3,3}; // dataset dimensions at creation
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[2] ={2, 5};
- int data[3][3] = { {1, 1, 1}, // data to write
- {1, 1, 1},
- {1, 1, 1} };
-
- // Variables used in extending and writing to the extended portion of dataset
-
- hsize_t size[2];
- hsize_t offset[2];
- hsize_t dimsext[2] = {7, 3}; // extend dimensions
- int dataext[7][3] = { {2, 3, 4},
- {2, 3, 4},
- {2, 3, 4},
- {2, 3, 4},
- {2, 3, 4},
- {2, 3, 4},
- {2, 3, 4} };
+ hsize_t dims[2] = {3, 3}; // dataset dimensions at creation
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t chunk_dims[2] = {2, 5};
+ int data[3][3] = {{1, 1, 1}, // data to write
+ {1, 1, 1},
+ {1, 1, 1}};
+
+ // Variables used in extending and writing to the extended portion of dataset
+
+ hsize_t size[2];
+ hsize_t offset[2];
+ hsize_t dimsext[2] = {7, 3}; // extend dimensions
+ int dataext[7][3] = {{2, 3, 4}, {2, 3, 4}, {2, 3, 4}, {2, 3, 4}, {2, 3, 4}, {2, 3, 4}, {2, 3, 4}};
// Try block to detect exceptions raised by any of the calls inside it
- try
- {
+ try {
// Turn off the auto-printing when failure occurs so that we can
// handle the errors appropriately
Exception::dontPrint();
@@ -63,15 +57,15 @@ int main (void)
// for the instance 'dataspace'. It can be deleted and used again
// later for another dataspace. An HDF5 identifier can be closed
// by the destructor or the method 'close()'.
- DataSpace *dataspace = new DataSpace (2, dims, maxdims);
+ DataSpace *dataspace = new DataSpace(2, dims, maxdims);
// Modify dataset creation property to enable chunking
DSetCreatPropList prop;
prop.setChunk(2, chunk_dims);
// Create the chunked dataset. Note the use of pointer.
- DataSet *dataset = new DataSet(file.createDataSet( DATASETNAME,
- PredType::STD_I32BE, *dataspace, prop) );
+ DataSet *dataset =
+ new DataSet(file.createDataSet(DATASETNAME, PredType::STD_I32BE, *dataspace, prop));
// Write data to dataset.
dataset->write(data, PredType::NATIVE_INT);
@@ -82,9 +76,9 @@ int main (void)
dataset->extend(size);
// Select a hyperslab in extended portion of the dataset.
- DataSpace *filespace = new DataSpace(dataset->getSpace ());
- offset[0] = 3;
- offset[1] = 0;
+ DataSpace *filespace = new DataSpace(dataset->getSpace());
+ offset[0] = 3;
+ offset[1] = 0;
filespace->selectHyperslab(H5S_SELECT_SET, dimsext, offset);
// Define memory space.
@@ -105,25 +99,26 @@ int main (void)
// Re-open the file and read the data back
// ---------------------------------------
- int rdata[10][3];
- int i,j, rank, rank_chunk;
- hsize_t chunk_dimsr[2], dimsr[2];
+ int rdata[10][3];
+ int i, j, rank, rank_chunk;
+ hsize_t chunk_dimsr[2], dimsr[2];
// Open the file and dataset.
file.openFile(FILE_NAME, H5F_ACC_RDONLY);
- dataset = new DataSet(file.openDataSet( DATASETNAME));
+ dataset = new DataSet(file.openDataSet(DATASETNAME));
// Get the dataset's dataspace and creation property list.
filespace = new DataSpace(dataset->getSpace());
- prop = dataset->getCreatePlist();
+ prop = dataset->getCreatePlist();
// Get information to obtain memory dataspace.
- rank = filespace->getSimpleExtentNdims();
+ rank = filespace->getSimpleExtentNdims();
herr_t status_n = filespace->getSimpleExtentDims(dimsr);
if (H5D_CHUNKED == prop.getLayout())
- rank_chunk = prop.getChunk(rank, chunk_dimsr);
- cout << "rank chunk = " << rank_chunk << endl;;
+ rank_chunk = prop.getChunk(rank, chunk_dimsr);
+ cout << "rank chunk = " << rank_chunk << endl;
+ ;
memspace = new DataSpace(rank, dimsr, NULL);
dataset->read(rdata, PredType::NATIVE_INT, *memspace, *filespace);
@@ -131,7 +126,7 @@ int main (void)
cout << endl;
for (j = 0; j < dimsr[0]; j++) {
for (i = 0; i < dimsr[1]; i++)
- cout << " " << rdata[j][i];
+ cout << " " << rdata[j][i];
cout << endl;
}
@@ -142,29 +137,25 @@ int main (void)
delete dataset;
file.close();
- } // end of try block
+ } // end of try block
// catch failure caused by the H5File operations
- catch(FileIException error)
- {
+ catch (FileIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSet operations
- catch(DataSetIException error)
- {
+ catch (DataSetIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSpace operations
- catch(DataSpaceIException error)
- {
+ catch (DataSpaceIException error) {
error.printErrorStack();
return -1;
}
- return 0; // successfully terminated
+ return 0; // successfully terminated
}
-
diff --git a/c++/examples/h5tutr_rdwt.cpp b/c++/examples/h5tutr_rdwt.cpp
index e9b76ad..4d265cd 100644
--- a/c++/examples/h5tutr_rdwt.cpp
+++ b/c++/examples/h5tutr_rdwt.cpp
@@ -21,53 +21,51 @@
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME("h5tutr_dset.h5");
-const H5std_string DATASET_NAME("dset");
-const int DIM0 = 4; // dataset dimensions
-const int DIM1 = 6;
+const H5std_string FILE_NAME("h5tutr_dset.h5");
+const H5std_string DATASET_NAME("dset");
+const int DIM0 = 4; // dataset dimensions
+const int DIM1 = 6;
-int main (void)
+int
+main(void)
{
// Data initialization.
int i, j;
- int data[DIM0][DIM1]; // buffer for data to write
+ int data[DIM0][DIM1]; // buffer for data to write
for (j = 0; j < DIM0; j++)
for (i = 0; i < DIM1; i++)
- data[j][i] = i * 6 + j + 1;
+ data[j][i] = i * 6 + j + 1;
// Try block to detect exceptions raised by any of the calls inside it
- try
- {
+ try {
// Turn off the auto-printing when failure occurs so that we can
// handle the errors appropriately
Exception::dontPrint();
// Open an existing file and dataset.
- H5File file(FILE_NAME, H5F_ACC_RDWR);
+ H5File file(FILE_NAME, H5F_ACC_RDWR);
DataSet dataset = file.openDataSet(DATASET_NAME);
// Write the data to the dataset using default memory space, file
// space, and transfer properties.
dataset.write(data, PredType::NATIVE_INT);
- } // end of try block
+ } // end of try block
// catch failure caused by the H5File operations
- catch(FileIException error)
- {
+ catch (FileIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSet operations
- catch(DataSetIException error)
- {
+ catch (DataSetIException error) {
error.printErrorStack();
return -1;
}
- return 0; // successfully terminated
+ return 0; // successfully terminated
}
diff --git a/c++/examples/h5tutr_subset.cpp b/c++/examples/h5tutr_subset.cpp
index f7d0513..d4b77c3 100644
--- a/c++/examples/h5tutr_subset.cpp
+++ b/c++/examples/h5tutr_subset.cpp
@@ -24,23 +24,23 @@ using std::endl;
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME("h5tutr_subset.h5");
-const H5std_string DATASET_NAME("IntArray");
+const H5std_string FILE_NAME("h5tutr_subset.h5");
+const H5std_string DATASET_NAME("IntArray");
-const int RANK = 2;
-const int DIM0_SUB = 3; // subset dimensions
-const int DIM1_SUB = 4;
-const int DIM0 = 8; // size of dataset
-const int DIM1 = 10;
+const int RANK = 2;
+const int DIM0_SUB = 3; // subset dimensions
+const int DIM1_SUB = 4;
+const int DIM0 = 8; // size of dataset
+const int DIM1 = 10;
-int main (void)
+int
+main(void)
{
- int i,j;
- int data[DIM0][DIM1], sdata[DIM0_SUB][DIM1_SUB], rdata[DIM0][DIM1];
+ int i, j;
+ int data[DIM0][DIM1], sdata[DIM0_SUB][DIM1_SUB], rdata[DIM0][DIM1];
// Try block to detect exceptions raised by any of the calls inside it
- try
- {
+ try {
// Turn off the auto-printing when failure occurs so that we can
// handle the errors appropriately
Exception::dontPrint();
@@ -54,28 +54,26 @@ int main (void)
H5File file(FILE_NAME, H5F_ACC_TRUNC);
hsize_t dims[2];
- dims[0] = DIM0;
- dims[1] = DIM1;
- DataSpace dataspace = DataSpace (RANK, dims);
-
- DataSet dataset(file.createDataSet( DATASET_NAME,
- PredType::STD_I32BE, dataspace) );
+ dims[0] = DIM0;
+ dims[1] = DIM1;
+ DataSpace dataspace = DataSpace(RANK, dims);
+ DataSet dataset(file.createDataSet(DATASET_NAME, PredType::STD_I32BE, dataspace));
for (j = 0; j < DIM0; j++) {
- for (i = 0; i < DIM1; i++)
- if (i< (DIM1/2))
+ for (i = 0; i < DIM1; i++)
+ if (i < (DIM1 / 2))
data[j][i] = 1;
- else
+ else
data[j][i] = 2;
- }
+ }
dataset.write(data, PredType::NATIVE_INT);
cout << endl << "Data Written to File:" << endl;
for (j = 0; j < DIM0; j++) {
for (i = 0; i < DIM1; i++)
- cout << " " << data[j][i];
+ cout << " " << data[j][i];
cout << endl;
}
@@ -99,8 +97,8 @@ int main (void)
offset[0] = 1;
offset[1] = 2;
- count[0] = DIM0_SUB;
- count[1] = DIM1_SUB;
+ count[0] = DIM0_SUB;
+ count[1] = DIM1_SUB;
stride[0] = 1;
stride[1] = 1;
@@ -126,17 +124,16 @@ int main (void)
cout << " offset=1x2 stride=1x1 count=3x4 block=1x1" << endl;
for (j = 0; j < DIM0_SUB; j++) {
for (i = 0; i < DIM1_SUB; i++)
- sdata[j][i] = 5;
+ sdata[j][i] = 5;
}
dataset.write(sdata, PredType::NATIVE_INT, memspace, dataspace);
dataset.read(rdata, PredType::NATIVE_INT);
-
cout << endl << "Data in File after Subset is Written:" << endl;
for (i = 0; i < DIM0; i++) {
for (j = 0; j < DIM1; j++)
- cout << " " << rdata[i][j];
+ cout << " " << rdata[i][j];
cout << endl;
}
cout << endl;
@@ -148,29 +145,25 @@ int main (void)
dataset.close();
file.close();
- } // end of try block
+ } // end of try block
// catch failure caused by the H5File operations
- catch(FileIException error)
- {
+ catch (FileIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSet operations
- catch(DataSetIException error)
- {
+ catch (DataSetIException error) {
error.printErrorStack();
return -1;
}
// catch failure caused by the DataSpace operations
- catch(DataSpaceIException error)
- {
+ catch (DataSpaceIException error) {
error.printErrorStack();
return -1;
}
- return 0; // successfully terminated
+ return 0; // successfully terminated
}
-
diff --git a/c++/examples/readdata.cpp b/c++/examples/readdata.cpp
index 3df8191..e088cce 100644
--- a/c++/examples/readdata.cpp
+++ b/c++/examples/readdata.cpp
@@ -29,184 +29,174 @@ using std::endl;
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME( "SDS.h5" );
-const H5std_string DATASET_NAME( "IntArray" );
-const int NX_SUB = 3; // hyperslab dimensions
-const int NY_SUB = 4;
-const int NX = 7; // output buffer dimensions
-const int NY = 7;
-const int NZ = 3;
-const int RANK_OUT = 3;
-
-int main (void)
+const H5std_string FILE_NAME("SDS.h5");
+const H5std_string DATASET_NAME("IntArray");
+const int NX_SUB = 3; // hyperslab dimensions
+const int NY_SUB = 4;
+const int NX = 7; // output buffer dimensions
+const int NY = 7;
+const int NZ = 3;
+const int RANK_OUT = 3;
+
+int
+main(void)
{
- /*
- * Output buffer initialization.
- */
- int i, j, k;
- int data_out[NX][NY][NZ ]; /* output buffer */
- for (j = 0; j < NX; j++)
- {
- for (i = 0; i < NY; i++)
- {
- for (k = 0; k < NZ ; k++)
- data_out[j][i][k] = 0;
- }
- }
-
- /*
- * Try block to detect exceptions raised by any of the calls inside it
- */
- try
- {
- /*
- * Turn off the auto-printing when failure occurs so that we can
- * handle the errors appropriately
- */
- Exception::dontPrint();
-
- /*
- * Open the specified file and the specified dataset in the file.
- */
- H5File file( FILE_NAME, H5F_ACC_RDONLY );
- DataSet dataset = file.openDataSet( DATASET_NAME );
-
- /*
- * Get the class of the datatype that is used by the dataset.
- */
- H5T_class_t type_class = dataset.getTypeClass();
-
- /*
- * Get class of datatype and print message if it's an integer.
- */
- if( type_class == H5T_INTEGER )
- {
- cout << "Data set has INTEGER type" << endl;
-
- /*
- * Get the integer datatype
- */
- IntType intype = dataset.getIntType();
-
- /*
- * Get order of datatype and print message if it's a little endian.
- */
- H5std_string order_string;
- H5T_order_t order = intype.getOrder( order_string );
- cout << order_string << endl;
-
- /*
- * Get size of the data element stored in file and print it.
- */
- size_t size = intype.getSize();
- cout << "Data size is " << size << endl;
- }
-
- /*
- * Get dataspace of the dataset.
- */
- DataSpace dataspace = dataset.getSpace();
-
- /*
- * Get the number of dimensions in the dataspace.
- */
- int rank = dataspace.getSimpleExtentNdims();
-
- /*
- * Get the dimension size of each dimension in the dataspace and
- * display them.
- */
- hsize_t dims_out[2];
- int ndims = dataspace.getSimpleExtentDims( dims_out, NULL);
- cout << "rank " << rank << ", dimensions " <<
- (unsigned long)(dims_out[0]) << " x " <<
- (unsigned long)(dims_out[1]) << endl;
-
- /*
- * Define hyperslab in the dataset; implicitly giving strike and
- * block NULL.
- */
- hsize_t offset[2]; // hyperslab offset in the file
- hsize_t count[2]; // size of the hyperslab in the file
- offset[0] = 1;
- offset[1] = 2;
- count[0] = NX_SUB;
- count[1] = NY_SUB;
- dataspace.selectHyperslab( H5S_SELECT_SET, count, offset );
-
- /*
- * Define the memory dataspace.
- */
- hsize_t dimsm[3]; /* memory space dimensions */
- dimsm[0] = NX;
- dimsm[1] = NY;
- dimsm[2] = NZ ;
- DataSpace memspace( RANK_OUT, dimsm );
-
- /*
- * Define memory hyperslab.
- */
- hsize_t offset_out[3]; // hyperslab offset in memory
- hsize_t count_out[3]; // size of the hyperslab in memory
- offset_out[0] = 3;
- offset_out[1] = 0;
- offset_out[2] = 0;
- count_out[0] = NX_SUB;
- count_out[1] = NY_SUB;
- count_out[2] = 1;
- memspace.selectHyperslab( H5S_SELECT_SET, count_out, offset_out );
-
- /*
- * Read data from hyperslab in the file into the hyperslab in
- * memory and display the data.
- */
- dataset.read( data_out, PredType::NATIVE_INT, memspace, dataspace );
-
- for (j = 0; j < NX; j++)
- {
- for (i = 0; i < NY; i++)
- cout << data_out[j][i][0] << " ";
- cout << endl;
- }
- /*
- * 0 0 0 0 0 0 0
- * 0 0 0 0 0 0 0
- * 0 0 0 0 0 0 0
- * 3 4 5 6 0 0 0
- * 4 5 6 7 0 0 0
- * 5 6 7 8 0 0 0
- * 0 0 0 0 0 0 0
- */
- } // end of try block
-
- // catch failure caused by the H5File operations
- catch( FileIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSet operations
- catch( DataSetIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSpace operations
- catch( DataSpaceIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- // catch failure caused by the DataSpace operations
- catch( DataTypeIException error )
- {
- error.printErrorStack();
- return -1;
- }
-
- return 0; // successfully terminated
+ /*
+ * Output buffer initialization.
+ */
+ int i, j, k;
+ int data_out[NX][NY][NZ]; /* output buffer */
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++) {
+ for (k = 0; k < NZ; k++)
+ data_out[j][i][k] = 0;
+ }
+ }
+
+ /*
+ * Try block to detect exceptions raised by any of the calls inside it
+ */
+ try {
+ /*
+ * Turn off the auto-printing when failure occurs so that we can
+ * handle the errors appropriately
+ */
+ Exception::dontPrint();
+
+ /*
+ * Open the specified file and the specified dataset in the file.
+ */
+ H5File file(FILE_NAME, H5F_ACC_RDONLY);
+ DataSet dataset = file.openDataSet(DATASET_NAME);
+
+ /*
+ * Get the class of the datatype that is used by the dataset.
+ */
+ H5T_class_t type_class = dataset.getTypeClass();
+
+ /*
+ * Get class of datatype and print message if it's an integer.
+ */
+ if (type_class == H5T_INTEGER) {
+ cout << "Data set has INTEGER type" << endl;
+
+ /*
+ * Get the integer datatype
+ */
+ IntType intype = dataset.getIntType();
+
+ /*
+ * Get order of datatype and print message if it's a little endian.
+ */
+ H5std_string order_string;
+ H5T_order_t order = intype.getOrder(order_string);
+ cout << order_string << endl;
+
+ /*
+ * Get size of the data element stored in file and print it.
+ */
+ size_t size = intype.getSize();
+ cout << "Data size is " << size << endl;
+ }
+
+ /*
+ * Get dataspace of the dataset.
+ */
+ DataSpace dataspace = dataset.getSpace();
+
+ /*
+ * Get the number of dimensions in the dataspace.
+ */
+ int rank = dataspace.getSimpleExtentNdims();
+
+ /*
+ * Get the dimension size of each dimension in the dataspace and
+ * display them.
+ */
+ hsize_t dims_out[2];
+ int ndims = dataspace.getSimpleExtentDims(dims_out, NULL);
+ cout << "rank " << rank << ", dimensions " << (unsigned long)(dims_out[0]) << " x "
+ << (unsigned long)(dims_out[1]) << endl;
+
+ /*
+ * Define hyperslab in the dataset; implicitly giving strike and
+ * block NULL.
+ */
+ hsize_t offset[2]; // hyperslab offset in the file
+ hsize_t count[2]; // size of the hyperslab in the file
+ offset[0] = 1;
+ offset[1] = 2;
+ count[0] = NX_SUB;
+ count[1] = NY_SUB;
+ dataspace.selectHyperslab(H5S_SELECT_SET, count, offset);
+
+ /*
+ * Define the memory dataspace.
+ */
+ hsize_t dimsm[3]; /* memory space dimensions */
+ dimsm[0] = NX;
+ dimsm[1] = NY;
+ dimsm[2] = NZ;
+ DataSpace memspace(RANK_OUT, dimsm);
+
+ /*
+ * Define memory hyperslab.
+ */
+ hsize_t offset_out[3]; // hyperslab offset in memory
+ hsize_t count_out[3]; // size of the hyperslab in memory
+ offset_out[0] = 3;
+ offset_out[1] = 0;
+ offset_out[2] = 0;
+ count_out[0] = NX_SUB;
+ count_out[1] = NY_SUB;
+ count_out[2] = 1;
+ memspace.selectHyperslab(H5S_SELECT_SET, count_out, offset_out);
+
+ /*
+ * Read data from hyperslab in the file into the hyperslab in
+ * memory and display the data.
+ */
+ dataset.read(data_out, PredType::NATIVE_INT, memspace, dataspace);
+
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++)
+ cout << data_out[j][i][0] << " ";
+ cout << endl;
+ }
+ /*
+ * 0 0 0 0 0 0 0
+ * 0 0 0 0 0 0 0
+ * 0 0 0 0 0 0 0
+ * 3 4 5 6 0 0 0
+ * 4 5 6 7 0 0 0
+ * 5 6 7 8 0 0 0
+ * 0 0 0 0 0 0 0
+ */
+ } // end of try block
+
+ // catch failure caused by the H5File operations
+ catch (FileIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSet operations
+ catch (DataSetIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSpace operations
+ catch (DataSpaceIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ // catch failure caused by the DataSpace operations
+ catch (DataTypeIException error) {
+ error.printErrorStack();
+ return -1;
+ }
+
+ return 0; // successfully terminated
}
-
diff --git a/c++/examples/writedata.cpp b/c++/examples/writedata.cpp
index eada2ed..61cd43a 100644
--- a/c++/examples/writedata.cpp
+++ b/c++/examples/writedata.cpp
@@ -32,31 +32,31 @@ using std::endl;
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME( "Select.h5" );
-const H5std_string DATASET_NAME( "Matrix in file" );
-const int MSPACE1_RANK = 1; // Rank of the first dataset in memory
-const int MSPACE1_DIM = 50; // Dataset size in memory
-const int MSPACE2_RANK = 1; // Rank of the second dataset in memory
-const int MSPACE2_DIM = 4; // Dataset size in memory
-const int FSPACE_RANK = 2; // Dataset rank as it is stored in the file
-const int FSPACE_DIM1 = 8; // Dimension sizes of the dataset as it is
-const int FSPACE_DIM2 = 12; // stored in the file
-const int MSPACE_RANK = 2; // Rank of the first dataset in memory
-const int MSPACE_DIM1 = 8; // We will read dataset back from the file
-const int MSPACE_DIM2 = 9; // to the dataset in memory with these
- // dataspace parameters
-const int NPOINTS = 4; // Number of points that will be selected
- // and overwritten
-
-int main (void)
+const H5std_string FILE_NAME("Select.h5");
+const H5std_string DATASET_NAME("Matrix in file");
+const int MSPACE1_RANK = 1; // Rank of the first dataset in memory
+const int MSPACE1_DIM = 50; // Dataset size in memory
+const int MSPACE2_RANK = 1; // Rank of the second dataset in memory
+const int MSPACE2_DIM = 4; // Dataset size in memory
+const int FSPACE_RANK = 2; // Dataset rank as it is stored in the file
+const int FSPACE_DIM1 = 8; // Dimension sizes of the dataset as it is
+const int FSPACE_DIM2 = 12; // stored in the file
+const int MSPACE_RANK = 2; // Rank of the first dataset in memory
+const int MSPACE_DIM1 = 8; // We will read dataset back from the file
+const int MSPACE_DIM2 = 9; // to the dataset in memory with these
+ // dataspace parameters
+const int NPOINTS = 4; // Number of points that will be selected
+ // and overwritten
+
+int
+main(void)
{
- int i,j; // loop indices */
+ int i, j; // loop indices */
/*
* Try block to detect exceptions raised by any of the calls inside it
*/
- try
- {
+ try {
/*
* Turn off the auto-printing when failure occurs so that we can
* handle the errors appropriately
@@ -66,47 +66,51 @@ int main (void)
/*
* Create a file.
*/
- H5File* file = new H5File( FILE_NAME, H5F_ACC_TRUNC );
+ H5File *file = new H5File(FILE_NAME, H5F_ACC_TRUNC);
/*
- * Create property list for a dataset and set up fill values.
- */
- int fillvalue = 0; /* Fill value for the dataset */
+ * Create property list for a dataset and set up fill values.
+ */
+ int fillvalue = 0; /* Fill value for the dataset */
DSetCreatPropList plist;
plist.setFillValue(PredType::NATIVE_INT, &fillvalue);
/*
* Create dataspace for the dataset in the file.
*/
- hsize_t fdim[] = {FSPACE_DIM1, FSPACE_DIM2}; // dim sizes of ds (on disk)
- DataSpace fspace( FSPACE_RANK, fdim );
+ hsize_t fdim[] = {FSPACE_DIM1, FSPACE_DIM2}; // dim sizes of ds (on disk)
+ DataSpace fspace(FSPACE_RANK, fdim);
/*
* Create dataset and write it into the file.
*/
- DataSet* dataset = new DataSet(file->createDataSet(
- DATASET_NAME, PredType::NATIVE_INT, fspace, plist));
+ DataSet *dataset =
+ new DataSet(file->createDataSet(DATASET_NAME, PredType::NATIVE_INT, fspace, plist));
/*
* Select hyperslab for the dataset in the file, using 3x2 blocks,
* (4,3) stride and (2,4) count starting at the position (0,1).
*/
- hsize_t start[2]; // Start of hyperslab
+ hsize_t start[2]; // Start of hyperslab
hsize_t stride[2]; // Stride of hyperslab
hsize_t count[2]; // Block count
hsize_t block[2]; // Block sizes
- start[0] = 0; start[1] = 1;
- stride[0] = 4; stride[1] = 3;
- count[0] = 2; count[1] = 4;
- block[0] = 3; block[1] = 2;
- fspace.selectHyperslab( H5S_SELECT_SET, count, start, stride, block);
+ start[0] = 0;
+ start[1] = 1;
+ stride[0] = 4;
+ stride[1] = 3;
+ count[0] = 2;
+ count[1] = 4;
+ block[0] = 3;
+ block[1] = 2;
+ fspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block);
/*
* Create dataspace for the first dataset.
*/
- hsize_t dim1[] = {MSPACE1_DIM}; /* Dimension size of the first dataset
- (in memory) */
- DataSpace mspace1( MSPACE1_RANK, dim1 );
+ hsize_t dim1[] = {MSPACE1_DIM}; /* Dimension size of the first dataset
+ (in memory) */
+ DataSpace mspace1(MSPACE1_RANK, dim1);
/*
* Select hyperslab.
@@ -117,7 +121,7 @@ int main (void)
stride[0] = 1;
count[0] = 48;
block[0] = 1;
- mspace1.selectHyperslab( H5S_SELECT_SET, count, start, stride, block);
+ mspace1.selectHyperslab(H5S_SELECT_SET, count, start, stride, block);
/*
* Write selection from the vector buffer to the dataset in the file.
@@ -132,7 +136,7 @@ int main (void)
* 0 41 42 0 43 44 0 45 46 0 47 48
* 0 0 0 0 0 0 0 0 0 0 0 0
*/
- int vector[MSPACE1_DIM]; // vector buffer for dset
+ int vector[MSPACE1_DIM]; // vector buffer for dset
/*
* Buffer initialization.
@@ -141,7 +145,7 @@ int main (void)
for (i = 1; i < MSPACE1_DIM - 1; i++)
vector[i] = i;
- dataset->write( vector, PredType::NATIVE_INT, mspace1, fspace );
+ dataset->write(vector, PredType::NATIVE_INT, mspace1, fspace);
/*
* Reset the selection for the file dataspace fid.
@@ -151,27 +155,31 @@ int main (void)
/*
* Create dataspace for the second dataset.
*/
- hsize_t dim2[] = {MSPACE2_DIM}; /* Dimension size of the second dataset
- (in memory */
- DataSpace mspace2( MSPACE2_RANK, dim2 );
+ hsize_t dim2[] = {MSPACE2_DIM}; /* Dimension size of the second dataset
+ (in memory */
+ DataSpace mspace2(MSPACE2_RANK, dim2);
/*
* Select sequence of NPOINTS points in the file dataspace.
*/
hsize_t coord[NPOINTS][FSPACE_RANK]; /* Array to store selected points
from the file dataspace */
- coord[0][0] = 0; coord[0][1] = 0;
- coord[1][0] = 3; coord[1][1] = 3;
- coord[2][0] = 3; coord[2][1] = 5;
- coord[3][0] = 5; coord[3][1] = 6;
+ coord[0][0] = 0;
+ coord[0][1] = 0;
+ coord[1][0] = 3;
+ coord[1][1] = 3;
+ coord[2][0] = 3;
+ coord[2][1] = 5;
+ coord[3][0] = 5;
+ coord[3][1] = 6;
- fspace.selectElements( H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord);
+ fspace.selectElements(H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord);
/*
* Write new selection of points to the dataset.
*/
- int values[] = {53, 59, 61, 67}; /* New values to be written */
- dataset->write( values, PredType::NATIVE_INT, mspace2, fspace );
+ int values[] = {53, 59, 61, 67}; /* New values to be written */
+ dataset->write(values, PredType::NATIVE_INT, mspace2, fspace);
/*
* File dataset should look like this:
@@ -195,12 +203,12 @@ int main (void)
/*
* Open the file.
*/
- file = new H5File( FILE_NAME, H5F_ACC_RDONLY );
+ file = new H5File(FILE_NAME, H5F_ACC_RDONLY);
/*
* Open the dataset.
*/
- dataset = new DataSet( file->openDataSet( DATASET_NAME ));
+ dataset = new DataSet(file->openDataSet(DATASET_NAME));
/*
* Get dataspace of the dataset.
@@ -215,10 +223,14 @@ int main (void)
* 0 59 0 61
*
*/
- start[0] = 1; start[1] = 2;
- block[0] = 1; block[1] = 1;
- stride[0] = 1; stride[1] = 1;
- count[0] = 3; count[1] = 4;
+ start[0] = 1;
+ start[1] = 2;
+ block[0] = 1;
+ block[1] = 1;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 3;
+ count[1] = 4;
fspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block);
/*
@@ -234,10 +246,14 @@ int main (void)
* 19 20
* 0 61
*/
- start[0] = 2; start[1] = 4;
- block[0] = 1; block[1] = 1;
- stride[0] = 1; stride[1] = 1;
- count[0] = 6; count[1] = 5;
+ start[0] = 2;
+ start[1] = 4;
+ block[0] = 1;
+ block[1] = 1;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 6;
+ count[1] = 5;
fspace.selectHyperslab(H5S_SELECT_OR, count, start, stride, block);
/*
@@ -253,15 +269,23 @@ int main (void)
* Select two hyperslabs in memory. Hyperslabs has the same
* size and shape as the selected hyperslabs for the file dataspace.
*/
- start[0] = 0; start[1] = 0;
- block[0] = 1; block[1] = 1;
- stride[0] = 1; stride[1] = 1;
- count[0] = 3; count[1] = 4;
+ start[0] = 0;
+ start[1] = 0;
+ block[0] = 1;
+ block[1] = 1;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 3;
+ count[1] = 4;
mspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block);
- start[0] = 1; start[1] = 2;
- block[0] = 1; block[1] = 1;
- stride[0] = 1; stride[1] = 1;
- count[0] = 6; count[1] = 5;
+ start[0] = 1;
+ start[1] = 2;
+ block[0] = 1;
+ block[1] = 1;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 6;
+ count[1] = 5;
mspace.selectHyperslab(H5S_SELECT_OR, count, start, stride, block);
/*
@@ -289,9 +313,8 @@ int main (void)
* 0 0 0 0 0 0 0 0 0
* 0 0 0 0 0 0 0 0 0
*/
- for (i=0; i < MSPACE_DIM1; i++)
- {
- for(j=0; j < MSPACE_DIM2; j++)
+ for (i = 0; i < MSPACE_DIM1; i++) {
+ for (j = 0; j < MSPACE_DIM2; j++)
cout << matrix_out[i][j] << " ";
cout << endl;
}
@@ -301,28 +324,25 @@ int main (void)
*/
delete dataset;
delete file;
- } // end of try block
+ } // end of try block
- // catch failure caused by the H5File operations
- catch( FileIException error )
- {
+ // catch failure caused by the H5File operations
+ catch (FileIException error) {
error.printErrorStack();
return -1;
- }
+ }
- // catch failure caused by the DataSet operations
- catch( DataSetIException error )
- {
+ // catch failure caused by the DataSet operations
+ catch (DataSetIException error) {
error.printErrorStack();
return -1;
- }
+ }
- // catch failure caused by the DataSpace operations
- catch( DataSpaceIException error )
- {
+ // catch failure caused by the DataSpace operations
+ catch (DataSpaceIException error) {
error.printErrorStack();
return -1;
- }
+ }
- return 0;
+ return 0;
}
diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp
index d59a3cb..da06f05 100644
--- a/c++/src/H5AbstractDs.cpp
+++ b/c++/src/H5AbstractDs.cpp
@@ -38,7 +38,7 @@ namespace H5 {
///\brief Default constructor
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-AbstractDs::AbstractDs(){}
+AbstractDs::AbstractDs() {}
//--------------------------------------------------------------------------
// Function: AbstractDs default constructor
@@ -61,19 +61,20 @@ AbstractDs::AbstractDs(){}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5T_class_t AbstractDs::getTypeClass() const
+H5T_class_t
+AbstractDs::getTypeClass() const
{
// Gets the datatype used by this dataset or attribute.
// p_get_type calls either H5Dget_type or H5Aget_type depending on
// which object invokes getTypeClass
hid_t datatype_id;
try {
- datatype_id = p_get_type(); // returned value is already validated
+ datatype_id = p_get_type(); // returned value is already validated
}
- catch (DataSetIException& E) {
+ catch (DataSetIException &E) {
throw DataTypeIException("DataSet::getTypeClass", E.getDetailMsg());
}
- catch (AttributeIException& E) {
+ catch (AttributeIException &E) {
throw DataTypeIException("Attribute::getTypeClass", E.getDetailMsg());
}
@@ -82,8 +83,7 @@ H5T_class_t AbstractDs::getTypeClass() const
// Close temporary datatype_id
herr_t ret_value = H5Tclose(datatype_id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
if (fromClass() == "DataSet")
throw DataTypeIException("DataSet::getTypeClass", "H5Tclose failed");
else if (fromClass() == "Attribute")
@@ -91,14 +91,13 @@ H5T_class_t AbstractDs::getTypeClass() const
}
// Check on the returned type_class
- if (type_class == H5T_NO_CLASS)
- {
+ if (type_class == H5T_NO_CLASS) {
if (fromClass() == "DataSet")
throw DataTypeIException("DataSet::getTypeClass", "H5Tget_class returns H5T_NO_CLASS");
else if (fromClass() == "Attribute")
throw DataTypeIException("Attribute::getTypeClass", "H5Tget_class returns H5T_NO_CLASS");
}
- return(type_class);
+ return (type_class);
}
//--------------------------------------------------------------------------
@@ -109,7 +108,8 @@ H5T_class_t AbstractDs::getTypeClass() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataType AbstractDs::getDataType() const
+DataType
+AbstractDs::getDataType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
@@ -118,12 +118,12 @@ DataType AbstractDs::getDataType() const
try {
DataType datatype;
f_DataType_setId(&datatype, p_get_type());
- return(datatype);
+ return (datatype);
}
- catch (DataSetIException& E) {
+ catch (DataSetIException &E) {
throw DataTypeIException("DataSet::getDataType", E.getDetailMsg());
}
- catch (AttributeIException& E) {
+ catch (AttributeIException &E) {
throw DataTypeIException("Attribute::getDataType", E.getDetailMsg());
}
}
@@ -136,7 +136,8 @@ DataType AbstractDs::getDataType() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-ArrayType AbstractDs::getArrayType() const
+ArrayType
+AbstractDs::getArrayType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
@@ -147,12 +148,12 @@ ArrayType AbstractDs::getArrayType() const
// problem described in the JIRA issue HDFFV-7947
ArrayType arraytype;
f_DataType_setId(&arraytype, p_get_type());
- return(arraytype);
+ return (arraytype);
}
- catch (DataSetIException& E) {
+ catch (DataSetIException &E) {
throw DataTypeIException("DataSet::getArrayType", E.getDetailMsg());
}
- catch (AttributeIException& E) {
+ catch (AttributeIException &E) {
throw DataTypeIException("Attribute::getArrayType", E.getDetailMsg());
}
}
@@ -165,7 +166,8 @@ ArrayType AbstractDs::getArrayType() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-CompType AbstractDs::getCompType() const
+CompType
+AbstractDs::getCompType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
@@ -174,12 +176,12 @@ CompType AbstractDs::getCompType() const
try {
CompType comptype;
f_DataType_setId(&comptype, p_get_type());
- return(comptype);
+ return (comptype);
}
- catch (DataSetIException& E) {
+ catch (DataSetIException &E) {
throw DataTypeIException("DataSet::getCompType", E.getDetailMsg());
}
- catch (AttributeIException& E) {
+ catch (AttributeIException &E) {
throw DataTypeIException("Attribute::getCompType", E.getDetailMsg());
}
}
@@ -192,7 +194,8 @@ CompType AbstractDs::getCompType() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType AbstractDs::getEnumType() const
+EnumType
+AbstractDs::getEnumType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
@@ -201,12 +204,12 @@ EnumType AbstractDs::getEnumType() const
try {
EnumType enumtype;
f_DataType_setId(&enumtype, p_get_type());
- return(enumtype);
+ return (enumtype);
}
- catch (DataSetIException& E) {
+ catch (DataSetIException &E) {
throw DataTypeIException("DataSet::getEnumType", E.getDetailMsg());
}
- catch (AttributeIException& E) {
+ catch (AttributeIException &E) {
throw DataTypeIException("Attribute::getEnumType", E.getDetailMsg());
}
}
@@ -219,7 +222,8 @@ EnumType AbstractDs::getEnumType() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType AbstractDs::getIntType() const
+IntType
+AbstractDs::getIntType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
@@ -228,12 +232,12 @@ IntType AbstractDs::getIntType() const
try {
IntType inttype;
f_DataType_setId(&inttype, p_get_type());
- return(inttype);
+ return (inttype);
}
- catch (DataSetIException& E) {
+ catch (DataSetIException &E) {
throw DataTypeIException("DataSet::getIntType", E.getDetailMsg());
}
- catch (AttributeIException& E) {
+ catch (AttributeIException &E) {
throw DataTypeIException("Attribute::getIntType", E.getDetailMsg());
}
}
@@ -246,7 +250,8 @@ IntType AbstractDs::getIntType() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType AbstractDs::getFloatType() const
+FloatType
+AbstractDs::getFloatType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
@@ -255,12 +260,12 @@ FloatType AbstractDs::getFloatType() const
try {
FloatType floatype;
f_DataType_setId(&floatype, p_get_type());
- return(floatype);
+ return (floatype);
}
- catch (DataSetIException& E) {
+ catch (DataSetIException &E) {
throw DataTypeIException("DataSet::getFloatType", E.getDetailMsg());
}
- catch (AttributeIException& E) {
+ catch (AttributeIException &E) {
throw DataTypeIException("Attribute::getFloatType", E.getDetailMsg());
}
}
@@ -273,7 +278,8 @@ FloatType AbstractDs::getFloatType() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType AbstractDs::getStrType() const
+StrType
+AbstractDs::getStrType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
@@ -282,12 +288,12 @@ StrType AbstractDs::getStrType() const
try {
StrType strtype;
f_DataType_setId(&strtype, p_get_type());
- return(strtype);
+ return (strtype);
}
- catch (DataSetIException& E) {
+ catch (DataSetIException &E) {
throw DataTypeIException("DataSet::getStrType", E.getDetailMsg());
}
- catch (AttributeIException& E) {
+ catch (AttributeIException &E) {
throw DataTypeIException("Attribute::getStrType", E.getDetailMsg());
}
}
@@ -300,7 +306,8 @@ StrType AbstractDs::getStrType() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-VarLenType AbstractDs::getVarLenType() const
+VarLenType
+AbstractDs::getVarLenType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
@@ -309,12 +316,12 @@ VarLenType AbstractDs::getVarLenType() const
try {
VarLenType varlentype;
f_DataType_setId(&varlentype, p_get_type());
- return(varlentype);
+ return (varlentype);
}
- catch (DataSetIException& E) {
+ catch (DataSetIException &E) {
throw DataTypeIException("DataSet::getVarLenType", E.getDetailMsg());
}
- catch (AttributeIException& E) {
+ catch (AttributeIException &E) {
throw DataTypeIException("Attribute::getVarLenType", E.getDetailMsg());
}
}
@@ -326,4 +333,4 @@ VarLenType AbstractDs::getVarLenType() const
//--------------------------------------------------------------------------
AbstractDs::~AbstractDs() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h
index 399e033..0c66845 100644
--- a/c++/src/H5AbstractDs.h
+++ b/c++/src/H5AbstractDs.h
@@ -34,49 +34,49 @@ class DataSpace;
and DataSet.
*/
class H5_DLLCPP AbstractDs {
- public:
- // Gets a copy the datatype of that this abstract dataset uses.
- // Note that this datatype is a generic one and can only be accessed
- // via generic member functions, i.e., member functions belong
- // to DataType. To get specific datatype, i.e. EnumType, FloatType,
- // etc..., use the specific functions, that follow, instead.
- DataType getDataType() const;
-
- // Gets a copy of the specific datatype of this abstract dataset.
- ArrayType getArrayType() const;
- CompType getCompType() const;
- EnumType getEnumType() const;
- IntType getIntType() const;
- FloatType getFloatType() const;
- StrType getStrType() const;
- VarLenType getVarLenType() const;
-
- ///\brief Gets the size in memory of this abstract dataset.
- virtual size_t getInMemDataSize() const = 0;
-
- ///\brief Gets the dataspace of this abstract dataset - pure virtual.
- virtual DataSpace getSpace() const = 0;
-
- // Gets the class of the datatype that is used by this abstract
- // dataset.
- H5T_class_t getTypeClass() const;
-
- ///\brief Returns the amount of storage size required - pure virtual.
- virtual hsize_t getStorageSize() const = 0;
-
- // Returns this class name - pure virtual.
- virtual H5std_string fromClass() const = 0;
-
- // Destructor
- virtual ~AbstractDs();
-
- protected:
- // Default constructor
- AbstractDs();
-
- private:
- // This member function is implemented by DataSet and Attribute - pure virtual.
- virtual hid_t p_get_type() const = 0;
+ public:
+ // Gets a copy the datatype of that this abstract dataset uses.
+ // Note that this datatype is a generic one and can only be accessed
+ // via generic member functions, i.e., member functions belong
+ // to DataType. To get specific datatype, i.e. EnumType, FloatType,
+ // etc..., use the specific functions, that follow, instead.
+ DataType getDataType() const;
+
+ // Gets a copy of the specific datatype of this abstract dataset.
+ ArrayType getArrayType() const;
+ CompType getCompType() const;
+ EnumType getEnumType() const;
+ IntType getIntType() const;
+ FloatType getFloatType() const;
+ StrType getStrType() const;
+ VarLenType getVarLenType() const;
+
+ ///\brief Gets the size in memory of this abstract dataset.
+ virtual size_t getInMemDataSize() const = 0;
+
+ ///\brief Gets the dataspace of this abstract dataset - pure virtual.
+ virtual DataSpace getSpace() const = 0;
+
+ // Gets the class of the datatype that is used by this abstract
+ // dataset.
+ H5T_class_t getTypeClass() const;
+
+ ///\brief Returns the amount of storage size required - pure virtual.
+ virtual hsize_t getStorageSize() const = 0;
+
+ // Returns this class name - pure virtual.
+ virtual H5std_string fromClass() const = 0;
+
+ // Destructor
+ virtual ~AbstractDs();
+
+ protected:
+ // Default constructor
+ AbstractDs();
+
+ private:
+ // This member function is implemented by DataSet and Attribute - pure virtual.
+ virtual hid_t p_get_type() const = 0;
}; // end of AbstractDs
} // namespace H5
diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp
index 0dab8ef..877be13 100644
--- a/c++/src/H5ArrayType.cpp
+++ b/c++/src/H5ArrayType.cpp
@@ -50,7 +50,7 @@ ArrayType::ArrayType(const hid_t existing_id) : DataType(existing_id) {}
///\brief Copy constructor: same HDF5 object as \a original
// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
-ArrayType::ArrayType(const ArrayType& original) : DataType(original) {}
+ArrayType::ArrayType(const ArrayType &original) : DataType(original) {}
//--------------------------------------------------------------------------
// Function: ArrayType overloaded constructor
@@ -62,7 +62,7 @@ ArrayType::ArrayType(const ArrayType& original) : DataType(original) {}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
-ArrayType::ArrayType(const DataType& base_type, int ndims, const hsize_t* dims) : DataType()
+ArrayType::ArrayType(const DataType &base_type, int ndims, const hsize_t *dims) : DataType()
{
// Call C API to create an array data type
hid_t new_type_id = H5Tarray_create2(base_type.getId(), ndims, dims);
@@ -87,7 +87,7 @@ ArrayType::ArrayType(const DataType& base_type, int ndims, const hsize_t* dims)
// improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-ArrayType::ArrayType(const H5Location& loc, const char *dtype_name) : DataType()
+ArrayType::ArrayType(const H5Location &loc, const char *dtype_name) : DataType()
{
id = p_opentype(loc, dtype_name);
}
@@ -106,7 +106,7 @@ ArrayType::ArrayType(const H5Location& loc, const char *dtype_name) : DataType()
// to improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-ArrayType::ArrayType(const H5Location& loc, const H5std_string& dtype_name) : DataType()
+ArrayType::ArrayType(const H5Location &loc, const H5std_string &dtype_name) : DataType()
{
id = p_opentype(loc, dtype_name.c_str());
}
@@ -122,21 +122,21 @@ ArrayType::ArrayType(const H5Location& loc, const H5std_string& dtype_name) : Da
// each data member from the rhs object. (Issue HDFFV-9562)
// Programmer Binh-Minh Ribler - Mar 2016
//--------------------------------------------------------------------------
-ArrayType& ArrayType::operator=(const ArrayType& rhs)
+ArrayType &
+ArrayType::operator=(const ArrayType &rhs)
{
- if (this != &rhs)
- {
+ if (this != &rhs) {
// handling references to this id
try {
setId(rhs.id);
// Note: a = b, so there are two objects with the same hdf5 id
// that's why incRefCount is needed, and it is called by setId
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw DataTypeIException(inMemFunc("operator="), close_error.getDetailMsg());
}
}
- return(*this);
+ return (*this);
}
//--------------------------------------------------------------------------
@@ -147,7 +147,8 @@ ArrayType& ArrayType::operator=(const ArrayType& rhs)
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-DataType* ArrayType::decode() const
+DataType *
+ArrayType::decode() const
{
hid_t encoded_arrtype_id = H5I_INVALID_HID;
try {
@@ -158,7 +159,7 @@ DataType* ArrayType::decode() const
}
ArrayType *encoded_arrtype = new ArrayType;
encoded_arrtype->p_setId(encoded_arrtype_id);
- return(encoded_arrtype);
+ return (encoded_arrtype);
}
//--------------------------------------------------------------------------
@@ -168,16 +169,16 @@ DataType* ArrayType::decode() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
-int ArrayType::getArrayNDims() const
+int
+ArrayType::getArrayNDims() const
{
// Get the rank of the array type specified by id from the C API
int ndims = H5Tget_array_ndims(id);
- if (ndims < 0)
- {
+ if (ndims < 0) {
throw DataTypeIException("ArrayType::getArrayNDims", "H5Tget_array_ndims failed");
}
- return(ndims);
+ return (ndims);
}
//--------------------------------------------------------------------------
@@ -188,7 +189,8 @@ int ArrayType::getArrayNDims() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
-int ArrayType::getArrayDims(hsize_t* dims) const
+int
+ArrayType::getArrayDims(hsize_t *dims) const
{
// Get the dimensions
int ndims = H5Tget_array_dims2(id, dims);
@@ -196,7 +198,7 @@ int ArrayType::getArrayDims(hsize_t* dims) const
throw DataTypeIException("ArrayType::getArrayDims", "H5Tget_array_dims2 failed");
// Return the number of dimensions
- return(ndims);
+ return (ndims);
}
//--------------------------------------------------------------------------
@@ -206,4 +208,4 @@ int ArrayType::getArrayDims(hsize_t* dims) const
//--------------------------------------------------------------------------
ArrayType::~ArrayType() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h
index d99b936..09f1592 100644
--- a/c++/src/H5ArrayType.h
+++ b/c++/src/H5ArrayType.h
@@ -23,44 +23,48 @@ namespace H5 {
*/
// Inheritance: DataType -> H5Object -> H5Location -> IdComponent
class H5_DLLCPP ArrayType : public DataType {
- public:
- // Constructor that creates a new array data type based on the
- // specified base type.
- ArrayType(const DataType& base_type, int ndims, const hsize_t* dims);
+ public:
+ // Constructor that creates a new array data type based on the
+ // specified base type.
+ ArrayType(const DataType &base_type, int ndims, const hsize_t *dims);
- // Assignment operator
- ArrayType& operator=(const ArrayType& rhs);
+ // Assignment operator
+ ArrayType &operator=(const ArrayType &rhs);
- // Constructors that open an array datatype, given a location.
- ArrayType(const H5Location& loc, const char* name);
- ArrayType(const H5Location& loc, const H5std_string& name);
+ // Constructors that open an array datatype, given a location.
+ ArrayType(const H5Location &loc, const char *name);
+ ArrayType(const H5Location &loc, const H5std_string &name);
- // Returns an ArrayType object via DataType* by decoding the
- // binary object description of this type.
- virtual DataType* decode() const;
+ // Returns an ArrayType object via DataType* by decoding the
+ // binary object description of this type.
+ virtual DataType *decode() const;
- // Returns the number of dimensions of this array datatype.
- int getArrayNDims() const;
- //int getArrayNDims(); // removed 1.8.18 and 1.10.1
+ // Returns the number of dimensions of this array datatype.
+ int getArrayNDims() const;
+ // int getArrayNDims(); // removed 1.8.18 and 1.10.1
- // Returns the sizes of dimensions of this array datatype.
- int getArrayDims(hsize_t* dims) const;
- //int getArrayDims(hsize_t* dims); // removed 1.8.18 and 1.10.1
+ // Returns the sizes of dimensions of this array datatype.
+ int getArrayDims(hsize_t *dims) const;
+ // int getArrayDims(hsize_t* dims); // removed 1.8.18 and 1.10.1
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("ArrayType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("ArrayType");
+ }
- // Copy constructor: same as the original ArrayType.
- ArrayType(const ArrayType& original);
+ // Copy constructor: same as the original ArrayType.
+ ArrayType(const ArrayType &original);
- // Constructor that takes an existing id
- ArrayType(const hid_t existing_id);
+ // Constructor that takes an existing id
+ ArrayType(const hid_t existing_id);
- // Noop destructor
- virtual ~ArrayType();
+ // Noop destructor
+ virtual ~ArrayType();
- // Default constructor
- ArrayType();
+ // Default constructor
+ ArrayType();
}; // end of ArrayType
} // namespace H5
diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp
index 9408452..abebc3b 100644
--- a/c++/src/H5AtomType.cpp
+++ b/c++/src/H5AtomType.cpp
@@ -51,7 +51,7 @@ AtomType::AtomType(const hid_t existing_id) : DataType(existing_id) {}
///\brief Copy constructor: same HDF5 object as \a original
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-AtomType::AtomType(const AtomType& original) : DataType(original) {}
+AtomType::AtomType(const AtomType &original) : DataType(original) {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
@@ -61,12 +61,12 @@ AtomType::AtomType(const AtomType& original) : DataType(original) {}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void AtomType::setSize(size_t size) const
+void
+AtomType::setSize(size_t size) const
{
// Call C routine H5Tset_size to set the total size
herr_t ret_value = H5Tset_size(id, size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("setSize"), "H5Tset_size failed");
}
}
@@ -81,18 +81,17 @@ void AtomType::setSize(size_t size) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
-H5T_order_t AtomType::getOrder() const
+H5T_order_t
+AtomType::getOrder() const
{
// Call C routine to get the byte ordering
H5T_order_t type_order = H5Tget_order(id);
// return a byte order constant if successful
- if (type_order == H5T_ORDER_ERROR)
- {
- throw DataTypeIException(inMemFunc("getOrder"),
- "H5Tget_order returns H5T_ORDER_ERROR");
+ if (type_order == H5T_ORDER_ERROR) {
+ throw DataTypeIException(inMemFunc("getOrder"), "H5Tget_order returns H5T_ORDER_ERROR");
}
- return(type_order);
+ return (type_order);
}
//--------------------------------------------------------------------------
@@ -112,7 +111,8 @@ H5T_order_t AtomType::getOrder() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5T_order_t AtomType::getOrder(H5std_string& order_string) const
+H5T_order_t
+AtomType::getOrder(H5std_string &order_string) const
{
// Call the overloaded to get the type order without text
H5T_order_t type_order = getOrder();
@@ -124,7 +124,7 @@ H5T_order_t AtomType::getOrder(H5std_string& order_string) const
order_string = "Big endian byte ordering (1)";
else if (type_order == H5T_ORDER_VAX)
order_string = "VAX mixed byte ordering (2)";
- return(type_order);
+ return (type_order);
}
//--------------------------------------------------------------------------
@@ -137,12 +137,12 @@ H5T_order_t AtomType::getOrder(H5std_string& order_string) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void AtomType::setOrder(H5T_order_t order) const
+void
+AtomType::setOrder(H5T_order_t order) const
{
// Call C routine to set the byte ordering
herr_t ret_value = H5Tset_order(id, order);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("setOrder"), "H5Tset_order failed");
}
}
@@ -158,17 +158,17 @@ void AtomType::setOrder(H5T_order_t order) const
/// value returned by \c DataType::getSize().
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-size_t AtomType::getPrecision() const
+size_t
+AtomType::getPrecision() const
{
- size_t num_signi_bits = H5Tget_precision(id); // C routine
+ size_t num_signi_bits = H5Tget_precision(id); // C routine
// returns number of significant bits if successful
- if (num_signi_bits == 0)
- {
+ if (num_signi_bits == 0) {
throw DataTypeIException(inMemFunc("getPrecision"),
- "H5Tget_precision returns invalid number of significant bits");
+ "H5Tget_precision returns invalid number of significant bits");
}
- return(num_signi_bits);
+ return (num_signi_bits);
}
//--------------------------------------------------------------------------
@@ -181,12 +181,12 @@ size_t AtomType::getPrecision() const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void AtomType::setPrecision(size_t precision) const
+void
+AtomType::setPrecision(size_t precision) const
{
// Call C routine to set the datatype precision
herr_t ret_value = H5Tset_precision(id, precision);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("setPrecision"), "H5Tset_precision failed");
}
}
@@ -205,17 +205,16 @@ void AtomType::setPrecision(size_t precision) const
// - return type changed from size_t to int
// - offset = -1 when failure occurs vs. 0
//--------------------------------------------------------------------------
-int AtomType::getOffset() const
+int
+AtomType::getOffset() const
{
- int offset = H5Tget_offset(id); // C routine
+ int offset = H5Tget_offset(id); // C routine
// returns a non-negative offset value if successful
- if (offset == -1)
- {
- throw DataTypeIException(inMemFunc("getOffset"),
- "H5Tget_offset returns a negative offset value");
+ if (offset == -1) {
+ throw DataTypeIException(inMemFunc("getOffset"), "H5Tget_offset returns a negative offset value");
}
- return(offset);
+ return (offset);
}
//--------------------------------------------------------------------------
@@ -228,12 +227,12 @@ int AtomType::getOffset() const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void AtomType::setOffset(size_t offset) const
+void
+AtomType::setOffset(size_t offset) const
{
// Call C routine to set the bit offset
herr_t ret_value = H5Tset_offset(id, offset);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("setOffset"), "H5Tset_offset failed");
}
}
@@ -252,12 +251,12 @@ void AtomType::setOffset(size_t offset) const
/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void AtomType::getPad(H5T_pad_t& lsb, H5T_pad_t& msb) const
+void
+AtomType::getPad(H5T_pad_t &lsb, H5T_pad_t &msb) const
{
// Call C routine to get the padding type
herr_t ret_value = H5Tget_pad(id, &lsb, &msb);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("getPad"), "H5Tget_pad failed");
}
}
@@ -275,12 +274,12 @@ void AtomType::getPad(H5T_pad_t& lsb, H5T_pad_t& msb) const
/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void AtomType::setPad(H5T_pad_t lsb, H5T_pad_t msb) const
+void
+AtomType::setPad(H5T_pad_t lsb, H5T_pad_t msb) const
{
// Call C routine to set the padding type
herr_t ret_value = H5Tset_pad(id, lsb, msb);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("setPad"), "H5Tset_pad failed");
}
}
@@ -294,4 +293,4 @@ void AtomType::setPad(H5T_pad_t lsb, H5T_pad_t msb) const
AtomType::~AtomType() {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5AtomType.h b/c++/src/H5AtomType.h
index 80271ac..337aca6 100644
--- a/c++/src/H5AtomType.h
+++ b/c++/src/H5AtomType.h
@@ -26,54 +26,58 @@ namespace H5 {
*/
// Inheritance: DataType -> H5Object -> H5Location -> IdComponent
class H5_DLLCPP AtomType : public DataType {
- public:
- // Returns the byte order of an atomic datatype.
- H5T_order_t getOrder() const;
- H5T_order_t getOrder(H5std_string& order_string) const;
+ public:
+ // Returns the byte order of an atomic datatype.
+ H5T_order_t getOrder() const;
+ H5T_order_t getOrder(H5std_string &order_string) const;
- // Sets the byte ordering of an atomic datatype.
- void setOrder(H5T_order_t order) const;
+ // Sets the byte ordering of an atomic datatype.
+ void setOrder(H5T_order_t order) const;
- // Retrieves the bit offset of the first significant bit.
- // 12/05/00 - changed return type to int from size_t - C API
- int getOffset() const;
+ // Retrieves the bit offset of the first significant bit.
+ // 12/05/00 - changed return type to int from size_t - C API
+ int getOffset() const;
- // Sets the bit offset of the first significant bit.
- void setOffset(size_t offset) const;
+ // Sets the bit offset of the first significant bit.
+ void setOffset(size_t offset) const;
- // Retrieves the padding type of the least and most-significant bit padding.
- void getPad(H5T_pad_t& lsb, H5T_pad_t& msb) const;
+ // Retrieves the padding type of the least and most-significant bit padding.
+ void getPad(H5T_pad_t &lsb, H5T_pad_t &msb) const;
- // Sets the least and most-significant bits padding types
- void setPad(H5T_pad_t lsb, H5T_pad_t msb) const;
+ // Sets the least and most-significant bits padding types
+ void setPad(H5T_pad_t lsb, H5T_pad_t msb) const;
- // Returns the precision of an atomic datatype.
- size_t getPrecision() const;
+ // Returns the precision of an atomic datatype.
+ size_t getPrecision() const;
- // Sets the precision of an atomic datatype.
- void setPrecision(size_t precision) const;
+ // Sets the precision of an atomic datatype.
+ void setPrecision(size_t precision) const;
- // Sets the total size for an atomic datatype.
- void setSize(size_t size) const;
+ // Sets the total size for an atomic datatype.
+ void setSize(size_t size) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("AtomType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("AtomType");
+ }
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Copy constructor: same as the original AtomType.
- AtomType(const AtomType& original);
+ // Copy constructor: same as the original AtomType.
+ AtomType(const AtomType &original);
- // Noop destructor
- virtual ~AtomType();
+ // Noop destructor
+ virtual ~AtomType();
#endif // DOXYGEN_SHOULD_SKIP_THIS
- protected:
+ protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Default constructor
- AtomType();
+ // Default constructor
+ AtomType();
- // Constructor that takes an existing id
- AtomType(const hid_t existing_id);
+ // Constructor that takes an existing id
+ AtomType(const hid_t existing_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
}; // end of AtomType
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp
index 33f992a..131ce92 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -18,7 +18,7 @@
#endif
#include <string>
-#include "H5private.h" // for HDfree
+#include "H5private.h" // for HDfree
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -41,7 +41,7 @@ namespace H5 {
using std::cerr;
using std::endl;
-class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate
+class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate
//--------------------------------------------------------------------------
// Function: Attribute default constructor
@@ -56,7 +56,7 @@ Attribute::Attribute() : AbstractDs(), H5Location(), id(H5I_INVALID_HID) {}
///\param original - IN: Original Attribute object to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Attribute::Attribute(const Attribute& original) : AbstractDs(), H5Location(), id(original.id)
+Attribute::Attribute(const Attribute &original) : AbstractDs(), H5Location(), id(original.id)
{
incRefCount(); // increment number of references to this id
}
@@ -82,11 +82,11 @@ Attribute::Attribute(const hid_t existing_id) : AbstractDs(), H5Location(), id(e
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Attribute::write(const DataType& mem_type, const void *buf) const
+void
+Attribute::write(const DataType &mem_type, const void *buf) const
{
- herr_t ret_value = H5Awrite(id, mem_type.getId(), buf);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Awrite(id, mem_type.getId(), buf);
+ if (ret_value < 0) {
throw AttributeIException("Attribute::write", "H5Awrite failed");
}
}
@@ -100,32 +100,29 @@ void Attribute::write(const DataType& mem_type, const void *buf) const
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - Apr, 2003
//--------------------------------------------------------------------------
-void Attribute::write(const DataType& mem_type, const H5std_string& strg) const
+void
+Attribute::write(const DataType &mem_type, const H5std_string &strg) const
{
// Check if this attribute has variable-len string or fixed-len string and
// proceed appropriately.
htri_t is_variable_len = H5Tis_variable_str(mem_type.getId());
- if (is_variable_len < 0)
- {
+ if (is_variable_len < 0) {
throw AttributeIException("Attribute::write", "H5Tis_variable_str failed");
}
// Convert string to C-string
- const char* strg_C;
- strg_C = strg.c_str(); // strg_C refers to the contents of strg as a C-str
+ const char *strg_C;
+ strg_C = strg.c_str(); // strg_C refers to the contents of strg as a C-str
herr_t ret_value = 0;
// Pass string in differently depends on variable or fixed length
- if (!is_variable_len)
- {
+ if (!is_variable_len) {
ret_value = H5Awrite(id, mem_type.getId(), strg_C);
}
- else
- {
+ else {
// passing third argument by address
ret_value = H5Awrite(id, mem_type.getId(), &strg_C);
}
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw AttributeIException("Attribute::write", "H5Awrite failed");
}
}
@@ -138,11 +135,11 @@ void Attribute::write(const DataType& mem_type, const H5std_string& strg) const
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Attribute::read(const DataType& mem_type, void *buf) const
+void
+Attribute::read(const DataType &mem_type, void *buf) const
{
- herr_t ret_value = H5Aread(id, mem_type.getId(), buf);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Aread(id, mem_type.getId(), buf);
+ if (ret_value < 0) {
throw AttributeIException("Attribute::read", "H5Aread failed");
}
}
@@ -167,22 +164,21 @@ void Attribute::read(const DataType& mem_type, void *buf) const
// variable-len string data: p_read_fixed_len and
// p_read_variable_len. This should improve readability. -BMR
//--------------------------------------------------------------------------
-void Attribute::read(const DataType& mem_type, H5std_string& strg) const
+void
+Attribute::read(const DataType &mem_type, H5std_string &strg) const
{
// Check if this attribute has variable-len string or fixed-len string and
// proceed appropriately.
htri_t is_variable_len = H5Tis_variable_str(mem_type.getId());
- if (is_variable_len < 0)
- {
+ if (is_variable_len < 0) {
throw AttributeIException("Attribute::read", "H5Tis_variable_str failed");
}
- if (!is_variable_len) // only allocate for fixed-len string
+ if (!is_variable_len) // only allocate for fixed-len string
{
p_read_fixed_len(mem_type, strg);
}
- else
- {
+ else {
p_read_variable_len(mem_type, strg);
}
}
@@ -194,62 +190,55 @@ void Attribute::read(const DataType& mem_type, H5std_string& strg) const
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - Apr 2009
//--------------------------------------------------------------------------
-size_t Attribute::getInMemDataSize() const
+size_t
+Attribute::getInMemDataSize() const
{
const char *func = "Attribute::getInMemDataSize";
// Get the data type of this attribute
hid_t mem_type_id = H5Aget_type(id);
- if (mem_type_id < 0)
- {
+ if (mem_type_id < 0) {
throw AttributeIException(func, "H5Aget_type failed");
}
// Get the data type's size by first getting its native type then getting
// the native type's size.
hid_t native_type = H5Tget_native_type(mem_type_id, H5T_DIR_DEFAULT);
- if (native_type < 0)
- {
+ if (native_type < 0) {
throw AttributeIException(func, "H5Tget_native_type failed");
}
size_t type_size = H5Tget_size(native_type);
- if (type_size == 0)
- {
+ if (type_size == 0) {
throw AttributeIException(func, "H5Tget_size failed");
}
// Close the native type and the datatype of this attribute.
- if (H5Tclose(native_type) < 0)
- {
+ if (H5Tclose(native_type) < 0) {
throw DataSetIException(func, "H5Tclose(native_type) failed");
}
- if (H5Tclose(mem_type_id) < 0)
- {
+ if (H5Tclose(mem_type_id) < 0) {
throw DataSetIException(func, "H5Tclose(mem_type_id) failed");
}
// Get number of elements of the attribute by first getting its dataspace
// then getting the number of elements in the dataspace
hid_t space_id = H5Aget_space(id);
- if (space_id < 0)
- {
+ if (space_id < 0) {
throw AttributeIException(func, "H5Aget_space failed");
}
hssize_t num_elements = H5Sget_simple_extent_npoints(space_id);
- if (num_elements < 0)
- {
+ if (num_elements < 0) {
throw AttributeIException(func, "H5Sget_simple_extent_npoints failed");
}
// Close the dataspace
- if (H5Sclose(space_id) < 0)
- {
+ if (H5Sclose(space_id) < 0) {
throw DataSetIException(func, "H5Sclose failed");
}
// Calculate and return the size of the data
size_t data_size = type_size * num_elements;
- return(data_size);
+ return (data_size);
}
//--------------------------------------------------------------------------
@@ -259,20 +248,19 @@ size_t Attribute::getInMemDataSize() const
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSpace Attribute::getSpace() const
+DataSpace
+Attribute::getSpace() const
{
- // Calls C function H5Aget_space to get the id of the dataspace
- hid_t dataspace_id = H5Aget_space(id);
+ // Calls C function H5Aget_space to get the id of the dataspace
+ hid_t dataspace_id = H5Aget_space(id);
- // If the dataspace id is valid, create and return the DataSpace object
- if (dataspace_id > 0)
- {
+ // If the dataspace id is valid, create and return the DataSpace object
+ if (dataspace_id > 0) {
DataSpace dataspace;
f_DataSpace_setId(&dataspace, dataspace_id);
- return(dataspace);
+ return (dataspace);
}
- else
- {
+ else {
throw AttributeIException("Attribute::getSpace", "H5Aget_space failed");
}
}
@@ -294,22 +282,21 @@ DataSpace Attribute::getSpace() const
/// first argument and ignore the second argument.
// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
-ssize_t Attribute::getName(char* attr_name, size_t buf_size) const
+ssize_t
+Attribute::getName(char *attr_name, size_t buf_size) const
{
// H5Aget_name will get buf_size-1 chars of the name to null terminate it
ssize_t name_size = H5Aget_name(id, buf_size, attr_name);
// If H5Aget_name returns a negative value, raise an exception
- if (name_size < 0)
- {
+ if (name_size < 0) {
throw AttributeIException("Attribute::getName", "H5Aget_name failed");
}
- else if (name_size == 0)
- {
+ else if (name_size == 0) {
throw AttributeIException("Attribute::getName", "Attribute must have a name, name length is 0");
}
// Return length of the name
- return(name_size);
+ return (name_size);
}
//--------------------------------------------------------------------------
@@ -322,7 +309,8 @@ ssize_t Attribute::getName(char* attr_name, size_t buf_size) const
// Mar 2014 - BMR
// Revised to use the modified getName() above
//--------------------------------------------------------------------------
-H5std_string Attribute::getName() const
+H5std_string
+Attribute::getName() const
{
H5std_string attr_name(""); // attribute name to return
@@ -330,32 +318,28 @@ H5std_string Attribute::getName() const
ssize_t name_size = H5Aget_name(id, static_cast<size_t>(0), NULL);
// If H5Aget_name failed, throw exception
- if (name_size < 0)
- {
+ if (name_size < 0) {
throw AttributeIException("Attribute::getName", "H5Aget_name failed");
}
- else if (name_size == 0)
- {
+ else if (name_size == 0) {
throw AttributeIException("Attribute::getName", "Attribute must have a name, name length is 0");
}
// Attribute's name exists, retrieve it
- else if (name_size > 0)
- {
- char* name_C = new char[name_size+1]; // temporary C-string
- HDmemset(name_C, 0, name_size+1); // clear buffer
+ else if (name_size > 0) {
+ char *name_C = new char[name_size + 1]; // temporary C-string
+ HDmemset(name_C, 0, name_size + 1); // clear buffer
// Use overloaded function
- name_size = getName(name_C, name_size+1);
+ name_size = getName(name_C, name_size + 1);
// Convert the C attribute name to return
attr_name = name_C;
// Clean up resource
- delete []name_C;
-
+ delete[] name_C;
}
// Return attribute's name
- return(attr_name);
+ return (attr_name);
}
//--------------------------------------------------------------------------
@@ -371,14 +355,15 @@ H5std_string Attribute::getName() const
// Mar 2014 - BMR
// Revised to use the new getName() below
//--------------------------------------------------------------------------
-H5std_string Attribute::getName(size_t len) const
+H5std_string
+Attribute::getName(size_t len) const
{
H5std_string attr_name;
- ssize_t name_size = getName(attr_name, len);
+ ssize_t name_size = getName(attr_name, len);
if (name_size < 0)
- return("");
+ return ("");
else
- return(attr_name);
+ return (attr_name);
}
//--------------------------------------------------------------------------
@@ -398,35 +383,34 @@ H5std_string Attribute::getName(size_t len) const
// Added to replace getName(size_t, H5std_string&) so that it'll
// allow the argument "len" to be skipped.
//--------------------------------------------------------------------------
-ssize_t Attribute::getName(H5std_string& attr_name, size_t len) const
+ssize_t
+Attribute::getName(H5std_string &attr_name, size_t len) const
{
ssize_t name_size = 0;
// If no length is provided, get the entire attribute name
- if (len == 0)
- {
+ if (len == 0) {
attr_name = getName();
name_size = attr_name.length();
}
// If length is provided, get that number of characters in name
- else
- {
- char* name_C = new char[len+1]; // temporary C-string
- HDmemset(name_C, 0, len+1); // clear buffer
+ else {
+ char *name_C = new char[len + 1]; // temporary C-string
+ HDmemset(name_C, 0, len + 1); // clear buffer
// Use overloaded function
- name_size = getName(name_C, len+1);
+ name_size = getName(name_C, len + 1);
// Convert the C attribute name to return
attr_name = name_C;
// Clean up resource
- delete []name_C;
+ delete[] name_C;
}
// Otherwise, keep attr_name intact
// Return name size
- return(name_size);
+ return (name_size);
}
//--------------------------------------------------------------------------
@@ -444,7 +428,7 @@ ssize_t Attribute::getName(H5std_string& attr_name, size_t len) const
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-//ssize_t Attribute::getName(size_t len, H5std_string& attr_name) const
+// ssize_t Attribute::getName(size_t len, H5std_string& attr_name) const
//{
// return (getName(attr_name, len));
//}
@@ -458,10 +442,11 @@ ssize_t Attribute::getName(H5std_string& attr_name, size_t len) const
// function should have no failure. (from SLU)
// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
-hsize_t Attribute::getStorageSize() const
+hsize_t
+Attribute::getStorageSize() const
{
- hsize_t storage_size = H5Aget_storage_size(id);
- return (storage_size);
+ hsize_t storage_size = H5Aget_storage_size(id);
+ return (storage_size);
}
//--------------------------------------------------------------------------
@@ -480,9 +465,10 @@ hsize_t Attribute::getStorageSize() const
// an attribute id can be used to specify a location in HDF5
// library.
//--------------------------------------------------------------------------
-hid_t Attribute::getId() const
+hid_t
+Attribute::getId() const
{
- return(id);
+ return (id);
}
//--------------------------------------------------------------------------
@@ -494,13 +480,13 @@ hid_t Attribute::getId() const
// This private function is used in AbstractDs.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-hid_t Attribute::p_get_type() const
+hid_t
+Attribute::p_get_type() const
{
hid_t type_id = H5Aget_type(id);
if (type_id > 0)
- return(type_id);
- else
- {
+ return (type_id);
+ else {
throw AttributeIException("", "H5Aget_type failed");
}
}
@@ -517,7 +503,8 @@ hid_t Attribute::p_get_type() const
// Separated the fixed length case from the original
// Attribute::read
//--------------------------------------------------------------------------
-void Attribute::p_read_fixed_len(const DataType& mem_type, H5std_string& strg) const
+void
+Attribute::p_read_fixed_len(const DataType &mem_type, H5std_string &strg) const
{
// Only allocate for fixed-len string.
@@ -525,19 +512,17 @@ void Attribute::p_read_fixed_len(const DataType& mem_type, H5std_string& strg) c
size_t attr_size = getInMemDataSize();
// If there is data, allocate buffer and read it.
- if (attr_size > 0)
- {
- char *strg_C = new char[attr_size+1];
+ if (attr_size > 0) {
+ char * strg_C = new char[attr_size + 1];
herr_t ret_value = H5Aread(id, mem_type.getId(), strg_C);
- if (ret_value < 0)
- {
- delete []strg_C; // de-allocate for fixed-len string
+ if (ret_value < 0) {
+ delete[] strg_C; // de-allocate for fixed-len string
throw AttributeIException("Attribute::read", "H5Aread failed");
}
// Get string from the C char* and release resource allocated locally
strg_C[attr_size] = '\0';
- strg = strg_C;
- delete []strg_C;
+ strg = strg_C;
+ delete[] strg_C;
}
}
@@ -553,7 +538,8 @@ void Attribute::p_read_fixed_len(const DataType& mem_type, H5std_string& strg) c
// Separated the variable length case from the original
// Attribute::read. -BMR
//--------------------------------------------------------------------------
-void Attribute::p_read_variable_len(const DataType& mem_type, H5std_string& strg) const
+void
+Attribute::p_read_variable_len(const DataType &mem_type, H5std_string &strg) const
{
// Prepare and call C API to read attribute.
char *strg_C;
@@ -561,8 +547,7 @@ void Attribute::p_read_variable_len(const DataType& mem_type, H5std_string& strg
// Read attribute, no allocation for variable-len string; C library will
herr_t ret_value = H5Aread(id, mem_type.getId(), &strg_C);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw AttributeIException("Attribute::read", "H5Aread failed");
}
@@ -584,13 +569,14 @@ void Attribute::p_read_variable_len(const DataType& mem_type, H5std_string& strg
// Then the object's id is reset to the new id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Attribute::p_setId(const hid_t new_id)
+void
+Attribute::p_setId(const hid_t new_id)
{
// handling references to this old id
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw AttributeIException("Attribute::p_setId", close_error.getDetailMsg());
}
// reset object's id to the given id
@@ -605,13 +591,12 @@ void Attribute::p_setId(const hid_t new_id)
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
-void Attribute::close()
+void
+Attribute::close()
{
- if (p_valid_id(id))
- {
+ if (p_valid_id(id)) {
herr_t ret_value = H5Aclose(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw AttributeIException("Attribute::close", "H5Aclose failed");
}
// reset the id
@@ -634,9 +619,9 @@ Attribute::~Attribute()
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
cerr << "Attribute::~Attribute - " << close_error.getDetailMsg() << endl;
}
}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h
index c6fdaec..8783c00 100644
--- a/c++/src/H5Attribute.h
+++ b/c++/src/H5Attribute.h
@@ -27,76 +27,79 @@ namespace H5 {
*/
// Inheritance: multiple H5Location/AbstractDs -> IdComponent
class H5_DLLCPP Attribute : public AbstractDs, public H5Location {
- public:
+ public:
+ // Copy constructor: same as the original Attribute.
+ Attribute(const Attribute &original);
- // Copy constructor: same as the original Attribute.
- Attribute(const Attribute& original);
+ // Default constructor
+ Attribute();
- // Default constructor
- Attribute();
+ // Creates a copy of an existing attribute using the attribute id
+ Attribute(const hid_t attr_id);
- // Creates a copy of an existing attribute using the attribute id
- Attribute(const hid_t attr_id);
+ // Closes this attribute.
+ virtual void close();
- // Closes this attribute.
- virtual void close();
+ // Gets the name of this attribute.
+ ssize_t getName(char *attr_name, size_t buf_size = 0) const;
+ H5std_string getName(size_t len) const;
+ H5std_string getName() const;
+ ssize_t getName(H5std_string &attr_name, size_t len = 0) const;
+ // The overloaded function below is replaced by the one above and it
+ // is kept for backward compatibility purpose.
+ ssize_t getName(size_t buf_size, H5std_string &attr_name) const;
- // Gets the name of this attribute.
- ssize_t getName(char* attr_name, size_t buf_size = 0) const;
- H5std_string getName(size_t len) const;
- H5std_string getName() const;
- ssize_t getName(H5std_string& attr_name, size_t len = 0) const;
- // The overloaded function below is replaced by the one above and it
- // is kept for backward compatibility purpose.
- ssize_t getName(size_t buf_size, H5std_string& attr_name) const;
+ // Gets a copy of the dataspace for this attribute.
+ virtual DataSpace getSpace() const;
- // Gets a copy of the dataspace for this attribute.
- virtual DataSpace getSpace() const;
+ // Returns the amount of storage size required for this attribute.
+ virtual hsize_t getStorageSize() const;
- // Returns the amount of storage size required for this attribute.
- virtual hsize_t getStorageSize() const;
+ // Returns the in memory size of this attribute's data.
+ virtual size_t getInMemDataSize() const;
- // Returns the in memory size of this attribute's data.
- virtual size_t getInMemDataSize() const;
+ // Reads data from this attribute.
+ void read(const DataType &mem_type, void *buf) const;
+ void read(const DataType &mem_type, H5std_string &strg) const;
- // Reads data from this attribute.
- void read(const DataType& mem_type, void *buf) const;
- void read(const DataType& mem_type, H5std_string& strg) const;
+ // Writes data to this attribute.
+ void write(const DataType &mem_type, const void *buf) const;
+ void write(const DataType &mem_type, const H5std_string &strg) const;
- // Writes data to this attribute.
- void write(const DataType& mem_type, const void *buf) const;
- void write(const DataType& mem_type, const H5std_string& strg) const;
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("Attribute");
+ }
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("Attribute"); }
+ // Gets the attribute id.
+ virtual hid_t getId() const;
- // Gets the attribute id.
- virtual hid_t getId() const;
-
- // Destructor: properly terminates access to this attribute.
- virtual ~Attribute();
+ // Destructor: properly terminates access to this attribute.
+ virtual ~Attribute();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- protected:
- // Sets the attribute id.
- virtual void p_setId(const hid_t new_id);
+ protected:
+ // Sets the attribute id.
+ virtual void p_setId(const hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
- private:
- hid_t id; // HDF5 attribute id
+ private:
+ hid_t id; // HDF5 attribute id
- // This function contains the common code that is used by
- // getTypeClass and various API functions getXxxType
- // defined in AbstractDs for generic datatype and specific
- // sub-types
- virtual hid_t p_get_type() const;
+ // This function contains the common code that is used by
+ // getTypeClass and various API functions getXxxType
+ // defined in AbstractDs for generic datatype and specific
+ // sub-types
+ virtual hid_t p_get_type() const;
- // Reads variable or fixed len strings from this attribute.
- void p_read_variable_len(const DataType& mem_type, H5std_string& strg) const;
- void p_read_fixed_len(const DataType& mem_type, H5std_string& strg) const;
+ // Reads variable or fixed len strings from this attribute.
+ void p_read_variable_len(const DataType &mem_type, H5std_string &strg) const;
+ void p_read_fixed_len(const DataType &mem_type, H5std_string &strg) const;
- // Friend function to set Attribute id. For library use only.
- friend void f_Attribute_setId(Attribute* attr, hid_t new_id);
+ // Friend function to set Attribute id. For library use only.
+ friend void f_Attribute_setId(Attribute *attr, hid_t new_id);
}; // end of Attribute
} // namespace H5
diff --git a/c++/src/H5Classes.h b/c++/src/H5Classes.h
index 8b1e6ed..618b46c 100644
--- a/c++/src/H5Classes.h
+++ b/c++/src/H5Classes.h
@@ -16,31 +16,31 @@
#define __H5Classes_H
namespace H5 {
- class Exception;
- class IdComponent;
- class H5Location;
- class H5Object;
- class PropList;
- class FileCreatPropList;
- class FileAccPropList;
- class LinkAccPropList;
- class DSetCreatPropList;
- class DSetMemXferPropList;
- class DTypePropList;
- class DataType;
- class DataSpace;
- class AtomType;
- class PredType;
- class IntType;
- class FloatType;
- class StrType;
- class EnumType;
- class CompType;
- class AbstractDs;
- class DataSet;
- class Group;
- class H5File;
- class Attribute;
- class H5Library;
-}
+class Exception;
+class IdComponent;
+class H5Location;
+class H5Object;
+class PropList;
+class FileCreatPropList;
+class FileAccPropList;
+class LinkAccPropList;
+class DSetCreatPropList;
+class DSetMemXferPropList;
+class DTypePropList;
+class DataType;
+class DataSpace;
+class AtomType;
+class PredType;
+class IntType;
+class FloatType;
+class StrType;
+class EnumType;
+class CompType;
+class AbstractDs;
+class DataSet;
+class Group;
+class H5File;
+class Attribute;
+class H5Library;
+} // namespace H5
#endif // __H5Classes_H
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index 6c5fdca..3390980 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -13,7 +13,7 @@
#include <string>
-#include "H5private.h" // for HDstrcpy
+#include "H5private.h" // for HDstrcpy
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -55,7 +55,8 @@ namespace H5 {
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataType CommonFG::openDataType(const char* name) const
+DataType
+CommonFG::openDataType(const char *name) const
{
// Call C function H5Topen2 to open the named datatype in this group,
// given either the file or group id
@@ -68,7 +69,7 @@ DataType CommonFG::openDataType(const char* name) const
// No failure, create and return the DataType object
DataType data_type;
f_DataType_setId(&data_type, type_id);
- return(data_type);
+ return (data_type);
}
//--------------------------------------------------------------------------
@@ -78,9 +79,10 @@ DataType CommonFG::openDataType(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataType CommonFG::openDataType(const H5std_string& name) const
+DataType
+CommonFG::openDataType(const H5std_string &name) const
{
- return(openDataType(name.c_str()));
+ return (openDataType(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -91,7 +93,8 @@ DataType CommonFG::openDataType(const H5std_string& name) const
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-ArrayType CommonFG::openArrayType(const char* name) const
+ArrayType
+CommonFG::openArrayType(const char *name) const
{
// Call C function H5Topen2 to open the named datatype in this group,
// given either the file or group id
@@ -104,7 +107,7 @@ ArrayType CommonFG::openArrayType(const char* name) const
// No failure, create and return the ArrayType object
ArrayType array_type;
f_DataType_setId(&array_type, type_id);
- return(array_type);
+ return (array_type);
}
//--------------------------------------------------------------------------
@@ -114,9 +117,10 @@ ArrayType CommonFG::openArrayType(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-ArrayType CommonFG::openArrayType(const H5std_string& name) const
+ArrayType
+CommonFG::openArrayType(const H5std_string &name) const
{
- return(openArrayType(name.c_str()));
+ return (openArrayType(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -127,7 +131,8 @@ ArrayType CommonFG::openArrayType(const H5std_string& name) const
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-CompType CommonFG::openCompType(const char* name) const
+CompType
+CommonFG::openCompType(const char *name) const
{
// Call C function H5Topen2 to open the named datatype in this group,
// given either the file or group id
@@ -140,7 +145,7 @@ CompType CommonFG::openCompType(const char* name) const
// No failure, create and return the CompType object
CompType comp_type;
f_DataType_setId(&comp_type, type_id);
- return(comp_type);
+ return (comp_type);
}
//--------------------------------------------------------------------------
@@ -150,9 +155,10 @@ CompType CommonFG::openCompType(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-CompType CommonFG::openCompType(const H5std_string& name) const
+CompType
+CommonFG::openCompType(const H5std_string &name) const
{
- return(openCompType(name.c_str()));
+ return (openCompType(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -163,7 +169,8 @@ CompType CommonFG::openCompType(const H5std_string& name) const
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType CommonFG::openEnumType(const char* name) const
+EnumType
+CommonFG::openEnumType(const char *name) const
{
// Call C function H5Topen2 to open the named datatype in this group,
// given either the file or group id
@@ -176,7 +183,7 @@ EnumType CommonFG::openEnumType(const char* name) const
// No failure, create and return the EnumType object
EnumType enum_type;
f_DataType_setId(&enum_type, type_id);
- return(enum_type);
+ return (enum_type);
}
//--------------------------------------------------------------------------
@@ -186,9 +193,10 @@ EnumType CommonFG::openEnumType(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType CommonFG::openEnumType(const H5std_string& name) const
+EnumType
+CommonFG::openEnumType(const H5std_string &name) const
{
- return(openEnumType(name.c_str()));
+ return (openEnumType(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -199,7 +207,8 @@ EnumType CommonFG::openEnumType(const H5std_string& name) const
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType CommonFG::openIntType(const char* name) const
+IntType
+CommonFG::openIntType(const char *name) const
{
// Call C function H5Topen2 to open the named datatype in this group,
// given either the file or group id
@@ -212,7 +221,7 @@ IntType CommonFG::openIntType(const char* name) const
// No failure, create and return the IntType object
IntType int_type;
f_DataType_setId(&int_type, type_id);
- return(int_type);
+ return (int_type);
}
//--------------------------------------------------------------------------
@@ -222,9 +231,10 @@ IntType CommonFG::openIntType(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType CommonFG::openIntType(const H5std_string& name) const
+IntType
+CommonFG::openIntType(const H5std_string &name) const
{
- return(openIntType(name.c_str()));
+ return (openIntType(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -235,7 +245,8 @@ IntType CommonFG::openIntType(const H5std_string& name) const
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType CommonFG::openFloatType(const char* name) const
+FloatType
+CommonFG::openFloatType(const char *name) const
{
// Call C function H5Topen2 to open the named datatype in this group,
// given either the file or group id
@@ -248,7 +259,7 @@ FloatType CommonFG::openFloatType(const char* name) const
// No failure, create and return the FloatType object
FloatType float_type;
f_DataType_setId(&float_type, type_id);
- return(float_type);
+ return (float_type);
}
//--------------------------------------------------------------------------
@@ -258,9 +269,10 @@ FloatType CommonFG::openFloatType(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType CommonFG::openFloatType(const H5std_string& name) const
+FloatType
+CommonFG::openFloatType(const H5std_string &name) const
{
- return(openFloatType(name.c_str()));
+ return (openFloatType(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -271,7 +283,8 @@ FloatType CommonFG::openFloatType(const H5std_string& name) const
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType CommonFG::openStrType(const char* name) const
+StrType
+CommonFG::openStrType(const char *name) const
{
// Call C function H5Topen2 to open the named datatype in this group,
// given either the file or group id
@@ -284,7 +297,7 @@ StrType CommonFG::openStrType(const char* name) const
// No failure, create and return the StrType object
StrType str_type;
f_DataType_setId(&str_type, type_id);
- return(str_type);
+ return (str_type);
}
//--------------------------------------------------------------------------
@@ -294,9 +307,10 @@ StrType CommonFG::openStrType(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType CommonFG::openStrType(const H5std_string& name) const
+StrType
+CommonFG::openStrType(const H5std_string &name) const
{
- return(openStrType(name.c_str()));
+ return (openStrType(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -307,7 +321,8 @@ StrType CommonFG::openStrType(const H5std_string& name) const
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-VarLenType CommonFG::openVarLenType(const char* name) const
+VarLenType
+CommonFG::openVarLenType(const char *name) const
{
// Call C function H5Topen2 to open the named datatype in this group,
// given either the file or group id
@@ -320,7 +335,7 @@ VarLenType CommonFG::openVarLenType(const char* name) const
// No failure, create and return the VarLenType object
VarLenType varlen_type;
f_DataType_setId(&varlen_type, type_id);
- return(varlen_type);
+ return (varlen_type);
}
//--------------------------------------------------------------------------
@@ -330,9 +345,10 @@ VarLenType CommonFG::openVarLenType(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-VarLenType CommonFG::openVarLenType(const H5std_string& name) const
+VarLenType
+CommonFG::openVarLenType(const H5std_string &name) const
{
- return(openVarLenType(name.c_str()));
+ return (openVarLenType(name.c_str()));
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -360,7 +376,8 @@ CommonFG::~CommonFG() {}
// param new_id - IN: New id to set
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void f_DataType_setId(DataType* dtype, hid_t new_id)
+void
+f_DataType_setId(DataType *dtype, hid_t new_id)
{
dtype->p_setId(new_id);
}
@@ -375,11 +392,12 @@ void f_DataType_setId(DataType* dtype, hid_t new_id)
// param new_id - IN: New id to set
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void f_DataSet_setId(DataSet* dset, hid_t new_id)
+void
+f_DataSet_setId(DataSet *dset, hid_t new_id)
{
dset->p_setId(new_id);
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h
index 68e3f19..c3aef41 100644
--- a/c++/src/H5CommonFG.h
+++ b/c++/src/H5CommonFG.h
@@ -28,56 +28,55 @@ class VarLenType;
*/
/* Note: This class is being deprecated gradually. */
class H5_DLLCPP CommonFG {
- public:
- // Opens a generic named datatype in this location.
- DataType openDataType(const char* name) const;
- DataType openDataType(const H5std_string& name) const;
+ public:
+ // Opens a generic named datatype in this location.
+ DataType openDataType(const char *name) const;
+ DataType openDataType(const H5std_string &name) const;
- // Opens a named array datatype in this location.
- ArrayType openArrayType(const char* name) const;
- ArrayType openArrayType(const H5std_string& name) const;
+ // Opens a named array datatype in this location.
+ ArrayType openArrayType(const char *name) const;
+ ArrayType openArrayType(const H5std_string &name) const;
- // Opens a named compound datatype in this location.
- CompType openCompType(const char* name) const;
- CompType openCompType(const H5std_string& name) const;
+ // Opens a named compound datatype in this location.
+ CompType openCompType(const char *name) const;
+ CompType openCompType(const H5std_string &name) const;
- // Opens a named enumeration datatype in this location.
- EnumType openEnumType(const char* name) const;
- EnumType openEnumType(const H5std_string& name) const;
+ // Opens a named enumeration datatype in this location.
+ EnumType openEnumType(const char *name) const;
+ EnumType openEnumType(const H5std_string &name) const;
- // Opens a named integer datatype in this location.
- IntType openIntType(const char* name) const;
- IntType openIntType(const H5std_string& name) const;
+ // Opens a named integer datatype in this location.
+ IntType openIntType(const char *name) const;
+ IntType openIntType(const H5std_string &name) const;
- // Opens a named floating-point datatype in this location.
- FloatType openFloatType(const char* name) const;
- FloatType openFloatType(const H5std_string& name) const;
+ // Opens a named floating-point datatype in this location.
+ FloatType openFloatType(const char *name) const;
+ FloatType openFloatType(const H5std_string &name) const;
- // Opens a named string datatype in this location.
- StrType openStrType(const char* name) const;
- StrType openStrType(const H5std_string& name) const;
+ // Opens a named string datatype in this location.
+ StrType openStrType(const char *name) const;
+ StrType openStrType(const H5std_string &name) const;
- // Opens a named variable length datatype in this location.
- VarLenType openVarLenType(const char* name) const;
- VarLenType openVarLenType(const H5std_string& name) const;
+ // Opens a named variable length datatype in this location.
+ VarLenType openVarLenType(const char *name) const;
+ VarLenType openVarLenType(const H5std_string &name) const;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- /// For subclasses, H5File and Group, to return the correct
- /// object id, i.e. file or group id.
- virtual hid_t getLocId() const = 0;
+ /// For subclasses, H5File and Group, to return the correct
+ /// object id, i.e. file or group id.
+ virtual hid_t getLocId() const = 0;
+ /// For subclasses, H5File and Group, to throw appropriate exception.
+ virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const = 0;
- /// For subclasses, H5File and Group, to throw appropriate exception.
- virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const = 0;
+ // Default constructor.
+ CommonFG();
- // Default constructor.
- CommonFG();
+ // Noop destructor.
+ virtual ~CommonFG();
- // Noop destructor.
- virtual ~CommonFG();
-
- protected:
- virtual void p_setId(const hid_t new_id) = 0;
+ protected:
+ virtual void p_setId(const hid_t new_id) = 0;
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp
index fe96bb0..58ce83c 100644
--- a/c++/src/H5CompType.cpp
+++ b/c++/src/H5CompType.cpp
@@ -45,7 +45,7 @@ CompType::CompType() : DataType() {}
///\param original - IN: Original CompType instance
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-CompType::CompType(const CompType& original) : DataType(original) {}
+CompType::CompType(const CompType &original) : DataType(original) {}
//--------------------------------------------------------------------------
// Function: CompType overloaded constructor
@@ -75,14 +75,13 @@ CompType::CompType(size_t size) : DataType(H5T_COMPOUND, size) {}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-CompType::CompType(const DataSet& dataset) : DataType()
+CompType::CompType(const DataSet &dataset) : DataType()
{
// Calls C function H5Dget_type to get the id of the datatype
id = H5Dget_type(dataset.getId());
// If the datatype id is invalid, throw exception
- if (id < 0)
- {
+ if (id < 0) {
throw DataSetIException("CompType constructor", "H5Dget_type failed");
}
}
@@ -101,7 +100,7 @@ CompType::CompType(const DataSet& dataset) : DataType()
// improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-CompType::CompType(const H5Location& loc, const char *dtype_name) : DataType()
+CompType::CompType(const H5Location &loc, const char *dtype_name) : DataType()
{
id = p_opentype(loc, dtype_name);
}
@@ -120,7 +119,7 @@ CompType::CompType(const H5Location& loc, const char *dtype_name) : DataType()
// to improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-CompType::CompType(const H5Location& loc, const H5std_string& dtype_name) : DataType()
+CompType::CompType(const H5Location &loc, const H5std_string &dtype_name) : DataType()
{
id = p_opentype(loc, dtype_name.c_str());
}
@@ -133,7 +132,8 @@ CompType::CompType(const H5Location& loc, const H5std_string& dtype_name) : Data
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-DataType* CompType::decode() const
+DataType *
+CompType::decode() const
{
hid_t encoded_cmptype_id = H5I_INVALID_HID;
try {
@@ -144,7 +144,7 @@ DataType* CompType::decode() const
}
CompType *encoded_cmptype = new CompType;
encoded_cmptype->p_setId(encoded_cmptype_id);
- return(encoded_cmptype);
+ return (encoded_cmptype);
}
//--------------------------------------------------------------------------
@@ -154,15 +154,15 @@ DataType* CompType::decode() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int CompType::getNmembers() const
+int
+CompType::getNmembers() const
{
int num_members = H5Tget_nmembers(id);
- if (num_members < 0)
- {
+ if (num_members < 0) {
throw DataTypeIException("CompType::getNmembers",
- "H5Tget_nmembers returns negative number of members");
+ "H5Tget_nmembers returns negative number of members");
}
- return(num_members);
+ return (num_members);
}
//--------------------------------------------------------------------------
@@ -173,17 +173,18 @@ int CompType::getNmembers() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string CompType::getMemberName(unsigned member_num) const
+H5std_string
+CompType::getMemberName(unsigned member_num) const
{
- char* member_name_C = H5Tget_member_name(id, member_num);
- if (member_name_C == NULL) // NULL means failure
+ char *member_name_C = H5Tget_member_name(id, member_num);
+ if (member_name_C == NULL) // NULL means failure
{
throw DataTypeIException("CompType::getMemberName",
- "H5Tget_member_name returns NULL for member name");
+ "H5Tget_member_name returns NULL for member name");
}
H5std_string member_name = H5std_string(member_name_C); // convert C string to string
- H5free_memory(member_name_C); // free the C string
- return(member_name); // return the member name string
+ H5free_memory(member_name_C); // free the C string
+ return (member_name); // return the member name string
}
//--------------------------------------------------------------------------
@@ -198,19 +199,19 @@ H5std_string CompType::getMemberName(unsigned member_num) const
/// function \c CompType::getNmembers.
// Programmer Binh-Minh Ribler - May 16, 2002
//--------------------------------------------------------------------------
-int CompType::getMemberIndex(const char* name) const
+int
+CompType::getMemberIndex(const char *name) const
{
int member_index = H5Tget_member_index(id, name);
- if (member_index < 0)
- {
- throw DataTypeIException("CompType::getMemberIndex",
- "H5Tget_member_index returns negative value");
+ if (member_index < 0) {
+ throw DataTypeIException("CompType::getMemberIndex", "H5Tget_member_index returns negative value");
}
- return(member_index);
+ return (member_index);
}
-int CompType::getMemberIndex(const H5std_string& name) const
+int
+CompType::getMemberIndex(const H5std_string &name) const
{
- return(getMemberIndex(name.c_str()));
+ return (getMemberIndex(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -228,10 +229,11 @@ int CompType::getMemberIndex(const H5std_string& name) const
// Note that byte offset being returned as 0 doesn't indicate
// a failure. (According to Quincey)
//--------------------------------------------------------------------------
-size_t CompType::getMemberOffset(unsigned member_num) const
+size_t
+CompType::getMemberOffset(unsigned member_num) const
{
size_t offset = H5Tget_member_offset(id, member_num);
- return(offset);
+ return (offset);
}
//--------------------------------------------------------------------------
@@ -244,29 +246,28 @@ size_t CompType::getMemberOffset(unsigned member_num) const
// Modification
// Modified to use H5Tget_member_class instead. - Jul, 2005
//--------------------------------------------------------------------------
-H5T_class_t CompType::getMemberClass(unsigned member_num) const
+H5T_class_t
+CompType::getMemberClass(unsigned member_num) const
{
H5T_class_t member_class = H5Tget_member_class(id, member_num);
- if (member_class == H5T_NO_CLASS)
- {
- throw DataTypeIException("CompType::getMemberClass",
- "H5Tget_member_class returns H5T_NO_CLASS");
+ if (member_class == H5T_NO_CLASS) {
+ throw DataTypeIException("CompType::getMemberClass", "H5Tget_member_class returns H5T_NO_CLASS");
}
- return(member_class);
+ return (member_class);
}
// This private member function calls the C API to get the identifier
// of the specified member. It provides the id to construct appropriate
// sub-types in the functions getMemberXxxType below, where Xxx indicates
// the sub-types.
-hid_t CompType::p_get_member_type(unsigned member_num) const
+hid_t
+CompType::p_get_member_type(unsigned member_num) const
{
// get the id of the specified member first
hid_t member_type_id = H5Tget_member_type(id, member_num);
if (member_type_id > 0)
- return(member_type_id);
- else
- {
+ return (member_type_id);
+ else {
// p_get_member_type is private, caller will catch this exception
// then throw another with appropriate API name
throw DataTypeIException("", "H5Tget_member_type failed");
@@ -282,14 +283,15 @@ hid_t CompType::p_get_member_type(unsigned member_num) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataType CompType::getMemberDataType(unsigned member_num) const
+DataType
+CompType::getMemberDataType(unsigned member_num) const
{
try {
DataType datatype;
f_DataType_setId(&datatype, p_get_member_type(member_num));
- return(datatype);
+ return (datatype);
}
- catch (DataTypeIException& E) {
+ catch (DataTypeIException &E) {
throw DataTypeIException("CompType::getMemberDataType", E.getDetailMsg());
}
}
@@ -303,14 +305,15 @@ DataType CompType::getMemberDataType(unsigned member_num) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-ArrayType CompType::getMemberArrayType(unsigned member_num) const
+ArrayType
+CompType::getMemberArrayType(unsigned member_num) const
{
try {
ArrayType arraytype;
f_DataType_setId(&arraytype, p_get_member_type(member_num));
- return(arraytype);
+ return (arraytype);
}
- catch (DataTypeIException& E) {
+ catch (DataTypeIException &E) {
throw DataTypeIException("CompType::getMemberArrayType", E.getDetailMsg());
}
}
@@ -324,14 +327,15 @@ ArrayType CompType::getMemberArrayType(unsigned member_num) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-CompType CompType::getMemberCompType(unsigned member_num) const
+CompType
+CompType::getMemberCompType(unsigned member_num) const
{
try {
CompType comptype;
f_DataType_setId(&comptype, p_get_member_type(member_num));
- return(comptype);
+ return (comptype);
}
- catch (DataTypeIException& E) {
+ catch (DataTypeIException &E) {
throw DataTypeIException("CompType::getMemberCompType", E.getDetailMsg());
}
}
@@ -345,14 +349,15 @@ CompType CompType::getMemberCompType(unsigned member_num) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType CompType::getMemberEnumType(unsigned member_num) const
+EnumType
+CompType::getMemberEnumType(unsigned member_num) const
{
try {
EnumType enumtype;
f_DataType_setId(&enumtype, p_get_member_type(member_num));
- return(enumtype);
+ return (enumtype);
}
- catch (DataTypeIException& E) {
+ catch (DataTypeIException &E) {
throw DataTypeIException("CompType::getMemberEnumType", E.getDetailMsg());
}
}
@@ -366,14 +371,15 @@ EnumType CompType::getMemberEnumType(unsigned member_num) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType CompType::getMemberIntType(unsigned member_num) const
+IntType
+CompType::getMemberIntType(unsigned member_num) const
{
try {
IntType inttype;
f_DataType_setId(&inttype, p_get_member_type(member_num));
- return(inttype);
+ return (inttype);
}
- catch (DataTypeIException& E) {
+ catch (DataTypeIException &E) {
throw DataTypeIException("CompType::getMemberIntType", E.getDetailMsg());
}
}
@@ -387,14 +393,15 @@ IntType CompType::getMemberIntType(unsigned member_num) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType CompType::getMemberFloatType(unsigned member_num) const
+FloatType
+CompType::getMemberFloatType(unsigned member_num) const
{
try {
FloatType floatype;
f_DataType_setId(&floatype, p_get_member_type(member_num));
- return(floatype);
+ return (floatype);
}
- catch (DataTypeIException& E) {
+ catch (DataTypeIException &E) {
throw DataTypeIException("CompType::getMemberFloatType", E.getDetailMsg());
}
}
@@ -408,14 +415,15 @@ FloatType CompType::getMemberFloatType(unsigned member_num) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType CompType::getMemberStrType(unsigned member_num) const
+StrType
+CompType::getMemberStrType(unsigned member_num) const
{
try {
StrType strtype;
f_DataType_setId(&strtype, p_get_member_type(member_num));
- return(strtype);
+ return (strtype);
}
- catch (DataTypeIException& E) {
+ catch (DataTypeIException &E) {
throw DataTypeIException("CompType::getMemberStrType", E.getDetailMsg());
}
}
@@ -429,14 +437,15 @@ StrType CompType::getMemberStrType(unsigned member_num) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-VarLenType CompType::getMemberVarLenType(unsigned member_num) const
+VarLenType
+CompType::getMemberVarLenType(unsigned member_num) const
{
try {
VarLenType varlentype;
f_DataType_setId(&varlentype, p_get_member_type(member_num));
- return(varlentype);
+ return (varlentype);
}
- catch (DataTypeIException& E) {
+ catch (DataTypeIException &E) {
throw DataTypeIException("CompType::getMemberVarLenType", E.getDetailMsg());
}
}
@@ -483,18 +492,18 @@ void CompType::getMemberType(unsigned member_num, StrType& strtype) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void CompType::insertMember(const H5std_string& name, size_t offset, const DataType& new_member) const
+void
+CompType::insertMember(const H5std_string &name, size_t offset, const DataType &new_member) const
{
// Convert string to C-string
- const char* name_C;
- name_C = name.c_str(); // name_C refers to the contents of name as a C-str
+ const char *name_C;
+ name_C = name.c_str(); // name_C refers to the contents of name as a C-str
- hid_t new_member_id = new_member.getId(); // get new_member id for C API
+ hid_t new_member_id = new_member.getId(); // get new_member id for C API
// Call C routine H5Tinsert to add the new member
herr_t ret_value = H5Tinsert(id, name_C, offset, new_member_id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("CompType::insertMember", "H5Tinsert failed");
}
}
@@ -506,12 +515,12 @@ void CompType::insertMember(const H5std_string& name, size_t offset, const DataT
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void CompType::pack() const
+void
+CompType::pack() const
{
// Calls C routine H5Tpack to remove padding
herr_t ret_value = H5Tpack(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("CompType::pack", "H5Tpack failed");
}
}
@@ -525,12 +534,12 @@ void CompType::pack() const
// H5Tset_size works on atom datatypes and compound datatypes only
// Programmer Binh-Minh Ribler - 2014
//--------------------------------------------------------------------------
-void CompType::setSize(size_t size) const
+void
+CompType::setSize(size_t size) const
{
// Call C routine H5Tset_size to set the total size
herr_t ret_value = H5Tset_size(id, size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("CompType::setSize", "H5Tset_size failed");
}
}
@@ -542,4 +551,4 @@ void CompType::setSize(size_t size) const
//--------------------------------------------------------------------------
CompType::~CompType() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h
index d85e2ed..66392d9 100644
--- a/c++/src/H5CompType.h
+++ b/c++/src/H5CompType.h
@@ -23,99 +23,103 @@ namespace H5 {
*/
// Inheritance: DataType -> H5Object -> H5Location -> IdComponent
class H5_DLLCPP CompType : public DataType {
- public:
- // Default constructor
- CompType();
+ public:
+ // Default constructor
+ CompType();
- // Creates a compound datatype using an existing id
- CompType(const hid_t existing_id);
+ // Creates a compound datatype using an existing id
+ CompType(const hid_t existing_id);
- // Creates a new compound datatype, given the type's size
- CompType(size_t size); // H5Tcreate
+ // Creates a new compound datatype, given the type's size
+ CompType(size_t size); // H5Tcreate
- // Gets the compound datatype of the specified dataset
- CompType(const DataSet& dataset); // H5Dget_type
+ // Gets the compound datatype of the specified dataset
+ CompType(const DataSet &dataset); // H5Dget_type
- // Copy constructor - same as the original CompType.
- CompType(const CompType& original);
+ // Copy constructor - same as the original CompType.
+ CompType(const CompType &original);
- // Constructors that open a compound datatype, given a location.
- CompType(const H5Location& loc, const char* name);
- CompType(const H5Location& loc, const H5std_string& name);
+ // Constructors that open a compound datatype, given a location.
+ CompType(const H5Location &loc, const char *name);
+ CompType(const H5Location &loc, const H5std_string &name);
- // Returns a CompType object via DataType* by decoding the binary
- // object description of this type.
- virtual DataType* decode() const;
+ // Returns a CompType object via DataType* by decoding the binary
+ // object description of this type.
+ virtual DataType *decode() const;
- // Returns the type class of the specified member of this compound
- // datatype. It provides to the user a way of knowing what type
- // to create another datatype of the same class
- H5T_class_t getMemberClass(unsigned member_num) const;
+ // Returns the type class of the specified member of this compound
+ // datatype. It provides to the user a way of knowing what type
+ // to create another datatype of the same class
+ H5T_class_t getMemberClass(unsigned member_num) const;
- // Returns the index of a member in this compound data type.
- int getMemberIndex(const char* name) const;
- int getMemberIndex(const H5std_string& name) const;
+ // Returns the index of a member in this compound data type.
+ int getMemberIndex(const char *name) const;
+ int getMemberIndex(const H5std_string &name) const;
- // Returns the offset of a member of this compound datatype.
- size_t getMemberOffset(unsigned memb_no) const;
+ // Returns the offset of a member of this compound datatype.
+ size_t getMemberOffset(unsigned memb_no) const;
- // Returns the name of a member of this compound datatype.
- H5std_string getMemberName(unsigned member_num) const;
+ // Returns the name of a member of this compound datatype.
+ H5std_string getMemberName(unsigned member_num) const;
- // Returns the generic datatype of the specified member in
- // this compound datatype.
- DataType getMemberDataType(unsigned member_num) const;
+ // Returns the generic datatype of the specified member in
+ // this compound datatype.
+ DataType getMemberDataType(unsigned member_num) const;
- // Returns the array datatype of the specified member in
- // this compound datatype.
- ArrayType getMemberArrayType(unsigned member_num) const;
+ // Returns the array datatype of the specified member in
+ // this compound datatype.
+ ArrayType getMemberArrayType(unsigned member_num) const;
- // Returns the compound datatype of the specified member in
- // this compound datatype.
- CompType getMemberCompType(unsigned member_num) const;
+ // Returns the compound datatype of the specified member in
+ // this compound datatype.
+ CompType getMemberCompType(unsigned member_num) const;
- // Returns the enumeration datatype of the specified member in
- // this compound datatype.
- EnumType getMemberEnumType(unsigned member_num) const;
+ // Returns the enumeration datatype of the specified member in
+ // this compound datatype.
+ EnumType getMemberEnumType(unsigned member_num) const;
- // Returns the integer datatype of the specified member in
- // this compound datatype.
- IntType getMemberIntType(unsigned member_num) const;
+ // Returns the integer datatype of the specified member in
+ // this compound datatype.
+ IntType getMemberIntType(unsigned member_num) const;
- // Returns the floating-point datatype of the specified member in
- // this compound datatype.
- FloatType getMemberFloatType(unsigned member_num) const;
+ // Returns the floating-point datatype of the specified member in
+ // this compound datatype.
+ FloatType getMemberFloatType(unsigned member_num) const;
- // Returns the string datatype of the specified member in
- // this compound datatype.
- StrType getMemberStrType(unsigned member_num) const;
+ // Returns the string datatype of the specified member in
+ // this compound datatype.
+ StrType getMemberStrType(unsigned member_num) const;
- // Returns the variable length datatype of the specified member in
- // this compound datatype.
- VarLenType getMemberVarLenType(unsigned member_num) const;
+ // Returns the variable length datatype of the specified member in
+ // this compound datatype.
+ VarLenType getMemberVarLenType(unsigned member_num) const;
- // Returns the number of members in this compound datatype.
- int getNmembers() const;
+ // Returns the number of members in this compound datatype.
+ int getNmembers() const;
- // Adds a new member to this compound datatype.
- void insertMember(const H5std_string& name, size_t offset, const DataType& new_member) const;
+ // Adds a new member to this compound datatype.
+ void insertMember(const H5std_string &name, size_t offset, const DataType &new_member) const;
- // Recursively removes padding from within this compound datatype.
- void pack() const;
+ // Recursively removes padding from within this compound datatype.
+ void pack() const;
- // Sets the total size for this compound datatype.
- void setSize(size_t size) const;
+ // Sets the total size for this compound datatype.
+ void setSize(size_t size) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("CompType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("CompType");
+ }
- // Noop destructor.
- virtual ~CompType();
+ // Noop destructor.
+ virtual ~CompType();
- private:
- // Contains common code that is used by the member functions
- // getMemberXxxType
- hid_t p_get_member_type(unsigned member_num) const;
+ private:
+ // Contains common code that is used by the member functions
+ // getMemberXxxType
+ hid_t p_get_member_type(unsigned member_num) const;
}; // end of CompType
} // namespace H5
diff --git a/c++/src/H5Cpp.h b/c++/src/H5Cpp.h
index 01fae45..e614d69 100644
--- a/c++/src/H5Cpp.h
+++ b/c++/src/H5Cpp.h
@@ -53,9 +53,9 @@
*/
#ifndef H5_CXX_HAVE_OFFSETOF
#ifdef HOFFSET
- #undef HOFFSET
+#undef HOFFSET
#endif
-#define HOFFSET(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#define HOFFSET(TYPE, MEMBER) ((size_t) & ((TYPE *)0)->MEMBER)
#endif
#endif // __H5Cpp_H
diff --git a/c++/src/H5DaccProp.cpp b/c++/src/H5DaccProp.cpp
index c6ff705..1c01b9b 100644
--- a/c++/src/H5DaccProp.cpp
+++ b/c++/src/H5DaccProp.cpp
@@ -29,7 +29,7 @@ namespace H5 {
// in "H5PredType.cpp" for information.
// Initialize a pointer for the constant
-DSetAccPropList* DSetAccPropList::DEFAULT_ = 0;
+DSetAccPropList *DSetAccPropList::DEFAULT_ = 0;
//--------------------------------------------------------------------------
// Function: DSetAccPropList::getConstant
@@ -43,13 +43,13 @@ DSetAccPropList* DSetAccPropList::DEFAULT_ = 0;
// not happen.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-DSetAccPropList* DSetAccPropList::getConstant()
+DSetAccPropList *
+DSetAccPropList::getConstant()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -58,8 +58,9 @@ DSetAccPropList* DSetAccPropList::getConstant()
if (DEFAULT_ == 0)
DEFAULT_ = new DSetAccPropList(H5P_DATASET_ACCESS);
else
- throw PropListIException("DSetAccPropList::getConstant", "DSetAccPropList::getConstant is being invoked on an allocated DEFAULT_");
- return(DEFAULT_);
+ throw PropListIException("DSetAccPropList::getConstant",
+ "DSetAccPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return (DEFAULT_);
}
//--------------------------------------------------------------------------
@@ -68,7 +69,8 @@ DSetAccPropList* DSetAccPropList::getConstant()
// points to.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void DSetAccPropList::deleteConstants()
+void
+DSetAccPropList::deleteConstants()
{
if (DEFAULT_ != 0)
delete DEFAULT_;
@@ -77,7 +79,7 @@ void DSetAccPropList::deleteConstants()
//--------------------------------------------------------------------------
// Purpose Constant for dataset creation default property
//--------------------------------------------------------------------------
-const DSetAccPropList& DSetAccPropList::DEFAULT = *getConstant();
+const DSetAccPropList &DSetAccPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -94,7 +96,7 @@ DSetAccPropList::DSetAccPropList() : LinkAccPropList(H5P_DATASET_ACCESS) {}
/// DSetAccPropList object
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DSetAccPropList::DSetAccPropList(const DSetAccPropList& orig) : LinkAccPropList(orig) {}
+DSetAccPropList::DSetAccPropList(const DSetAccPropList &orig) : LinkAccPropList(orig) {}
//--------------------------------------------------------------------------
// Function: DSetAccPropList overloaded constructor
@@ -122,11 +124,11 @@ DSetAccPropList::DSetAccPropList(const hid_t plist_id) : LinkAccPropList(plist_i
/// the HDF5 C Reference Manual.
// July 2018
//--------------------------------------------------------------------------
-void DSetAccPropList::setChunkCache(size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0) const
+void
+DSetAccPropList::setChunkCache(size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0) const
{
herr_t ret_value = H5Pset_chunk_cache(id, rdcc_nslots, rdcc_nbytes, rdcc_w0);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("DSetAccPropList::setChunkCache", "H5Pset_chunk_cache failed");
}
}
@@ -143,11 +145,11 @@ void DSetAccPropList::setChunkCache(size_t rdcc_nslots, size_t rdcc_nbytes, doub
/// the HDF5 C Reference Manual.
// July 2018
//--------------------------------------------------------------------------
-void DSetAccPropList::getChunkCache(size_t &rdcc_nslots, size_t &rdcc_nbytes, double &rdcc_w0) const
+void
+DSetAccPropList::getChunkCache(size_t &rdcc_nslots, size_t &rdcc_nbytes, double &rdcc_w0) const
{
herr_t ret_value = H5Pget_chunk_cache(id, &rdcc_nslots, &rdcc_nbytes, &rdcc_w0);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("DSetAccPropList::getChunkCache", "H5Pget_chunk_cache failed");
}
}
@@ -159,4 +161,4 @@ void DSetAccPropList::getChunkCache(size_t &rdcc_nslots, size_t &rdcc_nbytes, d
//--------------------------------------------------------------------------
DSetAccPropList::~DSetAccPropList() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5DaccProp.h b/c++/src/H5DaccProp.h
index 111b4f5..a467fac 100644
--- a/c++/src/H5DaccProp.h
+++ b/c++/src/H5DaccProp.h
@@ -23,42 +23,46 @@ namespace H5 {
*/
// Inheritance: LinkAccPropList -> PropList -> IdComponent
class H5_DLLCPP DSetAccPropList : public LinkAccPropList {
- public:
- ///\brief Default dataset creation property list.
- static const DSetAccPropList& DEFAULT;
+ public:
+ ///\brief Default dataset creation property list.
+ static const DSetAccPropList &DEFAULT;
- // Creates a dataset creation property list.
- DSetAccPropList();
+ // Creates a dataset creation property list.
+ DSetAccPropList();
- // Sets the raw data chunk cache parameters.
- void setChunkCache(size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0) const;
+ // Sets the raw data chunk cache parameters.
+ void setChunkCache(size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0) const;
- // Retrieves the raw data chunk cache parameters.
- void getChunkCache(size_t &rdcc_nslots, size_t &rdcc_nbytes, double &rdcc_w0) const;
+ // Retrieves the raw data chunk cache parameters.
+ void getChunkCache(size_t &rdcc_nslots, size_t &rdcc_nbytes, double &rdcc_w0) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("DSetAccPropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("DSetAccPropList");
+ }
- // Copy constructor - same as the original DSetAccPropList.
- DSetAccPropList(const DSetAccPropList& orig);
+ // Copy constructor - same as the original DSetAccPropList.
+ DSetAccPropList(const DSetAccPropList &orig);
- // Creates a copy of an existing dataset creation property list
- // using the property list id.
- DSetAccPropList(const hid_t plist_id);
+ // Creates a copy of an existing dataset creation property list
+ // using the property list id.
+ DSetAccPropList(const hid_t plist_id);
- // Noop destructor.
- virtual ~DSetAccPropList();
+ // Noop destructor.
+ virtual ~DSetAccPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the global constant, should only be used by the library
- static void deleteConstants();
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
- private:
- static DSetAccPropList* DEFAULT_;
+ private:
+ static DSetAccPropList *DEFAULT_;
- // Creates the global constant, should only be used by the library
- static DSetAccPropList* getConstant();
+ // Creates the global constant, should only be used by the library
+ static DSetAccPropList *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index a071289..7720011 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -18,7 +18,7 @@
#endif
#include <string>
-#include "H5private.h" // for HDfree
+#include "H5private.h" // for HDfree
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -73,7 +73,7 @@ DataSet::DataSet(const hid_t existing_id) : H5Object(), AbstractDs(), id(existin
///\param original - IN: DataSet instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSet::DataSet(const DataSet& original) : H5Object(), AbstractDs(), id(original.id)
+DataSet::DataSet(const DataSet &original) : H5Object(), AbstractDs(), id(original.id)
{
incRefCount(); // increment number of references to this id
}
@@ -93,7 +93,8 @@ DataSet::DataSet(const DataSet& original) : H5Object(), AbstractDs(), id(origina
/// is a datatype that has been named by DataType::commit.
// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
-DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), AbstractDs(), id(H5I_INVALID_HID)
+DataSet::DataSet(const H5Location &loc, const void *ref, H5R_type_t ref_type, const PropList &plist)
+ : H5Object(), AbstractDs(), id(H5I_INVALID_HID)
{
id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereferenced");
}
@@ -109,7 +110,8 @@ DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, co
///\exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
-DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), AbstractDs(), id(H5I_INVALID_HID)
+DataSet::DataSet(const Attribute &attr, const void *ref, H5R_type_t ref_type, const PropList &plist)
+ : H5Object(), AbstractDs(), id(H5I_INVALID_HID)
{
id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference");
}
@@ -121,32 +123,32 @@ DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type, co
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSpace DataSet::getSpace() const
+DataSpace
+DataSet::getSpace() const
{
// Calls C function H5Dget_space to get the id of the dataspace
hid_t dataspace_id = H5Dget_space(id);
// If the dataspace id is invalid, throw an exception
- if (dataspace_id < 0)
- {
+ if (dataspace_id < 0) {
throw DataSetIException("DataSet::getSpace", "H5Dget_space failed");
}
- //create dataspace object using the existing id then return the object
+ // create dataspace object using the existing id then return the object
DataSpace data_space;
f_DataSpace_setId(&data_space, dataspace_id);
- return(data_space);
+ return (data_space);
}
// This private member function calls the C API to get the identifier
// of the datatype that is used by this dataset. It is used
// by the various AbstractDs functions to get the specific datatype.
-hid_t DataSet::p_get_type() const
+hid_t
+DataSet::p_get_type() const
{
hid_t type_id = H5Dget_type(id);
if (type_id > 0)
- return(type_id);
- else
- {
+ return (type_id);
+ else {
throw DataSetIException("", "H5Dget_type failed");
}
}
@@ -158,18 +160,18 @@ hid_t DataSet::p_get_type() const
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DSetCreatPropList DataSet::getCreatePlist() const
+DSetCreatPropList
+DataSet::getCreatePlist() const
{
hid_t create_plist_id = H5Dget_create_plist(id);
- if (create_plist_id < 0)
- {
+ if (create_plist_id < 0) {
throw DataSetIException("DataSet::getCreatePlist", "H5Dget_create_plist failed");
}
// create and return the DSetCreatPropList object
DSetCreatPropList create_plist;
f_PropList_setId(&create_plist, create_plist_id);
- return(create_plist);
+ return (create_plist);
}
//--------------------------------------------------------------------------
@@ -179,18 +181,18 @@ DSetCreatPropList DataSet::getCreatePlist() const
///\exception H5::DataSetIException
// July 2018
//--------------------------------------------------------------------------
-DSetAccPropList DataSet::getAccessPlist() const
+DSetAccPropList
+DataSet::getAccessPlist() const
{
hid_t access_plist_id = H5Dget_access_plist(id);
- if (access_plist_id < 0)
- {
+ if (access_plist_id < 0) {
throw DataSetIException("DataSet::getAccessPlist", "H5Dget_access_plist failed");
}
// create and return the DSetCreatPropList object
DSetAccPropList access_plist;
f_PropList_setId(&access_plist, access_plist_id);
- return(access_plist);
+ return (access_plist);
}
//--------------------------------------------------------------------------
@@ -202,10 +204,11 @@ DSetAccPropList DataSet::getAccessPlist() const
// function should have no failure. (from SLU)
// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
-hsize_t DataSet::getStorageSize() const
+hsize_t
+DataSet::getStorageSize() const
{
hsize_t storage_size = H5Dget_storage_size(id);
- return(storage_size);
+ return (storage_size);
}
//--------------------------------------------------------------------------
@@ -215,62 +218,55 @@ hsize_t DataSet::getStorageSize() const
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - Apr 2009
//--------------------------------------------------------------------------
-size_t DataSet::getInMemDataSize() const
+size_t
+DataSet::getInMemDataSize() const
{
const char *func = "DataSet::getInMemDataSize";
// Get the data type of this dataset
hid_t mem_type_id = H5Dget_type(id);
- if (mem_type_id < 0)
- {
+ if (mem_type_id < 0) {
throw DataSetIException(func, "H5Dget_type failed");
}
// Get the data type's size by first getting its native type then getting
// the native type's size.
hid_t native_type = H5Tget_native_type(mem_type_id, H5T_DIR_DEFAULT);
- if (native_type < 0)
- {
+ if (native_type < 0) {
throw DataSetIException(func, "H5Tget_native_type failed");
}
size_t type_size = H5Tget_size(native_type);
- if (type_size == 0)
- {
+ if (type_size == 0) {
throw DataSetIException(func, "H5Tget_size failed");
}
// Close the native type and the datatype of this dataset.
- if (H5Tclose(native_type) < 0)
- {
+ if (H5Tclose(native_type) < 0) {
throw DataSetIException(func, "H5Tclose(native_type) failed");
}
- if (H5Tclose(mem_type_id) < 0)
- {
+ if (H5Tclose(mem_type_id) < 0) {
throw DataSetIException(func, "H5Tclose(mem_type_id) failed");
}
// Get number of elements of the dataset by first getting its dataspace,
// then getting the number of elements in the dataspace
hid_t space_id = H5Dget_space(id);
- if (space_id < 0)
- {
+ if (space_id < 0) {
throw DataSetIException(func, "H5Dget_space failed");
}
hssize_t num_elements = H5Sget_simple_extent_npoints(space_id);
- if (num_elements < 0)
- {
+ if (num_elements < 0) {
throw DataSetIException(func, "H5Sget_simple_extent_npoints failed");
}
// Close the dataspace
- if (H5Sclose(space_id) < 0)
- {
+ if (H5Sclose(space_id) < 0) {
throw DataSetIException(func, "H5Sclose failed");
}
// Calculate and return the size of the data
size_t data_size = type_size * num_elements;
- return(data_size);
+ return (data_size);
}
//--------------------------------------------------------------------------
@@ -280,16 +276,16 @@ size_t DataSet::getInMemDataSize() const
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-haddr_t DataSet::getOffset() const
+haddr_t
+DataSet::getOffset() const
{
haddr_t ds_addr; // for address of dataset
ds_addr = H5Dget_offset(id);
- if (ds_addr == HADDR_UNDEF)
- {
+ if (ds_addr == HADDR_UNDEF) {
throw DataSetIException("DataSet::getOffset", "H5Dget_offset returned HADDR_UNDEF");
}
- return(ds_addr);
+ return (ds_addr);
}
//--------------------------------------------------------------------------
@@ -299,11 +295,11 @@ haddr_t DataSet::getOffset() const
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSet::getSpaceStatus(H5D_space_status_t& status) const
+void
+DataSet::getSpaceStatus(H5D_space_status_t &status) const
{
herr_t ret_value = H5Dget_space_status(id, &status);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSetIException("DataSet::getSpaceStatus", "H5Dget_space_status failed");
}
}
@@ -317,20 +313,20 @@ void DataSet::getSpaceStatus(H5D_space_status_t& status) const
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-hsize_t DataSet::getVlenBufSize(const DataType& type, const DataSpace& space) const
+hsize_t
+DataSet::getVlenBufSize(const DataType &type, const DataSpace &space) const
{
// Obtain identifiers for C API
- hid_t type_id = type.getId();
+ hid_t type_id = type.getId();
hid_t space_id = space.getId();
hsize_t size; // for amount of storage
herr_t ret_value = H5Dvlen_get_buf_size(id, type_id, space_id, &size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSetIException("DataSet::getVlenBufSize", "H5Dvlen_get_buf_size failed");
}
- return(size);
+ return (size);
}
//--------------------------------------------------------------------------
@@ -346,7 +342,7 @@ hsize_t DataSet::getVlenBufSize(const DataType& type, const DataSpace& space) co
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-//hsize_t DataSet::getVlenBufSize(DataType& type, DataSpace& space) const
+// hsize_t DataSet::getVlenBufSize(DataType& type, DataSpace& space) const
//{
// return(getVlenBufSize(type, space));
//}
@@ -362,16 +358,17 @@ hsize_t DataSet::getVlenBufSize(const DataType& type, const DataSpace& space) co
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSet::vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf)
+void
+DataSet::vlenReclaim(const DataType &type, const DataSpace &space, const DSetMemXferPropList &xfer_plist,
+ void *buf)
{
// Obtain identifiers for C API
- hid_t type_id = type.getId();
- hid_t space_id = space.getId();
+ hid_t type_id = type.getId();
+ hid_t space_id = space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
herr_t ret_value = H5Treclaim(type_id, space_id, xfer_plist_id, buf);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSetIException("DataSet::vlenReclaim", "H5Treclaim failed");
}
}
@@ -390,16 +387,17 @@ void DataSet::vlenReclaim(const DataType& type, const DataSpace& space, const DS
// This function has better prototype for the users than the
// other, which might be removed at some point. BMR - 2006/12/20
//--------------------------------------------------------------------------
-void DataSet::vlenReclaim(void* buf, const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist)
+void
+DataSet::vlenReclaim(void *buf, const DataType &type, const DataSpace &space,
+ const DSetMemXferPropList &xfer_plist)
{
// Obtain identifiers for C API
- hid_t type_id = type.getId();
- hid_t space_id = space.getId();
+ hid_t type_id = type.getId();
+ hid_t space_id = space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
herr_t ret_value = H5Treclaim(type_id, space_id, xfer_plist_id, buf);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSetIException("DataSet::vlenReclaim", "H5Treclaim failed");
}
}
@@ -419,17 +417,18 @@ void DataSet::vlenReclaim(void* buf, const DataType& type, const DataSpace& spac
/// to memory datatype \a mem_type and dataspace \a mem_space.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSet::read(void* buf, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist) const
+void
+DataSet::read(void *buf, const DataType &mem_type, const DataSpace &mem_space, const DataSpace &file_space,
+ const DSetMemXferPropList &xfer_plist) const
{
// Obtain identifiers for C API
- hid_t mem_type_id = mem_type.getId();
- hid_t mem_space_id = mem_space.getId();
+ hid_t mem_type_id = mem_type.getId();
+ hid_t mem_space_id = mem_space.getId();
hid_t file_space_id = file_space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSetIException("DataSet::read", "H5Dread failed");
}
}
@@ -453,28 +452,28 @@ void DataSet::read(void* buf, const DataType& mem_type, const DataSpace& mem_spa
// DataSet::p_read_fixed_len and
// DataSet::p_read_variable_len
//--------------------------------------------------------------------------
-void DataSet::read(H5std_string& strg, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist) const
+void
+DataSet::read(H5std_string &strg, const DataType &mem_type, const DataSpace &mem_space,
+ const DataSpace &file_space, const DSetMemXferPropList &xfer_plist) const
{
// Check if this dataset has variable-len string or fixed-len string and
// proceed appropriately.
htri_t is_variable_len = H5Tis_variable_str(mem_type.getId());
- if (is_variable_len < 0)
- {
+ if (is_variable_len < 0) {
throw DataSetIException("DataSet::read", "H5Tis_variable_str failed");
}
// Obtain identifiers for C API
- hid_t mem_type_id = mem_type.getId();
- hid_t mem_space_id = mem_space.getId();
+ hid_t mem_type_id = mem_type.getId();
+ hid_t mem_space_id = mem_space.getId();
hid_t file_space_id = file_space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
- if (!is_variable_len) // only allocate for fixed-len string
+ if (!is_variable_len) // only allocate for fixed-len string
{
p_read_fixed_len(mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg);
}
- else
- {
+ else {
p_read_variable_len(mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg);
}
}
@@ -495,17 +494,18 @@ void DataSet::read(H5std_string& strg, const DataType& mem_type, const DataSpace
/// and dataspace.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSet::write(const void* buf, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist) const
+void
+DataSet::write(const void *buf, const DataType &mem_type, const DataSpace &mem_space,
+ const DataSpace &file_space, const DSetMemXferPropList &xfer_plist) const
{
// Obtain identifiers for C API
- hid_t mem_type_id = mem_type.getId();
- hid_t mem_space_id = mem_space.getId();
+ hid_t mem_type_id = mem_type.getId();
+ hid_t mem_space_id = mem_space.getId();
hid_t file_space_id = file_space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
herr_t ret_value = H5Dwrite(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSetIException("DataSet::write", "H5Dwrite failed");
}
}
@@ -520,39 +520,37 @@ void DataSet::write(const void* buf, const DataType& mem_type, const DataSpace&
// Modified to pass the buffer into H5Dwrite properly depending
// whether the dataset has variable- or fixed-length string.
//--------------------------------------------------------------------------
-void DataSet::write(const H5std_string& strg, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist) const
+void
+DataSet::write(const H5std_string &strg, const DataType &mem_type, const DataSpace &mem_space,
+ const DataSpace &file_space, const DSetMemXferPropList &xfer_plist) const
{
// Check if this attribute has variable-len string or fixed-len string and
// proceed appropriately.
htri_t is_variable_len = H5Tis_variable_str(mem_type.getId());
- if (is_variable_len < 0)
- {
+ if (is_variable_len < 0) {
throw DataSetIException("DataSet::write", "H5Tis_variable_str failed");
}
// Obtain identifiers for C API
- hid_t mem_type_id = mem_type.getId();
- hid_t mem_space_id = mem_space.getId();
+ hid_t mem_type_id = mem_type.getId();
+ hid_t mem_space_id = mem_space.getId();
hid_t file_space_id = file_space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
// Convert string to C-string
- const char* strg_C;
- strg_C = strg.c_str(); // strg_C refers to the contents of strg as a C-str
+ const char *strg_C;
+ strg_C = strg.c_str(); // strg_C refers to the contents of strg as a C-str
herr_t ret_value = 0;
// Pass string in differently depends on variable or fixed length
- if (!is_variable_len)
- {
+ if (!is_variable_len) {
ret_value = H5Dwrite(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C);
}
- else
- {
+ else {
// passing string argument by address
ret_value = H5Dwrite(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, &strg_C);
}
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSetIException("DataSet::write", "H5Dwrite failed");
}
}
@@ -574,15 +572,17 @@ void DataSet::write(const H5std_string& strg, const DataType& mem_type, const Da
/// under development.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int DataSet::iterateElems(void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data)
+int
+DataSet::iterateElems(void *buf, const DataType &type, const DataSpace &space, H5D_operator_t op,
+ void *op_data)
{
// Obtain identifiers for C API
- hid_t type_id = type.getId();
- hid_t space_id = space.getId();
+ hid_t type_id = type.getId();
+ hid_t space_id = space.getId();
herr_t ret_value = H5Diterate(buf, type_id, space_id, op, op_data);
if (ret_value >= 0)
- return(ret_value);
- else // raise exception when H5Diterate returns a negative value
+ return (ret_value);
+ else // raise exception when H5Diterate returns a negative value
{
throw DataSetIException("DataSet::iterateElems", "H5Diterate failed");
}
@@ -598,10 +598,11 @@ int DataSet::iterateElems(void* buf, const DataType& type, const DataSpace& spac
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSet::extend(const hsize_t* size) const
+void
+DataSet::extend(const hsize_t *size) const
{
herr_t ret_value = H5Dset_extent(id, size);
- if (ret_value < 0) // raise exception when H5Dset_extent returns a neg value
+ if (ret_value < 0) // raise exception when H5Dset_extent returns a neg value
throw DataSetIException("DataSet::extend", "H5Dset_extent failed");
}
@@ -616,14 +617,15 @@ void DataSet::extend(const hsize_t* size) const
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2014
//--------------------------------------------------------------------------
-void DataSet::fillMemBuf(const void *fill, const DataType& fill_type, void *buf, const DataType& buf_type, const DataSpace& space) const
+void
+DataSet::fillMemBuf(const void *fill, const DataType &fill_type, void *buf, const DataType &buf_type,
+ const DataSpace &space) const
{
- hid_t fill_type_id = fill_type.getId();
- hid_t buf_type_id = buf_type.getId();
- hid_t space_id = space.getId();
- herr_t ret_value = H5Dfill(fill, fill_type_id, buf, buf_type_id, space_id);
- if (ret_value < 0)
- {
+ hid_t fill_type_id = fill_type.getId();
+ hid_t buf_type_id = buf_type.getId();
+ hid_t space_id = space.getId();
+ herr_t ret_value = H5Dfill(fill, fill_type_id, buf, buf_type_id, space_id);
+ if (ret_value < 0) {
throw DataSetIException("DataSet::fillMemBuf", "H5Dfill failed");
}
}
@@ -645,7 +647,8 @@ void DataSet::fillMemBuf(const void *fill, const DataType& fill_type, void *buf,
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-//void DataSet::fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space)
+// void DataSet::fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace&
+// space)
//{
// fillMemBuf(fill, (const DataType)fill_type, buf, (const DataType)buf_type, (const DataSpace)space);
//}
@@ -659,13 +662,13 @@ void DataSet::fillMemBuf(const void *fill, const DataType& fill_type, void *buf,
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSet::fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& space) const
+void
+DataSet::fillMemBuf(void *buf, const DataType &buf_type, const DataSpace &space) const
{
- hid_t buf_type_id = buf_type.getId();
- hid_t space_id = space.getId();
- herr_t ret_value = H5Dfill(NULL, buf_type_id, buf, buf_type_id, space_id);
- if (ret_value < 0)
- {
+ hid_t buf_type_id = buf_type.getId();
+ hid_t space_id = space.getId();
+ herr_t ret_value = H5Dfill(NULL, buf_type_id, buf, buf_type_id, space_id);
+ if (ret_value < 0) {
throw DataSetIException("DataSet::fillMemBuf", "H5Dfill failed");
}
}
@@ -685,7 +688,7 @@ void DataSet::fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& s
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-//void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space)
+// void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space)
//{
// fillMemBuf(buf, (const DataType)buf_type, (const DataSpace)space);
//}
@@ -701,9 +704,10 @@ void DataSet::fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& s
// IdComponent::getId now becomes pure virtual function.
// Programmer Binh-Minh Ribler - May, 2008
//--------------------------------------------------------------------------
-hid_t DataSet::getId() const
+hid_t
+DataSet::getId() const
{
- return(id);
+ return (id);
}
//--------------------------------------------------------------------------
@@ -717,7 +721,9 @@ hid_t DataSet::getId() const
// Jul 2009
// Added in follow to the change in Attribute::read
//--------------------------------------------------------------------------
-void DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const
+void
+DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id,
+ const hid_t xfer_plist_id, H5std_string &strg) const
{
// Only allocate for fixed-len string.
@@ -725,22 +731,20 @@ void DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id
size_t data_size = getInMemDataSize();
// If there is data, allocate buffer and read it.
- if (data_size > 0)
- {
- char *strg_C = new char [data_size+1];
- HDmemset(strg_C, 0, data_size+1); // clear buffer
+ if (data_size > 0) {
+ char *strg_C = new char[data_size + 1];
+ HDmemset(strg_C, 0, data_size + 1); // clear buffer
herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C);
- if (ret_value < 0)
- {
- delete []strg_C; // de-allocate for fixed-len string
+ if (ret_value < 0) {
+ delete[] strg_C; // de-allocate for fixed-len string
throw DataSetIException("DataSet::read", "H5Dread failed for fixed length string");
}
// Get string from the C char* and release resource allocated locally
strg = strg_C;
- delete []strg_C;
+ delete[] strg_C;
}
}
@@ -755,7 +759,9 @@ void DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id
// Jul 2009
// Added in follow to the change in Attribute::read
//--------------------------------------------------------------------------
-void DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const
+void
+DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id,
+ const hid_t xfer_plist_id, H5std_string &strg) const
{
// Prepare and call C API to read dataset.
char *strg_C;
@@ -763,8 +769,7 @@ void DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space
// Read dataset, no allocation for variable-len string; C library will
herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, &strg_C);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSetIException("DataSet::read", "H5Dread failed for variable length string");
}
@@ -786,17 +791,18 @@ void DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space
// Then the object's id is reset to the new id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSet::p_setId(const hid_t new_id)
+void
+DataSet::p_setId(const hid_t new_id)
{
// handling references to this old id
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw DataSetIException(inMemFunc("p_setId"), close_error.getDetailMsg());
}
- // reset object's id to the given id
- id = new_id;
+ // reset object's id to the given id
+ id = new_id;
}
//--------------------------------------------------------------------------
@@ -809,7 +815,8 @@ void DataSet::p_setId(const hid_t new_id)
// param new_id - IN: New id to set
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void f_PropList_setId(PropList* plist, hid_t new_id)
+void
+f_PropList_setId(PropList *plist, hid_t new_id)
{
plist->p_setId(new_id);
}
@@ -823,13 +830,12 @@ void f_PropList_setId(PropList* plist, hid_t new_id)
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
-void DataSet::close()
+void
+DataSet::close()
{
- if (p_valid_id(id))
- {
+ if (p_valid_id(id)) {
herr_t ret_value = H5Dclose(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSetIException("DataSet::close", "H5Dclose failed");
}
// reset the id
@@ -852,9 +858,9 @@ DataSet::~DataSet()
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
cerr << "DataSet::~DataSet - " << close_error.getDetailMsg() << endl;
}
}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h
index a0a962e..0bf7589 100644
--- a/c++/src/H5DataSet.h
+++ b/c++/src/H5DataSet.h
@@ -26,109 +26,129 @@ namespace H5 {
*/
// Inheritance: multiple H5Object/AbstractDs -> H5Location -> IdComponent
class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
- public:
-
- // Close this dataset.
- virtual void close();
-
- // Extends the dataset with unlimited dimension.
- void extend(const hsize_t* size) const;
-
- // Fills a selection in memory with a value
- void fillMemBuf(const void *fill, const DataType& fill_type, void *buf, const DataType& buf_type, const DataSpace& space) const;
- //void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1
-
- // Fills a selection in memory with zero
- void fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& space) const;
- //void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1
-
- // Gets the creation property list of this dataset.
- DSetCreatPropList getCreatePlist() const;
-
- // Gets the access property list of this dataset.
- DSetAccPropList getAccessPlist() const;
-
- // Returns the address of this dataset in the file.
- haddr_t getOffset() const;
-
- // Gets the dataspace of this dataset.
- virtual DataSpace getSpace() const;
-
- // Determines whether space has been allocated for a dataset.
- void getSpaceStatus(H5D_space_status_t& status) const;
-
- // Returns the amount of storage size required for this dataset.
- virtual hsize_t getStorageSize() const;
-
- // Returns the in memory size of this attribute's data.
- virtual size_t getInMemDataSize() const;
-
- // Returns the number of bytes required to store VL data.
- hsize_t getVlenBufSize(const DataType& type, const DataSpace& space) const;
- //hsize_t getVlenBufSize(DataType& type, DataSpace& space) const; // removed from 1.8.18 and 1.10.1
-
- // Reclaims VL datatype memory buffers.
- static void vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf);
- static void vlenReclaim(void *buf, const DataType& type, const DataSpace& space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT);
-
- // Reads the data of this dataset and stores it in the provided buffer.
- // The memory and file dataspaces and the transferring property list
- // can be defaults.
- void read(void* buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT) const;
- void read(H5std_string& buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT) const;
-
- // Writes the buffered data to this dataset.
- // The memory and file dataspaces and the transferring property list
- // can be defaults.
- void write(const void* buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT) const;
- void write(const H5std_string& buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT) const;
-
- // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet
- int iterateElems(void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data = NULL);
-
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("DataSet"); }
-
- // Creates a dataset by way of dereference.
- DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
- DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
-
- // Default constructor.
- DataSet();
-
- // Copy constructor - same as the original DataSet.
- DataSet(const DataSet& original);
-
- // Creates a copy of an existing DataSet using its id.
- DataSet(const hid_t existing_id);
-
- // Gets the dataset id.
- virtual hid_t getId() const;
-
- // Destructor: properly terminates access to this dataset.
- virtual ~DataSet();
-
- protected:
+ public:
+ // Close this dataset.
+ virtual void close();
+
+ // Extends the dataset with unlimited dimension.
+ void extend(const hsize_t *size) const;
+
+ // Fills a selection in memory with a value
+ void fillMemBuf(const void *fill, const DataType &fill_type, void *buf, const DataType &buf_type,
+ const DataSpace &space) const;
+ // void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace&
+ // space); // removed from 1.8.18 and 1.10.1
+
+ // Fills a selection in memory with zero
+ void fillMemBuf(void *buf, const DataType &buf_type, const DataSpace &space) const;
+ // void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1
+
+ // Gets the creation property list of this dataset.
+ DSetCreatPropList getCreatePlist() const;
+
+ // Gets the access property list of this dataset.
+ DSetAccPropList getAccessPlist() const;
+
+ // Returns the address of this dataset in the file.
+ haddr_t getOffset() const;
+
+ // Gets the dataspace of this dataset.
+ virtual DataSpace getSpace() const;
+
+ // Determines whether space has been allocated for a dataset.
+ void getSpaceStatus(H5D_space_status_t &status) const;
+
+ // Returns the amount of storage size required for this dataset.
+ virtual hsize_t getStorageSize() const;
+
+ // Returns the in memory size of this attribute's data.
+ virtual size_t getInMemDataSize() const;
+
+ // Returns the number of bytes required to store VL data.
+ hsize_t getVlenBufSize(const DataType &type, const DataSpace &space) const;
+ // hsize_t getVlenBufSize(DataType& type, DataSpace& space) const; // removed from 1.8.18 and 1.10.1
+
+ // Reclaims VL datatype memory buffers.
+ static void vlenReclaim(const DataType &type, const DataSpace &space,
+ const DSetMemXferPropList &xfer_plist, void *buf);
+ static void vlenReclaim(void *buf, const DataType &type, const DataSpace &space = DataSpace::ALL,
+ const DSetMemXferPropList &xfer_plist = DSetMemXferPropList::DEFAULT);
+
+ // Reads the data of this dataset and stores it in the provided buffer.
+ // The memory and file dataspaces and the transferring property list
+ // can be defaults.
+ void read(void *buf, const DataType &mem_type, const DataSpace &mem_space = DataSpace::ALL,
+ const DataSpace & file_space = DataSpace::ALL,
+ const DSetMemXferPropList &xfer_plist = DSetMemXferPropList::DEFAULT) const;
+ void read(H5std_string &buf, const DataType &mem_type, const DataSpace &mem_space = DataSpace::ALL,
+ const DataSpace & file_space = DataSpace::ALL,
+ const DSetMemXferPropList &xfer_plist = DSetMemXferPropList::DEFAULT) const;
+
+ // Writes the buffered data to this dataset.
+ // The memory and file dataspaces and the transferring property list
+ // can be defaults.
+ void write(const void *buf, const DataType &mem_type, const DataSpace &mem_space = DataSpace::ALL,
+ const DataSpace & file_space = DataSpace::ALL,
+ const DSetMemXferPropList &xfer_plist = DSetMemXferPropList::DEFAULT) const;
+ void write(const H5std_string &buf, const DataType &mem_type, const DataSpace &mem_space = DataSpace::ALL,
+ const DataSpace & file_space = DataSpace::ALL,
+ const DSetMemXferPropList &xfer_plist = DSetMemXferPropList::DEFAULT) const;
+
+ // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet
+ int iterateElems(void *buf, const DataType &type, const DataSpace &space, H5D_operator_t op,
+ void *op_data = NULL);
+
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("DataSet");
+ }
+
+ // Creates a dataset by way of dereference.
+ DataSet(const H5Location &loc, const void *ref, H5R_type_t ref_type = H5R_OBJECT,
+ const PropList &plist = PropList::DEFAULT);
+ DataSet(const Attribute &attr, const void *ref, H5R_type_t ref_type = H5R_OBJECT,
+ const PropList &plist = PropList::DEFAULT);
+
+ // Default constructor.
+ DataSet();
+
+ // Copy constructor - same as the original DataSet.
+ DataSet(const DataSet &original);
+
+ // Creates a copy of an existing DataSet using its id.
+ DataSet(const hid_t existing_id);
+
+ // Gets the dataset id.
+ virtual hid_t getId() const;
+
+ // Destructor: properly terminates access to this dataset.
+ virtual ~DataSet();
+
+ protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Sets the dataset id.
- virtual void p_setId(const hid_t new_id);
+ // Sets the dataset id.
+ virtual void p_setId(const hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
- private:
- hid_t id; // HDF5 dataset id
+ private:
+ hid_t id; // HDF5 dataset id
- // This function contains the common code that is used by
- // getTypeClass and various API functions getXxxType
- // defined in AbstractDs for generic datatype and specific
- // sub-types
- virtual hid_t p_get_type() const;
+ // This function contains the common code that is used by
+ // getTypeClass and various API functions getXxxType
+ // defined in AbstractDs for generic datatype and specific
+ // sub-types
+ virtual hid_t p_get_type() const;
- // Reads variable or fixed len strings from this dataset.
- void p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const;
- void p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const;
+ // Reads variable or fixed len strings from this dataset.
+ void p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id,
+ const hid_t xfer_plist_id, H5std_string &strg) const;
+ void p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id,
+ const hid_t xfer_plist_id, H5std_string &strg) const;
- // Friend function to set DataSet id. For library use only.
- friend void f_DataSet_setId(DataSet* dset, hid_t new_id);
+ // Friend function to set DataSet id. For library use only.
+ friend void f_DataSet_setId(DataSet *dset, hid_t new_id);
}; // end of DataSet
} // namespace H5
diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp
index e8e5712..47fdbbc 100644
--- a/c++/src/H5DataSpace.cpp
+++ b/c++/src/H5DataSpace.cpp
@@ -33,7 +33,7 @@ using std::endl;
// in "H5PredType.cpp" for information.
// Initialize a pointer for the constant
-DataSpace* DataSpace::ALL_ = 0;
+DataSpace *DataSpace::ALL_ = 0;
//--------------------------------------------------------------------------
// Function: DataSpace::getConstant
@@ -45,13 +45,13 @@ DataSpace* DataSpace::ALL_ = 0;
// a DataSpaceIException. This scenario should not happen.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-DataSpace* DataSpace::getConstant()
+DataSpace *
+DataSpace::getConstant()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -60,8 +60,9 @@ DataSpace* DataSpace::getConstant()
if (ALL_ == 0)
ALL_ = new DataSpace(H5S_ALL);
else
- throw DataSpaceIException("DataSpace::getConstant", "DataSpace::getConstant is being invoked on an allocated ALL_");
- return(ALL_);
+ throw DataSpaceIException("DataSpace::getConstant",
+ "DataSpace::getConstant is being invoked on an allocated ALL_");
+ return (ALL_);
}
//--------------------------------------------------------------------------
@@ -69,7 +70,8 @@ DataSpace* DataSpace::getConstant()
// Purpose: Deletes the constant object that DataSpace::ALL_ points to
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void DataSpace::deleteConstants()
+void
+DataSpace::deleteConstants()
{
if (ALL_ != 0)
delete ALL_;
@@ -78,7 +80,7 @@ void DataSpace::deleteConstants()
//--------------------------------------------------------------------------
// Purpose Constant for default dataspace.
//--------------------------------------------------------------------------
-const DataSpace& DataSpace::ALL = *getConstant();
+const DataSpace &DataSpace::ALL = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -94,8 +96,7 @@ const DataSpace& DataSpace::ALL = *getConstant();
DataSpace::DataSpace(H5S_class_t type) : IdComponent()
{
id = H5Screate(type);
- if (id < 0)
- {
+ if (id < 0) {
throw DataSpaceIException("DataSpace constructor", "H5Screate failed");
}
}
@@ -109,11 +110,10 @@ DataSpace::DataSpace(H5S_class_t type) : IdComponent()
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSpace::DataSpace(int rank, const hsize_t * dims, const hsize_t * maxdims) : IdComponent()
+DataSpace::DataSpace(int rank, const hsize_t *dims, const hsize_t *maxdims) : IdComponent()
{
id = H5Screate_simple(rank, dims, maxdims);
- if (id < 0)
- {
+ if (id < 0) {
throw DataSpaceIException("DataSpace constructor", "H5Screate_simple failed");
}
}
@@ -137,7 +137,7 @@ DataSpace::DataSpace(const hid_t existing_id) : IdComponent(), id(existing_id)
///\param original - IN: DataSpace object to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSpace::DataSpace(const DataSpace& original) : IdComponent(), id(original.id)
+DataSpace::DataSpace(const DataSpace &original) : IdComponent(), id(original.id)
{
incRefCount(); // increment number of references to this id
}
@@ -154,17 +154,18 @@ DataSpace::DataSpace(const DataSpace& original) : IdComponent(), id(original.id)
// - Replaced decRefCount with close() to let the C library
// handle the reference counting - BMR, Jun 1, 2006
//--------------------------------------------------------------------------
-void DataSpace::copy(const DataSpace& like_space)
+void
+DataSpace::copy(const DataSpace &like_space)
{
// If this object has an hdf5 valid id, close it
if (id != H5S_ALL) {
try {
close();
}
- catch (Exception& close_error) {
- throw DataSpaceIException("DataSpace::copy", close_error.getDetailMsg());
+ catch (Exception &close_error) {
+ throw DataSpaceIException("DataSpace::copy", close_error.getDetailMsg());
}
- } // end if
+ } // end if
// call C routine to copy the dataspace
id = H5Scopy(like_space.getId());
@@ -184,11 +185,12 @@ void DataSpace::copy(const DataSpace& like_space)
// the new id in the left hand side object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSpace& DataSpace::operator=(const DataSpace& rhs)
+DataSpace &
+DataSpace::operator=(const DataSpace &rhs)
{
if (this != &rhs)
copy(rhs);
- return(*this);
+ return (*this);
}
//--------------------------------------------------------------------------
@@ -199,17 +201,16 @@ DataSpace& DataSpace::operator=(const DataSpace& rhs)
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-bool DataSpace::isSimple () const
+bool
+DataSpace::isSimple() const
{
htri_t simple = H5Sis_simple(id);
if (simple > 0)
return true;
else if (simple == 0)
return false;
- else
- {
- throw DataSpaceIException("DataSpace::isSimple",
- "H5Sis_simple returns negative value");
+ else {
+ throw DataSpaceIException("DataSpace::isSimple", "H5Sis_simple returns negative value");
}
}
@@ -225,11 +226,11 @@ bool DataSpace::isSimple () const
/// it to be re-defined.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::offsetSimple (const hssize_t* offset) const
+void
+DataSpace::offsetSimple(const hssize_t *offset) const
{
herr_t ret_value = H5Soffset_simple(id, offset);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSpaceIException("DataSpace::offsetSimple", "H5Soffset_simple failed");
}
}
@@ -244,15 +245,15 @@ void DataSpace::offsetSimple (const hssize_t* offset) const
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int DataSpace::getSimpleExtentDims (hsize_t *dims, hsize_t *maxdims) const
+int
+DataSpace::getSimpleExtentDims(hsize_t *dims, hsize_t *maxdims) const
{
int ndims = H5Sget_simple_extent_dims(id, dims, maxdims);
- if (ndims < 0)
- {
+ if (ndims < 0) {
throw DataSpaceIException("DataSpace::getSimpleExtentDims",
- "H5Sget_simple_extent_dims returns negative number of dimensions");
+ "H5Sget_simple_extent_dims returns negative number of dimensions");
}
- return(ndims);
+ return (ndims);
}
//--------------------------------------------------------------------------
@@ -262,15 +263,16 @@ int DataSpace::getSimpleExtentDims (hsize_t *dims, hsize_t *maxdims) const
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int DataSpace::getSimpleExtentNdims () const
+int
+DataSpace::getSimpleExtentNdims() const
{
int ndims = H5Sget_simple_extent_ndims(id);
- if (ndims < 0)
- {
- throw DataSpaceIException("DataSpace::getSimpleExtentNdims",
+ if (ndims < 0) {
+ throw DataSpaceIException(
+ "DataSpace::getSimpleExtentNdims",
"H5Sget_simple_extent_ndims returns negative value for dimensionality of the dataspace");
}
- return(ndims);
+ return (ndims);
}
//--------------------------------------------------------------------------
@@ -284,15 +286,16 @@ int DataSpace::getSimpleExtentNdims () const
// num_elements = -1 when failure occurs vs. 0
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-hssize_t DataSpace::getSimpleExtentNpoints () const
+hssize_t
+DataSpace::getSimpleExtentNpoints() const
{
hssize_t num_elements = H5Sget_simple_extent_npoints(id);
if (num_elements > -1)
- return(num_elements);
- else
- {
+ return (num_elements);
+ else {
throw DataSpaceIException("DataSpace::getSimpleExtentNpoints",
- "H5Sget_simple_extent_npoints returns negative value for the number of elements in the dataspace");
+ "H5Sget_simple_extent_npoints returns negative value for the number of "
+ "elements in the dataspace");
}
}
@@ -303,15 +306,15 @@ hssize_t DataSpace::getSimpleExtentNpoints () const
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5S_class_t DataSpace::getSimpleExtentType () const
+H5S_class_t
+DataSpace::getSimpleExtentType() const
{
H5S_class_t class_name = H5Sget_simple_extent_type(id);
- if (class_name == H5S_NO_CLASS)
- {
+ if (class_name == H5S_NO_CLASS) {
throw DataSpaceIException("DataSpace::getSimpleExtentType",
- "H5Sget_simple_extent_type returns H5S_NO_CLASS");
+ "H5Sget_simple_extent_type returns H5S_NO_CLASS");
}
- return(class_name);
+ return (class_name);
}
//--------------------------------------------------------------------------
@@ -321,12 +324,12 @@ H5S_class_t DataSpace::getSimpleExtentType () const
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::extentCopy (const DataSpace& dest_space) const
+void
+DataSpace::extentCopy(const DataSpace &dest_space) const
{
- hid_t dest_space_id = dest_space.getId();
- herr_t ret_value = H5Sextent_copy(dest_space_id, id);
- if (ret_value < 0)
- {
+ hid_t dest_space_id = dest_space.getId();
+ herr_t ret_value = H5Sextent_copy(dest_space_id, id);
+ if (ret_value < 0) {
throw DataSpaceIException("DataSpace::extentCopy", "H5Sextent_copy failed");
}
}
@@ -344,7 +347,7 @@ void DataSpace::extentCopy (const DataSpace& dest_space) const
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-//void DataSpace::extentCopy(DataSpace& dest_space) const
+// void DataSpace::extentCopy(DataSpace& dest_space) const
//{
// extentCopy(dest_space);
//}
@@ -358,12 +361,12 @@ void DataSpace::extentCopy (const DataSpace& dest_space) const
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::setExtentSimple(int rank, const hsize_t *current_size, const hsize_t *maximum_size) const
+void
+DataSpace::setExtentSimple(int rank, const hsize_t *current_size, const hsize_t *maximum_size) const
{
herr_t ret_value;
ret_value = H5Sset_extent_simple(id, rank, current_size, maximum_size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSpaceIException("DataSpace::setExtentSimple", "H5Sset_extent_simple failed");
}
}
@@ -375,11 +378,11 @@ void DataSpace::setExtentSimple(int rank, const hsize_t *current_size, const hsi
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::setExtentNone () const
+void
+DataSpace::setExtentNone() const
{
herr_t ret_value = H5Sset_extent_none(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSpaceIException("DataSpace::setExtentNone", "H5Sset_extent_none failed");
}
}
@@ -391,15 +394,16 @@ void DataSpace::setExtentNone () const
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-hssize_t DataSpace::getSelectNpoints () const
+hssize_t
+DataSpace::getSelectNpoints() const
{
hssize_t num_elements = H5Sget_select_npoints(id);
- if (num_elements < 0)
- {
- throw DataSpaceIException("DataSpace::getSelectNpoints",
+ if (num_elements < 0) {
+ throw DataSpaceIException(
+ "DataSpace::getSelectNpoints",
"H5Sget_select_npoints returns negative value for number of elements in the dataspace selection");
}
- return(num_elements);
+ return (num_elements);
}
//--------------------------------------------------------------------------
@@ -409,15 +413,16 @@ hssize_t DataSpace::getSelectNpoints () const
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-hssize_t DataSpace::getSelectHyperNblocks () const
+hssize_t
+DataSpace::getSelectHyperNblocks() const
{
hssize_t num_blocks = H5Sget_select_hyper_nblocks(id);
- if (num_blocks < 0)
- {
- throw DataSpaceIException("DataSpace::getSelectHyperNblocks",
+ if (num_blocks < 0) {
+ throw DataSpaceIException(
+ "DataSpace::getSelectHyperNblocks",
"H5Sget_select_hyper_nblocks returns negative value for the number of hyperslab blocks");
}
- return(num_blocks);
+ return (num_blocks);
}
//--------------------------------------------------------------------------
@@ -429,14 +434,14 @@ hssize_t DataSpace::getSelectHyperNblocks () const
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::getSelectHyperBlocklist(hsize_t startblock, hsize_t numblocks, hsize_t *buf) const
+void
+DataSpace::getSelectHyperBlocklist(hsize_t startblock, hsize_t numblocks, hsize_t *buf) const
{
herr_t ret_value;
ret_value = H5Sget_select_hyper_blocklist(id, startblock, numblocks, buf);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSpaceIException("DataSpace::getSelectHyperBlocklist",
- "H5Sget_select_hyper_blocklist failed");
+ "H5Sget_select_hyper_blocklist failed");
}
}
@@ -447,15 +452,14 @@ void DataSpace::getSelectHyperBlocklist(hsize_t startblock, hsize_t numblocks, h
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-hssize_t DataSpace::getSelectElemNpoints () const
+hssize_t
+DataSpace::getSelectElemNpoints() const
{
hssize_t num_points = H5Sget_select_elem_npoints(id);
- if (num_points < 0)
- {
- throw DataSpaceIException("DataSpace::getSelectElemNpoints",
- "H5Sget_select_elem_npoints failed");
+ if (num_points < 0) {
+ throw DataSpaceIException("DataSpace::getSelectElemNpoints", "H5Sget_select_elem_npoints failed");
}
- return(num_points);
+ return (num_points);
}
//--------------------------------------------------------------------------
@@ -470,14 +474,13 @@ hssize_t DataSpace::getSelectElemNpoints () const
/// H5Sget_select_elem_pointlist in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::getSelectElemPointlist (hsize_t startpoint, hsize_t numpoints, hsize_t *buf) const
+void
+DataSpace::getSelectElemPointlist(hsize_t startpoint, hsize_t numpoints, hsize_t *buf) const
{
herr_t ret_value;
ret_value = H5Sget_select_elem_pointlist(id, startpoint, numpoints, buf);
- if (ret_value < 0)
- {
- throw DataSpaceIException("DataSpace::getSelectElemPointlist",
- "H5Sget_select_elem_pointlist failed");
+ if (ret_value < 0) {
+ throw DataSpaceIException("DataSpace::getSelectElemPointlist", "H5Sget_select_elem_pointlist failed");
}
}
@@ -493,13 +496,12 @@ void DataSpace::getSelectElemPointlist (hsize_t startpoint, hsize_t numpoints, h
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::getSelectBounds (hsize_t* start, hsize_t* end) const
+void
+DataSpace::getSelectBounds(hsize_t *start, hsize_t *end) const
{
herr_t ret_value = H5Sget_select_bounds(id, start, end);
- if (ret_value < 0)
- {
- throw DataSpaceIException("DataSpace::getSelectBounds",
- "H5Sget_select_bounds failed");
+ if (ret_value < 0) {
+ throw DataSpaceIException("DataSpace::getSelectBounds", "H5Sget_select_bounds failed");
}
}
@@ -518,14 +520,13 @@ void DataSpace::getSelectBounds (hsize_t* start, hsize_t* end) const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::selectElements (H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const
+void
+DataSpace::selectElements(H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const
{
herr_t ret_value;
ret_value = H5Sselect_elements(id, op, num_elements, coord);
- if (ret_value < 0)
- {
- throw DataSpaceIException("DataSpace::selectElements",
- "H5Sselect_elements failed");
+ if (ret_value < 0) {
+ throw DataSpaceIException("DataSpace::selectElements", "H5Sselect_elements failed");
}
}
@@ -536,11 +537,11 @@ void DataSpace::selectElements (H5S_seloper_t op, const size_t num_elements, con
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::selectAll () const
+void
+DataSpace::selectAll() const
{
herr_t ret_value = H5Sselect_all(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSpaceIException("DataSpace::selectAll", "H5Sselect_all failed");
}
}
@@ -552,13 +553,12 @@ void DataSpace::selectAll () const
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::selectNone () const
+void
+DataSpace::selectNone() const
{
herr_t ret_value = H5Sselect_none(id);
- if (ret_value < 0)
- {
- throw DataSpaceIException("DataSpace::selectNone",
- "H5Sselect_none failed");
+ if (ret_value < 0) {
+ throw DataSpaceIException("DataSpace::selectNone", "H5Sselect_none failed");
}
}
@@ -571,17 +571,16 @@ void DataSpace::selectNone () const
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-bool DataSpace::selectValid () const
+bool
+DataSpace::selectValid() const
{
htri_t ret_value = H5Sselect_valid(id);
if (ret_value > 0)
return true;
else if (ret_value == 0)
return false;
- else
- {
- throw DataSpaceIException("DataSpace::selectValid",
- "H5Sselect_valid returns negative value");
+ else {
+ throw DataSpaceIException("DataSpace::selectValid", "H5Sselect_valid returns negative value");
}
}
@@ -599,14 +598,14 @@ bool DataSpace::selectValid () const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::selectHyperslab(H5S_seloper_t op, const hsize_t *count, const hsize_t *start, const hsize_t *stride, const hsize_t *block) const
+void
+DataSpace::selectHyperslab(H5S_seloper_t op, const hsize_t *count, const hsize_t *start,
+ const hsize_t *stride, const hsize_t *block) const
{
herr_t ret_value;
ret_value = H5Sselect_hyperslab(id, op, start, stride, count, block);
- if (ret_value < 0)
- {
- throw DataSpaceIException("DataSpace::selectHyperslab",
- "H5Sselect_hyperslab failed");
+ if (ret_value < 0) {
+ throw DataSpaceIException("DataSpace::selectHyperslab", "H5Sselect_hyperslab failed");
}
}
@@ -622,9 +621,10 @@ void DataSpace::selectHyperslab(H5S_seloper_t op, const hsize_t *count, const hs
// IdComponent::getId now becomes pure virtual function.
// Programmer Binh-Minh Ribler - May, 2008
//--------------------------------------------------------------------------
-hid_t DataSpace::getId() const
+hid_t
+DataSpace::getId() const
{
- return(id);
+ return (id);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -640,13 +640,14 @@ hid_t DataSpace::getId() const
// Then the object's id is reset to the new id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::p_setId(const hid_t new_id)
+void
+DataSpace::p_setId(const hid_t new_id)
{
// handling references to this old id
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw DataSpaceIException(inMemFunc("p_setId"), close_error.getDetailMsg());
}
// reset object's id to the given id
@@ -661,14 +662,13 @@ void DataSpace::p_setId(const hid_t new_id)
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
-void DataSpace::close()
+void
+DataSpace::close()
{
// check if id is a valid hdf5 object id before trying to close it
- if (p_valid_id(id))
- {
+ if (p_valid_id(id)) {
herr_t ret_value = H5Sclose(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataSpaceIException("DataSpace::close", "H5Sclose failed");
}
// reset the id
@@ -690,9 +690,10 @@ DataSpace::~DataSpace()
{
try {
close();
- } catch (Exception& close_error) {
+ }
+ catch (Exception &close_error) {
cerr << "DataSpace::~DataSpace - " << close_error.getDetailMsg() << endl;
}
}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h
index 54c68ac..b5e92bc 100644
--- a/c++/src/H5DataSpace.h
+++ b/c++/src/H5DataSpace.h
@@ -23,127 +23,132 @@ namespace H5 {
*/
// Inheritance: IdComponent
class H5_DLLCPP DataSpace : public IdComponent {
- public:
- ///\brief Default DataSpace objects
- static const DataSpace& ALL;
+ public:
+ ///\brief Default DataSpace objects
+ static const DataSpace &ALL;
- // Creates a dataspace object given the space type
- DataSpace(H5S_class_t type = H5S_SCALAR);
+ // Creates a dataspace object given the space type
+ DataSpace(H5S_class_t type = H5S_SCALAR);
- // Creates a simple dataspace
- DataSpace(int rank, const hsize_t * dims, const hsize_t * maxdims = NULL);
+ // Creates a simple dataspace
+ DataSpace(int rank, const hsize_t *dims, const hsize_t *maxdims = NULL);
- // Creates a DataSpace object using an existing dataspace id.
- DataSpace(const hid_t space_id);
+ // Creates a DataSpace object using an existing dataspace id.
+ DataSpace(const hid_t space_id);
- // Copy constructor - same as the original DataSpace.
- DataSpace(const DataSpace& original);
+ // Copy constructor - same as the original DataSpace.
+ DataSpace(const DataSpace &original);
- // Assignment operator
- DataSpace& operator=(const DataSpace& rhs);
+ // Assignment operator
+ DataSpace &operator=(const DataSpace &rhs);
- // Closes this dataspace.
- virtual void close();
+ // Closes this dataspace.
+ virtual void close();
- // Makes copy of an existing dataspace.
- void copy(const DataSpace& like_space);
+ // Makes copy of an existing dataspace.
+ void copy(const DataSpace &like_space);
- // Copies the extent of this dataspace.
- void extentCopy(const DataSpace& dest_space) const;
- // removed from 1.8.18 and 1.10.1
- //void extentCopy(DataSpace& dest_space) const;
+ // Copies the extent of this dataspace.
+ void extentCopy(const DataSpace &dest_space) const;
+ // removed from 1.8.18 and 1.10.1
+ // void extentCopy(DataSpace& dest_space) const;
- // Gets the bounding box containing the current selection.
- void getSelectBounds(hsize_t* start, hsize_t* end) const;
+ // Gets the bounding box containing the current selection.
+ void getSelectBounds(hsize_t *start, hsize_t *end) const;
- // Gets the number of element points in the current selection.
- hssize_t getSelectElemNpoints() const;
+ // Gets the number of element points in the current selection.
+ hssize_t getSelectElemNpoints() const;
- // Retrieves the list of element points currently selected.
- void getSelectElemPointlist(hsize_t startpoint, hsize_t numpoints, hsize_t *buf) const;
+ // Retrieves the list of element points currently selected.
+ void getSelectElemPointlist(hsize_t startpoint, hsize_t numpoints, hsize_t *buf) const;
- // Gets the list of hyperslab blocks currently selected.
- void getSelectHyperBlocklist(hsize_t startblock, hsize_t numblocks, hsize_t *buf) const;
+ // Gets the list of hyperslab blocks currently selected.
+ void getSelectHyperBlocklist(hsize_t startblock, hsize_t numblocks, hsize_t *buf) const;
- // Get number of hyperslab blocks.
- hssize_t getSelectHyperNblocks() const;
+ // Get number of hyperslab blocks.
+ hssize_t getSelectHyperNblocks() const;
- // Gets the number of elements in this dataspace selection.
- hssize_t getSelectNpoints() const;
+ // Gets the number of elements in this dataspace selection.
+ hssize_t getSelectNpoints() const;
- // Retrieves dataspace dimension size and maximum size.
- int getSimpleExtentDims(hsize_t *dims, hsize_t *maxdims = NULL) const;
+ // Retrieves dataspace dimension size and maximum size.
+ int getSimpleExtentDims(hsize_t *dims, hsize_t *maxdims = NULL) const;
- // Gets the dimensionality of this dataspace.
- int getSimpleExtentNdims() const;
+ // Gets the dimensionality of this dataspace.
+ int getSimpleExtentNdims() const;
- // Gets the number of elements in this dataspace.
- // 12/05/00 - changed return type to hssize_t from hsize_t - C API
- hssize_t getSimpleExtentNpoints() const;
+ // Gets the number of elements in this dataspace.
+ // 12/05/00 - changed return type to hssize_t from hsize_t - C API
+ hssize_t getSimpleExtentNpoints() const;
- // Gets the current class of this dataspace.
- H5S_class_t getSimpleExtentType() const;
+ // Gets the current class of this dataspace.
+ H5S_class_t getSimpleExtentType() const;
- // Determines if this dataspace is a simple one.
- bool isSimple() const;
+ // Determines if this dataspace is a simple one.
+ bool isSimple() const;
- // Sets the offset of this simple dataspace.
- void offsetSimple(const hssize_t* offset) const;
+ // Sets the offset of this simple dataspace.
+ void offsetSimple(const hssize_t *offset) const;
- // Selects the entire dataspace.
- void selectAll() const;
+ // Selects the entire dataspace.
+ void selectAll() const;
- // Selects array elements to be included in the selection for
- // this dataspace.
- void selectElements(H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const;
+ // Selects array elements to be included in the selection for
+ // this dataspace.
+ void selectElements(H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const;
- // Selects a hyperslab region to add to the current selected region.
- void selectHyperslab(H5S_seloper_t op, const hsize_t *count, const hsize_t *start, const hsize_t *stride = NULL, const hsize_t *block = NULL) const;
+ // Selects a hyperslab region to add to the current selected region.
+ void selectHyperslab(H5S_seloper_t op, const hsize_t *count, const hsize_t *start,
+ const hsize_t *stride = NULL, const hsize_t *block = NULL) const;
- // Resets the selection region to include no elements.
- void selectNone() const;
+ // Resets the selection region to include no elements.
+ void selectNone() const;
- // Verifies that the selection is within the extent of the dataspace.
- bool selectValid() const;
+ // Verifies that the selection is within the extent of the dataspace.
+ bool selectValid() const;
- // Removes the extent from this dataspace.
- void setExtentNone() const;
+ // Removes the extent from this dataspace.
+ void setExtentNone() const;
- // Sets or resets the size of this dataspace.
- void setExtentSimple(int rank, const hsize_t *current_size, const hsize_t *maximum_size = NULL) const;
+ // Sets or resets the size of this dataspace.
+ void setExtentSimple(int rank, const hsize_t *current_size, const hsize_t *maximum_size = NULL) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("DataSpace"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("DataSpace");
+ }
- // Gets the dataspace id.
- virtual hid_t getId() const;
+ // Gets the dataspace id.
+ virtual hid_t getId() const;
- // Deletes the global constant
- static void deleteConstants();
+ // Deletes the global constant
+ static void deleteConstants();
- // Destructor: properly terminates access to this dataspace.
- virtual ~DataSpace();
+ // Destructor: properly terminates access to this dataspace.
+ virtual ~DataSpace();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- protected:
- // Sets the dataspace id.
- virtual void p_setId(const hid_t new_id);
+ protected:
+ // Sets the dataspace id.
+ virtual void p_setId(const hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
- private:
- hid_t id; // HDF5 dataspace id
+ private:
+ hid_t id; // HDF5 dataspace id
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- static DataSpace* ALL_;
+ static DataSpace *ALL_;
- // Creates the global constant
- static DataSpace* getConstant();
+ // Creates the global constant
+ static DataSpace *getConstant();
- // Friend function to set DataSpace id. For library use only.
- friend void f_DataSpace_setId(DataSpace *dspace, hid_t new_id);
+ // Friend function to set DataSpace id. For library use only.
+ friend void f_DataSpace_setId(DataSpace *dspace, hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index 0472975..565fb9a 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -82,8 +82,7 @@ DataType::DataType(const H5T_class_t type_class, size_t size) : H5Object(), enco
{
// Call C routine to create the new datatype
id = H5Tcreate(type_class, size);
- if (id < 0)
- {
+ if (id < 0) {
throw DataTypeIException("DataType constructor", "H5Tcreate failed");
}
}
@@ -99,7 +98,8 @@ DataType::DataType(const H5T_class_t type_class, size_t size) : H5Object(), enco
///\exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
-DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), encoded_buf(NULL), buf_size(0)
+DataType::DataType(const H5Location &loc, const void *ref, H5R_type_t ref_type, const PropList &plist)
+ : H5Object(), encoded_buf(NULL), buf_size(0)
{
id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference");
}
@@ -118,18 +118,19 @@ DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type,
// Jul, 2008
// Added for application convenience.
//--------------------------------------------------------------------------
- /* DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(H5I_INVALID_HID), encoded_buf(NULL), buf_size(0)
+/* DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) :
+H5Object(), id(H5I_INVALID_HID), encoded_buf(NULL), buf_size(0)
{
- id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference");
+ id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference");
}
- */
+*/
//--------------------------------------------------------------------------
// Function: DataType copy constructor
///\brief Copy constructor: same HDF5 object as \a original
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataType::DataType(const DataType& original) : H5Object(), id(original.id), encoded_buf(NULL), buf_size(0)
+DataType::DataType(const DataType &original) : H5Object(), id(original.id), encoded_buf(NULL), buf_size(0)
{
incRefCount(); // increment number of references to this id
}
@@ -147,7 +148,7 @@ DataType::DataType(const DataType& original) : H5Object(), id(original.id), enco
// unnecessarily and will produce undefined behavior.
// -BMR, Apr 2015
//--------------------------------------------------------------------------
-DataType::DataType(const PredType& pred_type) : H5Object(), encoded_buf(NULL), buf_size(0)
+DataType::DataType(const PredType &pred_type) : H5Object(), encoded_buf(NULL), buf_size(0)
{
// Call C routine to copy the datatype
id = H5Tcopy(pred_type.getId());
@@ -169,7 +170,7 @@ DataType::DataType(const PredType& pred_type) : H5Object(), encoded_buf(NULL), b
// improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-DataType::DataType(const H5Location& loc, const char *dtype_name) : H5Object(), encoded_buf(NULL), buf_size(0)
+DataType::DataType(const H5Location &loc, const char *dtype_name) : H5Object(), encoded_buf(NULL), buf_size(0)
{
id = p_opentype(loc, dtype_name);
}
@@ -188,7 +189,8 @@ DataType::DataType(const H5Location& loc, const char *dtype_name) : H5Object(),
// improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-DataType::DataType(const H5Location& loc, const H5std_string& dtype_name) : H5Object(), encoded_buf(NULL), buf_size(0)
+DataType::DataType(const H5Location &loc, const H5std_string &dtype_name)
+ : H5Object(), encoded_buf(NULL), buf_size(0)
{
id = p_opentype(loc, dtype_name.c_str());
}
@@ -205,13 +207,14 @@ DataType::DataType(const H5Location& loc, const H5std_string& dtype_name) : H5Ob
// - Replaced decRefCount with close() to let the C library
// handle the reference counting - BMR, Jun 1, 2006
//--------------------------------------------------------------------------
-void DataType::copy(const DataType& like_type)
+void
+DataType::copy(const DataType &like_type)
{
// close the current data type before copying like_type to this object
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw DataTypeIException(inMemFunc("copy"), close_error.getDetailMsg());
}
@@ -230,13 +233,14 @@ void DataType::copy(const DataType& like_type)
///\par Description
/// The resulted dataset will be transient and modifiable.
//--------------------------------------------------------------------------
-void DataType::copy(const DataSet& dset)
+void
+DataType::copy(const DataSet &dset)
{
// close the current data type before copying dset's datatype to this object
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw DataTypeIException(inMemFunc("copy"), close_error.getDetailMsg());
}
@@ -254,11 +258,11 @@ void DataType::copy(const DataSet& dset)
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-hid_t DataType::p_decode() const
+hid_t
+DataType::p_decode() const
{
// Make sure that the buffer can be decoded
- if (encoded_buf == NULL)
- {
+ if (encoded_buf == NULL) {
throw DataTypeIException("DataType::p_decode", "No encoded buffer");
}
@@ -266,13 +270,11 @@ hid_t DataType::p_decode() const
hid_t encoded_dtype_id = H5Tdecode(encoded_buf);
// If H5Tdecode fails, raise exception
- if (encoded_dtype_id < 0)
- {
+ if (encoded_dtype_id < 0) {
throw DataTypeIException("DataType::p_decode", "H5Tdecode failed");
}
- else
- {
- return(encoded_dtype_id);
+ else {
+ return (encoded_dtype_id);
}
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -285,7 +287,8 @@ hid_t DataType::p_decode() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-DataType* DataType::decode() const
+DataType *
+DataType::decode() const
{
hid_t encoded_dtype_id = H5I_INVALID_HID;
try {
@@ -296,7 +299,7 @@ DataType* DataType::decode() const
}
DataType *encoded_dtype = new DataType;
encoded_dtype->p_setId(encoded_dtype_id);
- return(encoded_dtype);
+ return (encoded_dtype);
}
//--------------------------------------------------------------------------
@@ -306,27 +309,24 @@ DataType* DataType::decode() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-void DataType::encode()
+void
+DataType::encode()
{
// Call H5Tencode passing in null to determine the size of the buffer
herr_t ret_value = H5Tencode(id, NULL, &buf_size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("DataType::encode", "Failed to get buf_size");
}
// Allocate buffer and call C function again to encode
- if (buf_size > 0)
- {
+ if (buf_size > 0) {
encoded_buf = (unsigned char *)HDcalloc((size_t)1, buf_size);
- ret_value = H5Tencode(id, encoded_buf, &buf_size);
- if (ret_value < 0)
- {
+ ret_value = H5Tencode(id, encoded_buf, &buf_size);
+ if (ret_value < 0) {
throw DataTypeIException("DataType::encode", "H5Tencode failed");
}
}
- else
- {
+ else {
throw DataTypeIException("DataType::encode", "Failed to allocate buffer for encoding");
}
}
@@ -339,7 +339,8 @@ void DataType::encode()
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-bool DataType::hasBinaryDesc() const
+bool
+DataType::hasBinaryDesc() const
{
if (encoded_buf != NULL)
return true;
@@ -366,13 +367,13 @@ bool DataType::hasBinaryDesc() const
// transient datatype.
// BMR - Mar, 2015
//--------------------------------------------------------------------------
-DataType& DataType::operator=(const DataType& rhs)
+DataType &
+DataType::operator=(const DataType &rhs)
{
- if (this != &rhs)
- {
+ if (this != &rhs) {
setId(rhs.id);
}
- return(*this);
+ return (*this);
}
//--------------------------------------------------------------------------
@@ -384,7 +385,8 @@ DataType& DataType::operator=(const DataType& rhs)
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-bool DataType::operator==(const DataType& compared_type) const
+bool
+DataType::operator==(const DataType &compared_type) const
{
// Call C routine H5Tequal to determines whether two datatype
// identifiers refer to the same datatype
@@ -393,8 +395,7 @@ bool DataType::operator==(const DataType& compared_type) const
return true;
else if (ret_value == 0)
return false;
- else
- {
+ else {
throw DataTypeIException(inMemFunc("operator=="), "H5Tequal returns negative value");
}
}
@@ -408,7 +409,8 @@ bool DataType::operator==(const DataType& compared_type) const
///\exception H5::DataTypeIException
// July, 2018
//--------------------------------------------------------------------------
-bool DataType::operator!=(const DataType& compared_type) const
+bool
+DataType::operator!=(const DataType &compared_type) const
{
return !operator==(compared_type);
}
@@ -427,7 +429,8 @@ bool DataType::operator!=(const DataType& compared_type) const
// to be commonly used by several overloads of DataType::commit.
// BMR - Jan, 2007
//--------------------------------------------------------------------------
-void DataType::p_commit(hid_t loc_id, const char* name)
+void
+DataType::p_commit(hid_t loc_id, const char *name)
{
// Call C routine to commit the transient datatype
herr_t ret_value = H5Tcommit2(loc_id, name, id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -444,7 +447,8 @@ void DataType::p_commit(hid_t loc_id, const char* name)
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Jan, 2007
//--------------------------------------------------------------------------
-void DataType::commit(const H5Location& loc, const char* name)
+void
+DataType::commit(const H5Location &loc, const char *name)
{
p_commit(loc.getId(), name);
}
@@ -463,7 +467,7 @@ void DataType::commit(const H5Location& loc, const char* name)
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-//void DataType::commit(H5Location& loc, const char* name)
+// void DataType::commit(H5Location& loc, const char* name)
//{
// p_commit(loc.getId(), name);
//}
@@ -475,7 +479,8 @@ void DataType::commit(const H5Location& loc, const char* name)
/// argument \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::commit(const H5Location& loc, const H5std_string& name)
+void
+DataType::commit(const H5Location &loc, const H5std_string &name)
{
p_commit(loc.getId(), name.c_str());
}
@@ -494,7 +499,7 @@ void DataType::commit(const H5Location& loc, const H5std_string& name)
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-//void DataType::commit(H5Location& loc, const H5std_string& name)
+// void DataType::commit(H5Location& loc, const H5std_string& name)
//{
// p_commit(loc.getId(), name.c_str());
//}
@@ -508,7 +513,8 @@ void DataType::commit(const H5Location& loc, const H5std_string& name)
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-bool DataType::committed() const
+bool
+DataType::committed() const
{
// Call C function to determine if a datatype is a named one
htri_t is_committed = H5Tcommitted(id);
@@ -516,8 +522,7 @@ bool DataType::committed() const
return true;
else if (is_committed == 0)
return false;
- else
- {
+ else {
throw DataTypeIException(inMemFunc("committed"), "H5Tcommitted return negative value");
}
}
@@ -532,15 +537,15 @@ bool DataType::committed() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5T_conv_t DataType::find(const DataType& dest, H5T_cdata_t **pcdata) const
+H5T_conv_t
+DataType::find(const DataType &dest, H5T_cdata_t **pcdata) const
{
// Call C routine to find the conversion function
H5T_conv_t func = H5Tfind(id, dest.getId(), pcdata);
- if (func == NULL)
- {
+ if (func == NULL) {
throw DataTypeIException(inMemFunc("find"), "H5Tfind returns a NULL function");
}
- return(func);
+ return (func);
}
//--------------------------------------------------------------------------
@@ -556,17 +561,18 @@ H5T_conv_t DataType::find(const DataType& dest, H5T_cdata_t **pcdata) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::convert(const DataType& dest, size_t nelmts, void *buf, void *background, const PropList& plist) const
+void
+DataType::convert(const DataType &dest, size_t nelmts, void *buf, void *background,
+ const PropList &plist) const
{
// Get identifiers for C API
- hid_t dest_id = dest.getId();
+ hid_t dest_id = dest.getId();
hid_t plist_id = plist.getId();
// Call C routine H5Tconvert to convert the data
herr_t ret_value;
ret_value = H5Tconvert(id, dest_id, nelmts, buf, background, plist_id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("convert"), "H5Tconvert failed");
}
}
@@ -585,12 +591,12 @@ void DataType::convert(const DataType& dest, size_t nelmts, void *buf, void *bac
/// the entire library is closed.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::lock() const
+void
+DataType::lock() const
{
// Call C routine to lock the datatype
herr_t ret_value = H5Tlock(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("lock"), "H5Tlock failed");
}
}
@@ -602,16 +608,16 @@ void DataType::lock() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5T_class_t DataType::getClass() const
+H5T_class_t
+DataType::getClass() const
{
H5T_class_t type_class = H5Tget_class(id);
// Return datatype class identifier if successful
- if (type_class == H5T_NO_CLASS)
- {
+ if (type_class == H5T_NO_CLASS) {
throw DataTypeIException(inMemFunc("getClass"), "H5Tget_class returns H5T_NO_CLASS");
}
- return(type_class);
+ return (type_class);
}
//--------------------------------------------------------------------------
@@ -621,15 +627,16 @@ H5T_class_t DataType::getClass() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-size_t DataType::getSize() const
+size_t
+DataType::getSize() const
{
// Call C routine to get the datatype size
size_t type_size = H5Tget_size(id);
- if (type_size <= 0) // valid data types are never zero size
+ if (type_size <= 0) // valid data types are never zero size
{
throw DataTypeIException(inMemFunc("getSize"), "H5Tget_size returns invalid datatype size");
}
- return(type_size);
+ return (type_size);
}
//--------------------------------------------------------------------------
@@ -639,7 +646,8 @@ size_t DataType::getSize() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataType DataType::getSuper() const
+DataType
+DataType::getSuper() const
{
// Call C routine to get the base datatype from which the specified
// datatype is derived.
@@ -647,14 +655,12 @@ DataType DataType::getSuper() const
// If H5Tget_super returns a valid datatype id, create and return
// the base type, otherwise, raise exception
- if (base_type_id > 0)
- {
+ if (base_type_id > 0) {
DataType base_type;
base_type.p_setId(base_type_id);
- return(base_type);
+ return (base_type);
}
- else
- {
+ else {
throw DataTypeIException(inMemFunc("getSuper"), "H5Tget_super failed");
}
}
@@ -675,14 +681,14 @@ DataType DataType::getSuper() const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::registerFunc(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func) const
+void
+DataType::registerFunc(H5T_pers_t pers, const char *name, const DataType &dest, H5T_conv_t func) const
{
- hid_t dest_id = dest.getId(); // get id of the destination datatype
+ hid_t dest_id = dest.getId(); // get id of the destination datatype
// Call C routine H5Tregister to register the conversion function
herr_t ret_value = H5Tregister(pers, name, id, dest_id, func);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("registerFunc"), "H5Tregister failed");
}
}
@@ -694,7 +700,8 @@ void DataType::registerFunc(H5T_pers_t pers, const char* name, const DataType& d
/// argument \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::registerFunc(H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func) const
+void
+DataType::registerFunc(H5T_pers_t pers, const H5std_string &name, const DataType &dest, H5T_conv_t func) const
{
registerFunc(pers, name.c_str(), dest, func);
}
@@ -712,14 +719,14 @@ void DataType::registerFunc(H5T_pers_t pers, const H5std_string& name, const Dat
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::unregister(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func) const
+void
+DataType::unregister(H5T_pers_t pers, const char *name, const DataType &dest, H5T_conv_t func) const
{
- hid_t dest_id = dest.getId(); // get id of the dest datatype for C API
+ hid_t dest_id = dest.getId(); // get id of the dest datatype for C API
// Call C routine H5Tunregister to remove the conversion function
herr_t ret_value = H5Tunregister(pers, name, id, dest_id, func);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("unregister"), "H5Tunregister failed");
}
}
@@ -731,7 +738,8 @@ void DataType::unregister(H5T_pers_t pers, const char* name, const DataType& des
/// argument \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::unregister(H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func) const
+void
+DataType::unregister(H5T_pers_t pers, const H5std_string &name, const DataType &dest, H5T_conv_t func) const
{
unregister(pers, name.c_str(), dest, func);
}
@@ -744,12 +752,12 @@ void DataType::unregister(H5T_pers_t pers, const H5std_string& name, const DataT
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::setTag(const char* tag) const
+void
+DataType::setTag(const char *tag) const
{
// Call C routine H5Tset_tag to tag an opaque datatype.
herr_t ret_value = H5Tset_tag(id, tag);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("setTag"), "H5Tset_tag failed");
}
}
@@ -761,7 +769,8 @@ void DataType::setTag(const char* tag) const
/// argument \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::setTag(const H5std_string& tag) const
+void
+DataType::setTag(const H5std_string &tag) const
{
setTag(tag.c_str());
}
@@ -773,20 +782,19 @@ void DataType::setTag(const H5std_string& tag) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string DataType::getTag() const
+H5std_string
+DataType::getTag() const
{
- char* tag_Cstr = H5Tget_tag(id);
+ char *tag_Cstr = H5Tget_tag(id);
// if the tag C-string returned is not NULL, convert it to C++ string
// and return it, otherwise, raise an exception
- if (tag_Cstr != NULL)
- {
+ if (tag_Cstr != NULL) {
H5std_string tag = H5std_string(tag_Cstr); // C string to string object
- H5free_memory(tag_Cstr); // free the C string
- return (tag); // return the tag
+ H5free_memory(tag_Cstr); // free the C string
+ return (tag); // return the tag
}
- else
- {
+ else {
throw DataTypeIException(inMemFunc("getTag"), "H5Tget_tag returns NULL for tag");
}
}
@@ -800,17 +808,16 @@ H5std_string DataType::getTag() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-bool DataType::detectClass(H5T_class_t cls) const
+bool
+DataType::detectClass(H5T_class_t cls) const
{
htri_t ret_value = H5Tdetect_class(id, cls);
if (ret_value > 0)
return true;
else if (ret_value == 0)
return false;
- else
- {
- throw DataTypeIException(inMemFunc("detectClass"),
- "H5Tdetect_class returns negative value");
+ else {
+ throw DataTypeIException(inMemFunc("detectClass"), "H5Tdetect_class returns negative value");
}
}
@@ -822,17 +829,16 @@ bool DataType::detectClass(H5T_class_t cls) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - August, 2017
//--------------------------------------------------------------------------
-bool DataType::detectClass(const PredType& pred_type, H5T_class_t cls)
+bool
+DataType::detectClass(const PredType &pred_type, H5T_class_t cls)
{
htri_t ret_value = H5Tdetect_class(pred_type.getId(), cls);
if (ret_value > 0)
return true;
else if (ret_value == 0)
return false;
- else
- {
- throw DataTypeIException("detectClass on PredType",
- "H5Tdetect_class returns negative value");
+ else {
+ throw DataTypeIException("detectClass on PredType", "H5Tdetect_class returns negative value");
}
}
@@ -844,17 +850,16 @@ bool DataType::detectClass(const PredType& pred_type, H5T_class_t cls)
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-bool DataType::isVariableStr() const
+bool
+DataType::isVariableStr() const
{
htri_t is_varlen_str = H5Tis_variable_str(id);
if (is_varlen_str == 1)
return true;
else if (is_varlen_str == 0)
return false;
- else
- {
- throw DataTypeIException(inMemFunc("isVariableStr"),
- "H5Tis_variable_str returns negative value");
+ else {
+ throw DataTypeIException(inMemFunc("isVariableStr"), "H5Tis_variable_str returns negative value");
}
}
@@ -869,18 +874,17 @@ bool DataType::isVariableStr() const
// Currently, there is no datatype creation property list class
// in the C++ API because there is no associated functionality.
//--------------------------------------------------------------------------
-PropList DataType::getCreatePlist() const
+PropList
+DataType::getCreatePlist() const
{
hid_t create_plist_id = H5Tget_create_plist(id);
- if (create_plist_id < 0)
- {
- throw DataTypeIException(inMemFunc("getCreatePlist"),
- "H5Tget_create_plist returns negative value");
+ if (create_plist_id < 0) {
+ throw DataTypeIException(inMemFunc("getCreatePlist"), "H5Tget_create_plist returns negative value");
}
// create and return the DSetCreatPropList object
PropList create_plist;
f_PropList_setId(&create_plist, create_plist_id);
- return(create_plist);
+ return (create_plist);
}
//--------------------------------------------------------------------------
@@ -895,9 +899,10 @@ PropList DataType::getCreatePlist() const
// IdComponent::getId now becomes pure virtual function.
// Programmer Binh-Minh Ribler - May, 2008
//--------------------------------------------------------------------------
-hid_t DataType::getId() const
+hid_t
+DataType::getId() const
{
- return(id);
+ return (id);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -912,13 +917,14 @@ hid_t DataType::getId() const
// This function was introduced in 1.10.1 to be used by the new
// XxxType constructors that open a datatype. -BMR, Dec 2016
//--------------------------------------------------------------------------
-hid_t DataType::p_opentype(const H5Location& loc, const char *dtype_name) const
+hid_t
+DataType::p_opentype(const H5Location &loc, const char *dtype_name) const
{
// Call C function to open the named datatype at this location
hid_t ret_value = H5Topen2(loc.getId(), dtype_name, H5P_DEFAULT);
if (ret_value < 0)
throw DataTypeIException(inMemFunc("constructor"), "H5Topen2 failed");
- return(ret_value);
+ return (ret_value);
}
//--------------------------------------------------------------------------
@@ -933,13 +939,14 @@ hid_t DataType::p_opentype(const H5Location& loc, const char *dtype_name) const
// Then the object's id is reset to the new id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::p_setId(const hid_t new_id)
+void
+DataType::p_setId(const hid_t new_id)
{
// handling references to this old id
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw DataTypeIException(inMemFunc("p_setId"), close_error.getDetailMsg());
}
// reset object's id to the given id
@@ -954,21 +961,19 @@ void DataType::p_setId(const hid_t new_id)
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
-void DataType::close()
+void
+DataType::close()
{
- if (p_valid_id(id))
- {
+ if (p_valid_id(id)) {
herr_t ret_value = H5Tclose(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException(inMemFunc("close"), "H5Tclose failed");
}
// Reset the id
id = H5I_INVALID_HID;
// Free and reset buffer of encoded object description if it's been used
- if (encoded_buf != NULL)
- {
+ if (encoded_buf != NULL) {
HDfree(encoded_buf);
buf_size = 0;
}
@@ -995,13 +1000,12 @@ void DataType::close()
//--------------------------------------------------------------------------
DataType::~DataType()
{
- try
- {
+ try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
cerr << inMemFunc("~DataType - ") << close_error.getDetailMsg() << endl;
}
}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h
index e4d9e4b..32badfe 100644
--- a/c++/src/H5DataType.h
+++ b/c++/src/H5DataType.h
@@ -26,152 +26,159 @@ namespace H5 {
*/
// Inheritance: DataType -> H5Object -> H5Location -> IdComponent
class H5_DLLCPP DataType : public H5Object {
- public:
- // Creates a datatype given its class and size
- DataType(const H5T_class_t type_class, size_t size);
+ public:
+ // Creates a datatype given its class and size
+ DataType(const H5T_class_t type_class, size_t size);
- // Copy constructor - same as the original DataType.
- DataType(const DataType& original);
+ // Copy constructor - same as the original DataType.
+ DataType(const DataType &original);
- // Creates a copy of a predefined type
- DataType(const PredType& pred_type);
+ // Creates a copy of a predefined type
+ DataType(const PredType &pred_type);
- // Constructors to open a generic named datatype at a given location.
- DataType(const H5Location& loc, const char* name);
- DataType(const H5Location& loc, const H5std_string& name);
+ // Constructors to open a generic named datatype at a given location.
+ DataType(const H5Location &loc, const char *name);
+ DataType(const H5Location &loc, const H5std_string &name);
- // Creates a datatype by way of dereference.
- DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
-// DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
+ // Creates a datatype by way of dereference.
+ DataType(const H5Location &loc, const void *ref, H5R_type_t ref_type = H5R_OBJECT,
+ const PropList &plist = PropList::DEFAULT);
+ // DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const
+ // PropList& plist = PropList::DEFAULT);
- // Closes this datatype.
- virtual void close();
+ // Closes this datatype.
+ virtual void close();
- // Copies an existing datatype to this datatype object.
- void copy(const DataType& like_type);
+ // Copies an existing datatype to this datatype object.
+ void copy(const DataType &like_type);
- // Copies the datatype of dset to this datatype object.
- void copy(const DataSet& dset);
+ // Copies the datatype of dset to this datatype object.
+ void copy(const DataSet &dset);
- // Returns a DataType instance by decoding the binary object
- // description of this datatype.
- virtual DataType* decode() const;
+ // Returns a DataType instance by decoding the binary object
+ // description of this datatype.
+ virtual DataType *decode() const;
- // Creates a binary object description of this datatype.
- void encode();
+ // Creates a binary object description of this datatype.
+ void encode();
- // Returns the datatype class identifier.
- H5T_class_t getClass() const;
+ // Returns the datatype class identifier.
+ H5T_class_t getClass() const;
- // Commits a transient datatype to a file; this datatype becomes
- // a named datatype which can be accessed from the location.
- void commit(const H5Location& loc, const char* name);
- void commit(const H5Location& loc, const H5std_string& name);
+ // Commits a transient datatype to a file; this datatype becomes
+ // a named datatype which can be accessed from the location.
+ void commit(const H5Location &loc, const char *name);
+ void commit(const H5Location &loc, const H5std_string &name);
- // These two overloaded functions are kept for backward compatibility
- // only; they missed the const - removed from 1.8.18 and 1.10.1
- //void commit(H5Location& loc, const char* name);
- //void commit(H5Location& loc, const H5std_string& name);
+ // These two overloaded functions are kept for backward compatibility
+ // only; they missed the const - removed from 1.8.18 and 1.10.1
+ // void commit(H5Location& loc, const char* name);
+ // void commit(H5Location& loc, const H5std_string& name);
- // Determines whether this datatype is a named datatype or
- // a transient datatype.
- bool committed() const;
+ // Determines whether this datatype is a named datatype or
+ // a transient datatype.
+ bool committed() const;
- // Finds a conversion function that can handle the conversion
- // this datatype to the given datatype, dest.
- H5T_conv_t find(const DataType& dest, H5T_cdata_t **pcdata) const;
+ // Finds a conversion function that can handle the conversion
+ // this datatype to the given datatype, dest.
+ H5T_conv_t find(const DataType &dest, H5T_cdata_t **pcdata) const;
- // Converts data from between specified datatypes.
- void convert(const DataType& dest, size_t nelmts, void *buf, void *background, const PropList& plist=PropList::DEFAULT) const;
+ // Converts data from between specified datatypes.
+ void convert(const DataType &dest, size_t nelmts, void *buf, void *background,
+ const PropList &plist = PropList::DEFAULT) const;
- // Assignment operator
- DataType& operator=(const DataType& rhs);
+ // Assignment operator
+ DataType &operator=(const DataType &rhs);
- // Determines whether two datatypes are the same.
- bool operator==(const DataType& compared_type) const;
+ // Determines whether two datatypes are the same.
+ bool operator==(const DataType &compared_type) const;
- // Determines whether two datatypes are not the same.
- bool operator!=(const DataType& compared_type) const;
+ // Determines whether two datatypes are not the same.
+ bool operator!=(const DataType &compared_type) const;
- // Locks a datatype.
- void lock() const;
+ // Locks a datatype.
+ void lock() const;
- // Returns the size of a datatype.
- size_t getSize() const;
+ // Returns the size of a datatype.
+ size_t getSize() const;
- // Returns the base datatype from which a datatype is derived.
- // Note: not quite right for specific types yet???
- DataType getSuper() const;
+ // Returns the base datatype from which a datatype is derived.
+ // Note: not quite right for specific types yet???
+ DataType getSuper() const;
- // Registers a conversion function.
- void registerFunc(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func) const;
- void registerFunc(H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func) const;
+ // Registers a conversion function.
+ void registerFunc(H5T_pers_t pers, const char *name, const DataType &dest, H5T_conv_t func) const;
+ void registerFunc(H5T_pers_t pers, const H5std_string &name, const DataType &dest, H5T_conv_t func) const;
- // Removes a conversion function from all conversion paths.
- void unregister(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func) const;
- void unregister(H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func) const;
+ // Removes a conversion function from all conversion paths.
+ void unregister(H5T_pers_t pers, const char *name, const DataType &dest, H5T_conv_t func) const;
+ void unregister(H5T_pers_t pers, const H5std_string &name, const DataType &dest, H5T_conv_t func) const;
- // Tags an opaque datatype.
- void setTag(const char* tag) const;
- void setTag(const H5std_string& tag) const;
+ // Tags an opaque datatype.
+ void setTag(const char *tag) const;
+ void setTag(const H5std_string &tag) const;
- // Gets the tag associated with an opaque datatype.
- H5std_string getTag() const;
+ // Gets the tag associated with an opaque datatype.
+ H5std_string getTag() const;
- // Checks whether this datatype contains (or is) a certain type class.
- bool detectClass(H5T_class_t cls) const;
- static bool detectClass(const PredType& pred_type, H5T_class_t cls);
+ // Checks whether this datatype contains (or is) a certain type class.
+ bool detectClass(H5T_class_t cls) const;
+ static bool detectClass(const PredType &pred_type, H5T_class_t cls);
- // Checks whether this datatype is a variable-length string.
- bool isVariableStr() const;
+ // Checks whether this datatype is a variable-length string.
+ bool isVariableStr() const;
- // Returns a copy of the creation property list of a datatype.
- PropList getCreatePlist() const;
+ // Returns a copy of the creation property list of a datatype.
+ PropList getCreatePlist() const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("DataType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("DataType");
+ }
- // Creates a copy of an existing DataType using its id
- DataType(const hid_t type_id);
+ // Creates a copy of an existing DataType using its id
+ DataType(const hid_t type_id);
- // Default constructor
- DataType();
+ // Default constructor
+ DataType();
- // Determines whether this datatype has a binary object description.
- bool hasBinaryDesc() const;
+ // Determines whether this datatype has a binary object description.
+ bool hasBinaryDesc() const;
- // Gets the datatype id.
- virtual hid_t getId() const;
+ // Gets the datatype id.
+ virtual hid_t getId() const;
- // Destructor: properly terminates access to this datatype.
- virtual ~DataType();
+ // Destructor: properly terminates access to this datatype.
+ virtual ~DataType();
- protected:
+ protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- hid_t id; // HDF5 datatype id
+ hid_t id; // HDF5 datatype id
- // Returns an id of a type by decoding the binary object
- // description of this datatype.
- hid_t p_decode() const;
+ // Returns an id of a type by decoding the binary object
+ // description of this datatype.
+ hid_t p_decode() const;
- // Sets the datatype id.
- virtual void p_setId(const hid_t new_id);
+ // Sets the datatype id.
+ virtual void p_setId(const hid_t new_id);
- // Opens a datatype and returns the id.
- hid_t p_opentype(const H5Location& loc, const char* dtype_name) const;
+ // Opens a datatype and returns the id.
+ hid_t p_opentype(const H5Location &loc, const char *dtype_name) const;
#endif // DOXYGEN_SHOULD_SKIP_THIS
- private:
- // Buffer for binary object description of this datatype, allocated
- // in DataType::encode and used in DataType::decode
- unsigned char *encoded_buf;
- size_t buf_size;
+ private:
+ // Buffer for binary object description of this datatype, allocated
+ // in DataType::encode and used in DataType::decode
+ unsigned char *encoded_buf;
+ size_t buf_size;
- // Friend function to set DataType id. For library use only.
- friend void f_DataType_setId(DataType* dtype, hid_t new_id);
+ // Friend function to set DataType id. For library use only.
+ friend void f_DataType_setId(DataType *dtype, hid_t new_id);
- void p_commit(hid_t loc_id, const char* name);
+ void p_commit(hid_t loc_id, const char *name);
}; // end of DataType
} // namespace H5
diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp
index 79ff100..7163434 100644
--- a/c++/src/H5DcreatProp.cpp
+++ b/c++/src/H5DcreatProp.cpp
@@ -35,7 +35,7 @@ namespace H5 {
// in "H5PredType.cpp" for information.
// Initialize a pointer for the constant
-DSetCreatPropList* DSetCreatPropList::DEFAULT_ = 0;
+DSetCreatPropList *DSetCreatPropList::DEFAULT_ = 0;
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::getConstant
@@ -49,13 +49,13 @@ DSetCreatPropList* DSetCreatPropList::DEFAULT_ = 0;
// not happen.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-DSetCreatPropList* DSetCreatPropList::getConstant()
+DSetCreatPropList *
+DSetCreatPropList::getConstant()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -64,8 +64,9 @@ DSetCreatPropList* DSetCreatPropList::getConstant()
if (DEFAULT_ == 0)
DEFAULT_ = new DSetCreatPropList(H5P_DATASET_CREATE);
else
- throw PropListIException("DSetCreatPropList::getConstant", "DSetCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
- return(DEFAULT_);
+ throw PropListIException("DSetCreatPropList::getConstant",
+ "DSetCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return (DEFAULT_);
}
//--------------------------------------------------------------------------
@@ -74,7 +75,8 @@ DSetCreatPropList* DSetCreatPropList::getConstant()
// points to.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void DSetCreatPropList::deleteConstants()
+void
+DSetCreatPropList::deleteConstants()
{
if (DEFAULT_ != 0)
delete DEFAULT_;
@@ -83,7 +85,7 @@ void DSetCreatPropList::deleteConstants()
//--------------------------------------------------------------------------
// Purpose Constant for dataset creation default property
//--------------------------------------------------------------------------
-const DSetCreatPropList& DSetCreatPropList::DEFAULT = *getConstant();
+const DSetCreatPropList &DSetCreatPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -100,7 +102,7 @@ DSetCreatPropList::DSetCreatPropList() : ObjCreatPropList(H5P_DATASET_CREATE) {}
/// DSetCreatPropList object
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DSetCreatPropList::DSetCreatPropList(const DSetCreatPropList& orig) : ObjCreatPropList(orig) {}
+DSetCreatPropList::DSetCreatPropList(const DSetCreatPropList &orig) : ObjCreatPropList(orig) {}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList overloaded constructor
@@ -125,11 +127,11 @@ DSetCreatPropList::DSetCreatPropList(const hid_t plist_id) : ObjCreatPropList(pl
/// changed to \c H5D_CHUNKED, if it is not so already.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setChunk(int ndims, const hsize_t* dim) const
+void
+DSetCreatPropList::setChunk(int ndims, const hsize_t *dim) const
{
herr_t ret_value = H5Pset_chunk(id, ndims, dim);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("DSetCreatPropList::setChunk", "H5Pset_chunk failed");
}
}
@@ -143,15 +145,14 @@ void DSetCreatPropList::setChunk(int ndims, const hsize_t* dim) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int DSetCreatPropList::getChunk(int max_ndims, hsize_t* dim) const
+int
+DSetCreatPropList::getChunk(int max_ndims, hsize_t *dim) const
{
int chunk_size = H5Pget_chunk(id, max_ndims, dim);
- if (chunk_size < 0)
- {
- throw PropListIException("DSetCreatPropList::getChunk",
- "H5Pget_chunk returns negative chunk size");
+ if (chunk_size < 0) {
+ throw PropListIException("DSetCreatPropList::getChunk", "H5Pget_chunk returns negative chunk size");
}
- return(chunk_size);
+ return (chunk_size);
}
//--------------------------------------------------------------------------
@@ -164,13 +165,12 @@ int DSetCreatPropList::getChunk(int max_ndims, hsize_t* dim) const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setLayout(H5D_layout_t layout) const
+void
+DSetCreatPropList::setLayout(H5D_layout_t layout) const
{
herr_t ret_value = H5Pset_layout(id, layout);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setLayout",
- "H5Pset_layout failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setLayout", "H5Pset_layout failed");
}
}
@@ -190,15 +190,14 @@ void DSetCreatPropList::setLayout(H5D_layout_t layout) const
///\par Description
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5D_layout_t DSetCreatPropList::getLayout() const
+H5D_layout_t
+DSetCreatPropList::getLayout() const
{
H5D_layout_t layout = H5Pget_layout(id);
- if (layout == H5D_LAYOUT_ERROR)
- {
- throw PropListIException("DSetCreatPropList::getLayout",
- "H5Pget_layout returns H5D_LAYOUT_ERROR");
+ if (layout == H5D_LAYOUT_ERROR) {
+ throw PropListIException("DSetCreatPropList::getLayout", "H5Pget_layout returns H5D_LAYOUT_ERROR");
}
- return(layout);
+ return (layout);
}
//--------------------------------------------------------------------------
@@ -213,13 +212,12 @@ H5D_layout_t DSetCreatPropList::getLayout() const
/// less compression.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setDeflate(int level) const
+void
+DSetCreatPropList::setDeflate(int level) const
{
herr_t ret_value = H5Pset_deflate(id, level);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setDeflate",
- "H5Pset_deflate failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setDeflate", "H5Pset_deflate failed");
}
}
@@ -239,13 +237,12 @@ void DSetCreatPropList::setDeflate(int level) const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - Jan, 2007
//--------------------------------------------------------------------------
-void DSetCreatPropList::setSzip(unsigned int options_mask, unsigned int pixels_per_block) const
+void
+DSetCreatPropList::setSzip(unsigned int options_mask, unsigned int pixels_per_block) const
{
herr_t ret_value = H5Pset_szip(id, options_mask, pixels_per_block);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setSzip",
- "H5Pset_szip failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setSzip", "H5Pset_szip failed");
}
}
@@ -261,13 +258,12 @@ void DSetCreatPropList::setSzip(unsigned int options_mask, unsigned int pixels_p
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - Apr, 2016
//--------------------------------------------------------------------------
-void DSetCreatPropList::setNbit() const
+void
+DSetCreatPropList::setNbit() const
{
herr_t ret_value = H5Pset_nbit(id);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setNbit",
- "H5Pset_nbit failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setNbit", "H5Pset_nbit failed");
}
}
@@ -288,13 +284,12 @@ void DSetCreatPropList::setNbit() const
/// H5Pset_fill_value API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setFillValue(const DataType& fvalue_type, const void* value) const
+void
+DSetCreatPropList::setFillValue(const DataType &fvalue_type, const void *value) const
{
herr_t ret_value = H5Pset_fill_value(id, fvalue_type.getId(), value);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setFillValue",
- "H5Pset_fill_value failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setFillValue", "H5Pset_fill_value failed");
}
}
@@ -311,13 +306,12 @@ void DSetCreatPropList::setFillValue(const DataType& fvalue_type, const void* va
/// specified by \a fvalue_type.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::getFillValue(const DataType& fvalue_type, void* value) const
+void
+DSetCreatPropList::getFillValue(const DataType &fvalue_type, void *value) const
{
herr_t ret_value = H5Pget_fill_value(id, fvalue_type.getId(), value);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::getFillValue",
- "H5Pget_fill_value failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::getFillValue", "H5Pget_fill_value failed");
}
}
@@ -331,14 +325,14 @@ void DSetCreatPropList::getFillValue(const DataType& fvalue_type, void* value) c
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5D_fill_value_t DSetCreatPropList::isFillValueDefined() const
+H5D_fill_value_t
+DSetCreatPropList::isFillValueDefined() const
{
H5D_fill_value_t status;
- herr_t ret_value = H5Pfill_value_defined(id, &status);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Pfill_value_defined(id, &status);
+ if (ret_value < 0) {
throw PropListIException("DSetCreatPropList::isFillValueDefined",
- "H5Pfill_value_defined returned H5D_FILL_VALUE_ERROR (-1)");
+ "H5Pfill_value_defined returned H5D_FILL_VALUE_ERROR (-1)");
}
else
return (status);
@@ -364,14 +358,13 @@ H5D_fill_value_t DSetCreatPropList::isFillValueDefined() const
/// and the filter fails then the entire I/O operation fails.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setFilter(H5Z_filter_t filter_id, unsigned int flags,
- size_t cd_nelmts, const unsigned int cd_values[]) const
+void
+DSetCreatPropList::setFilter(H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts,
+ const unsigned int cd_values[]) const
{
herr_t ret_value = H5Pset_filter(id, filter_id, flags, cd_nelmts, cd_values);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setFilter",
- "H5Pset_filter failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setFilter", "H5Pset_filter failed");
}
}
@@ -385,13 +378,12 @@ void DSetCreatPropList::setFilter(H5Z_filter_t filter_id, unsigned int flags,
/// deletes all filters if \a filter_id is \c H5Z_FILTER_NONE.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::removeFilter(H5Z_filter_t filter_id) const
+void
+DSetCreatPropList::removeFilter(H5Z_filter_t filter_id) const
{
herr_t ret_value = H5Premove_filter(id, filter_id);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::removeFilter",
- "H5Premove_filter failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::removeFilter", "H5Premove_filter failed");
}
}
@@ -402,16 +394,16 @@ void DSetCreatPropList::removeFilter(H5Z_filter_t filter_id) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int DSetCreatPropList::getNfilters() const
+int
+DSetCreatPropList::getNfilters() const
{
int num_filters = H5Pget_nfilters(id);
- if (num_filters < 0)
- {
+ if (num_filters < 0) {
throw PropListIException("DSetCreatPropList::getNfilters",
- "H5Pget_nfilters returned negative number of filters");
+ "H5Pget_nfilters returned negative number of filters");
}
else
- return(num_filters);
+ return (num_filters);
}
//--------------------------------------------------------------------------
@@ -434,18 +426,18 @@ int DSetCreatPropList::getNfilters() const
// of unsigned int, but for backward compatibility, it cannot be
// changed. -BMR (2014/04/15)
//--------------------------------------------------------------------------
-H5Z_filter_t DSetCreatPropList::getFilter(int filter_number,
- unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values,
- size_t namelen, char name[], unsigned int& filter_config) const
+H5Z_filter_t
+DSetCreatPropList::getFilter(int filter_number, unsigned int &flags, size_t &cd_nelmts,
+ unsigned int *cd_values, size_t namelen, char name[],
+ unsigned int &filter_config) const
{
H5Z_filter_t filter_id;
- filter_id = H5Pget_filter2(id, filter_number, &flags, &cd_nelmts,
- cd_values, namelen, name, &filter_config);
+ filter_id =
+ H5Pget_filter2(id, filter_number, &flags, &cd_nelmts, cd_values, namelen, name, &filter_config);
if (filter_id == H5Z_FILTER_ERROR)
- throw PropListIException("DSetCreatPropList::getFilter",
- "H5Pget_filter2 returned H5Z_FILTER_ERROR");
+ throw PropListIException("DSetCreatPropList::getFilter", "H5Pget_filter2 returned H5Z_FILTER_ERROR");
else
- return(filter_id);
+ return (filter_id);
}
//--------------------------------------------------------------------------
@@ -463,15 +455,15 @@ H5Z_filter_t DSetCreatPropList::getFilter(int filter_number,
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::getFilterById(H5Z_filter_t filter_id,
- unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values,
- size_t namelen, char name[], unsigned int &filter_config) const
+void
+DSetCreatPropList::getFilterById(H5Z_filter_t filter_id, unsigned int &flags, size_t &cd_nelmts,
+ unsigned int *cd_values, size_t namelen, char name[],
+ unsigned int &filter_config) const
{
- herr_t ret_value = H5Pget_filter_by_id2(id, filter_id, &flags, &cd_nelmts,
- cd_values, namelen, name, &filter_config);
+ herr_t ret_value =
+ H5Pget_filter_by_id2(id, filter_id, &flags, &cd_nelmts, cd_values, namelen, name, &filter_config);
if (ret_value < 0)
- throw PropListIException("DSetCreatPropList::getFilterById",
- "H5Pget_filter_by_id2 failed");
+ throw PropListIException("DSetCreatPropList::getFilterById", "H5Pget_filter_by_id2 failed");
}
//--------------------------------------------------------------------------
@@ -495,14 +487,13 @@ void DSetCreatPropList::getFilterById(H5Z_filter_t filter_id,
/// and the filter fails then the entire I/O operation fails.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::modifyFilter(H5Z_filter_t filter_id, unsigned int
- flags, size_t cd_nelmts, const unsigned int cd_values[]) const
+void
+DSetCreatPropList::modifyFilter(H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts,
+ const unsigned int cd_values[]) const
{
herr_t ret_value = H5Pmodify_filter(id, filter_id, flags, cd_nelmts, cd_values);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::modifyFilter",
- "H5Pmodify_filter failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::modifyFilter", "H5Pmodify_filter failed");
}
}
@@ -515,7 +506,8 @@ void DSetCreatPropList::modifyFilter(H5Z_filter_t filter_id, unsigned int
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-bool DSetCreatPropList::allFiltersAvail() const
+bool
+DSetCreatPropList::allFiltersAvail() const
{
htri_t ret_value = H5Pall_filters_avail(id);
if (ret_value > 0)
@@ -524,7 +516,8 @@ bool DSetCreatPropList::allFiltersAvail() const
return false;
else // Raise exception when H5Pall_filters_avail returns a negative value
{
- throw PropListIException("DSetCreatPropList::allFiltersAvail", "H5Pall_filters_avail returned negative value");
+ throw PropListIException("DSetCreatPropList::allFiltersAvail",
+ "H5Pall_filters_avail returned negative value");
}
}
@@ -538,13 +531,12 @@ bool DSetCreatPropList::allFiltersAvail() const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setShuffle() const
+void
+DSetCreatPropList::setShuffle() const
{
herr_t ret_value = H5Pset_shuffle(id);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setShuffle",
- "H5Pset_shuffle failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setShuffle", "H5Pset_shuffle failed");
}
}
@@ -562,14 +554,13 @@ void DSetCreatPropList::setShuffle() const
/// \li \c H5D_ALLOC_TIME_INCR
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5D_alloc_time_t DSetCreatPropList::getAllocTime() const
+H5D_alloc_time_t
+DSetCreatPropList::getAllocTime() const
{
H5D_alloc_time_t alloc_time;
- herr_t ret_value = H5Pget_alloc_time(id, &alloc_time);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::getAllocTime",
- "H5Pget_alloc_time failed");
+ herr_t ret_value = H5Pget_alloc_time(id, &alloc_time);
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::getAllocTime", "H5Pget_alloc_time failed");
}
else
return (alloc_time);
@@ -586,14 +577,13 @@ H5D_alloc_time_t DSetCreatPropList::getAllocTime() const
/// \li \c H5D_FILL_TIME_ALLOC.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5D_fill_time_t DSetCreatPropList::getFillTime() const
+H5D_fill_time_t
+DSetCreatPropList::getFillTime() const
{
H5D_fill_time_t fill_time;
- herr_t ret_value = H5Pget_fill_time(id, &fill_time);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::getFillTime",
- "H5Pget_fill_time failed");
+ herr_t ret_value = H5Pget_fill_time(id, &fill_time);
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::getFillTime", "H5Pget_fill_time failed");
}
else
return (fill_time);
@@ -612,13 +602,12 @@ H5D_fill_time_t DSetCreatPropList::getFillTime() const
/// \li \c H5D_ALLOC_TIME_INCR
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setAllocTime(H5D_alloc_time_t alloc_time) const
+void
+DSetCreatPropList::setAllocTime(H5D_alloc_time_t alloc_time) const
{
herr_t ret_value = H5Pset_alloc_time(id, alloc_time);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setAllocTime",
- "H5Pset_alloc_time failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setAllocTime", "H5Pset_alloc_time failed");
}
}
@@ -633,13 +622,12 @@ void DSetCreatPropList::setAllocTime(H5D_alloc_time_t alloc_time) const
/// \li \c H5D_FILL_TIME_ALLOC.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setFillTime(H5D_fill_time_t fill_time) const
+void
+DSetCreatPropList::setFillTime(H5D_fill_time_t fill_time) const
{
herr_t ret_value = H5Pset_fill_time(id, fill_time);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setFillTime",
- "H5Pset_fill_time failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setFillTime", "H5Pset_fill_time failed");
}
}
@@ -650,13 +638,12 @@ void DSetCreatPropList::setFillTime(H5D_fill_time_t fill_time) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setFletcher32() const
+void
+DSetCreatPropList::setFletcher32() const
{
herr_t ret_value = H5Pset_fletcher32(id);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setFletcher32",
- "H5Pset_fletcher32 failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setFletcher32", "H5Pset_fletcher32 failed");
}
}
@@ -676,13 +663,12 @@ void DSetCreatPropList::setFletcher32() const
/// the extending).
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setExternal(const char* name, off_t offset, hsize_t size) const
+void
+DSetCreatPropList::setExternal(const char *name, off_t offset, hsize_t size) const
{
herr_t ret_value = H5Pset_external(id, name, offset, size);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setExternal",
- "H5Pset_external failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setExternal", "H5Pset_external failed");
}
}
@@ -693,16 +679,16 @@ void DSetCreatPropList::setExternal(const char* name, off_t offset, hsize_t size
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int DSetCreatPropList::getExternalCount() const
+int
+DSetCreatPropList::getExternalCount() const
{
int num_ext_files = H5Pget_external_count(id);
- if (num_ext_files < 0)
- {
+ if (num_ext_files < 0) {
throw PropListIException("DSetCreatPropList::getExternalCount",
- "H5Pget_external_count returns negative number of external files");
+ "H5Pget_external_count returns negative number of external files");
}
else
- return(num_ext_files);
+ return (num_ext_files);
}
//--------------------------------------------------------------------------
@@ -727,13 +713,12 @@ int DSetCreatPropList::getExternalCount() const
/// will not be returned.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::getExternal(unsigned idx, size_t name_size, char* name, off_t& offset, hsize_t& size) const
+void
+DSetCreatPropList::getExternal(unsigned idx, size_t name_size, char *name, off_t &offset, hsize_t &size) const
{
herr_t ret_value = H5Pget_external(id, idx, name_size, name, &offset, &size);
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::getExternal",
- "H5Pget_external failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::getExternal", "H5Pget_external failed");
}
}
@@ -755,13 +740,13 @@ void DSetCreatPropList::getExternal(unsigned idx, size_t name_size, char* name,
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - Mar, 2017
//--------------------------------------------------------------------------
-void DSetCreatPropList::setVirtual(const DataSpace& vspace, const char *src_fname, const char *src_dsname, const DataSpace& sspace) const
+void
+DSetCreatPropList::setVirtual(const DataSpace &vspace, const char *src_fname, const char *src_dsname,
+ const DataSpace &sspace) const
{
herr_t ret_value = H5Pset_virtual(id, vspace.getId(), src_fname, src_dsname, sspace.getId());
- if (ret_value < 0)
- {
- throw PropListIException("DSetCreatPropList::setVirtual",
- "H5Pset_virtual failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetCreatPropList::setVirtual", "H5Pset_virtual failed");
}
}
@@ -783,7 +768,9 @@ void DSetCreatPropList::setVirtual(const DataSpace& vspace, const char *src_fnam
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - Mar, 2017
//--------------------------------------------------------------------------
-void DSetCreatPropList::setVirtual(const DataSpace& vspace, const H5std_string src_fname, const H5std_string src_dsname, const DataSpace& sspace) const
+void
+DSetCreatPropList::setVirtual(const DataSpace &vspace, const H5std_string src_fname,
+ const H5std_string src_dsname, const DataSpace &sspace) const
{
setVirtual(vspace, src_fname.c_str(), src_dsname.c_str(), sspace);
}
@@ -795,4 +782,4 @@ void DSetCreatPropList::setVirtual(const DataSpace& vspace, const H5std_string s
//--------------------------------------------------------------------------
DSetCreatPropList::~DSetCreatPropList() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h
index 9f54e8d..e73ec32 100644
--- a/c++/src/H5DcreatProp.h
+++ b/c++/src/H5DcreatProp.h
@@ -27,121 +27,132 @@ class DataSpace;
*/
// Inheritance: ObjCreatPropList -> PropList -> IdComponent
class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList {
- public:
- ///\brief Default dataset creation property list.
- static const DSetCreatPropList& DEFAULT;
+ public:
+ ///\brief Default dataset creation property list.
+ static const DSetCreatPropList &DEFAULT;
- // Creates a dataset creation property list.
- DSetCreatPropList();
+ // Creates a dataset creation property list.
+ DSetCreatPropList();
- // Queries whether all the filters set in this property list are
- // available currently.
- bool allFiltersAvail() const;
+ // Queries whether all the filters set in this property list are
+ // available currently.
+ bool allFiltersAvail() const;
- // Get space allocation time for this property.
- H5D_alloc_time_t getAllocTime() const;
+ // Get space allocation time for this property.
+ H5D_alloc_time_t getAllocTime() const;
- // Set space allocation time for dataset during creation.
- void setAllocTime(H5D_alloc_time_t alloc_time) const;
+ // Set space allocation time for dataset during creation.
+ void setAllocTime(H5D_alloc_time_t alloc_time) const;
- // Retrieves the size of the chunks used to store a chunked layout dataset.
- int getChunk(int max_ndims, hsize_t* dim) const;
+ // Retrieves the size of the chunks used to store a chunked layout dataset.
+ int getChunk(int max_ndims, hsize_t *dim) const;
- // Sets the size of the chunks used to store a chunked layout dataset.
- void setChunk(int ndims, const hsize_t* dim) const;
+ // Sets the size of the chunks used to store a chunked layout dataset.
+ void setChunk(int ndims, const hsize_t *dim) const;
- // Returns information about an external file.
- void getExternal(unsigned idx, size_t name_size, char* name, off_t& offset, hsize_t& size) const;
+ // Returns information about an external file.
+ void getExternal(unsigned idx, size_t name_size, char *name, off_t &offset, hsize_t &size) const;
- // Returns the number of external files for a dataset.
- int getExternalCount() const;
+ // Returns the number of external files for a dataset.
+ int getExternalCount() const;
- // Gets fill value writing time.
- H5D_fill_time_t getFillTime() const;
+ // Gets fill value writing time.
+ H5D_fill_time_t getFillTime() const;
- // Sets fill value writing time for dataset.
- void setFillTime(H5D_fill_time_t fill_time) const;
+ // Sets fill value writing time for dataset.
+ void setFillTime(H5D_fill_time_t fill_time) const;
- // Retrieves a dataset fill value.
- void getFillValue(const DataType& fvalue_type, void* value) const;
+ // Retrieves a dataset fill value.
+ void getFillValue(const DataType &fvalue_type, void *value) const;
- // Sets a dataset fill value.
- void setFillValue(const DataType& fvalue_type, const void* value) const;
+ // Sets a dataset fill value.
+ void setFillValue(const DataType &fvalue_type, const void *value) const;
- // Returns information about a filter in a pipeline.
- H5Z_filter_t getFilter(int filter_number, unsigned int& flags, size_t& cd_nelmts, unsigned int* cd_values, size_t namelen, char name[], unsigned int &filter_config) const;
+ // Returns information about a filter in a pipeline.
+ H5Z_filter_t getFilter(int filter_number, unsigned int &flags, size_t &cd_nelmts, unsigned int *cd_values,
+ size_t namelen, char name[], unsigned int &filter_config) const;
- // Returns information about a filter in a pipeline given the filter id.
- void getFilterById(H5Z_filter_t filter_id, unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values, size_t namelen, char name[], unsigned int &filter_config) const;
+ // Returns information about a filter in a pipeline given the filter id.
+ void getFilterById(H5Z_filter_t filter_id, unsigned int &flags, size_t &cd_nelmts,
+ unsigned int *cd_values, size_t namelen, char name[],
+ unsigned int &filter_config) const;
- // Gets the layout of the raw data storage of the data that uses this
- // property list.
- H5D_layout_t getLayout() const;
+ // Gets the layout of the raw data storage of the data that uses this
+ // property list.
+ H5D_layout_t getLayout() const;
- // Sets the type of storage used to store the raw data for the
- // dataset that uses this property list.
- void setLayout(H5D_layout_t layout) const;
+ // Sets the type of storage used to store the raw data for the
+ // dataset that uses this property list.
+ void setLayout(H5D_layout_t layout) const;
- // Returns the number of filters in the pipeline.
- int getNfilters() const;
+ // Returns the number of filters in the pipeline.
+ int getNfilters() const;
- // Checks if fill value has been defined for this property.
- H5D_fill_value_t isFillValueDefined() const;
+ // Checks if fill value has been defined for this property.
+ H5D_fill_value_t isFillValueDefined() const;
- // Modifies the specified filter.
- void modifyFilter(H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[]) const;
+ // Modifies the specified filter.
+ void modifyFilter(H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts,
+ const unsigned int cd_values[]) const;
- // Remove one or all filters from the filter pipeline.
- void removeFilter(H5Z_filter_t filter_id) const;
+ // Remove one or all filters from the filter pipeline.
+ void removeFilter(H5Z_filter_t filter_id) const;
- // Sets compression method and compression level.
- void setDeflate(int level) const;
+ // Sets compression method and compression level.
+ void setDeflate(int level) const;
- // Adds an external file to the list of external files.
- void setExternal(const char* name, off_t offset, hsize_t size) const;
+ // Adds an external file to the list of external files.
+ void setExternal(const char *name, off_t offset, hsize_t size) const;
- // Adds a filter to the filter pipeline.
- void setFilter(H5Z_filter_t filter, unsigned int flags = 0, size_t cd_nelmts = 0, const unsigned int cd_values[] = NULL) const;
+ // Adds a filter to the filter pipeline.
+ void setFilter(H5Z_filter_t filter, unsigned int flags = 0, size_t cd_nelmts = 0,
+ const unsigned int cd_values[] = NULL) const;
- // Sets Fletcher32 checksum of EDC for this property list.
- void setFletcher32() const;
+ // Sets Fletcher32 checksum of EDC for this property list.
+ void setFletcher32() const;
- // Sets method of the shuffle filter.
- void setShuffle() const;
+ // Sets method of the shuffle filter.
+ void setShuffle() const;
- // Sets SZIP compression method.
- void setSzip(unsigned int options_mask, unsigned int pixels_per_block) const;
+ // Sets SZIP compression method.
+ void setSzip(unsigned int options_mask, unsigned int pixels_per_block) const;
- // Sets N-bit compression method.
- void setNbit() const;
+ // Sets N-bit compression method.
+ void setNbit() const;
- // Maps elements of a virtual dataset to elements of the source dataset.
- void setVirtual(const DataSpace& vspace, const char *src_fname, const char *src_dsname, const DataSpace& sspace) const;
- void setVirtual(const DataSpace& vspace, const H5std_string src_fname, const H5std_string src_dsname, const DataSpace& sspace) const;
+ // Maps elements of a virtual dataset to elements of the source dataset.
+ void setVirtual(const DataSpace &vspace, const char *src_fname, const char *src_dsname,
+ const DataSpace &sspace) const;
+ void setVirtual(const DataSpace &vspace, const H5std_string src_fname, const H5std_string src_dsname,
+ const DataSpace &sspace) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("DSetCreatPropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("DSetCreatPropList");
+ }
- // Copy constructor - same as the original DSetCreatPropList.
- DSetCreatPropList(const DSetCreatPropList& orig);
+ // Copy constructor - same as the original DSetCreatPropList.
+ DSetCreatPropList(const DSetCreatPropList &orig);
- // Creates a copy of an existing dataset creation property list
- // using the property list id.
- DSetCreatPropList(const hid_t plist_id);
+ // Creates a copy of an existing dataset creation property list
+ // using the property list id.
+ DSetCreatPropList(const hid_t plist_id);
- // Noop destructor.
- virtual ~DSetCreatPropList();
+ // Noop destructor.
+ virtual ~DSetCreatPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the global constant, should only be used by the library
- static void deleteConstants();
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
- private:
- static DSetCreatPropList* DEFAULT_;
+ private:
+ static DSetCreatPropList *DEFAULT_;
- // Creates the global constant, should only be used by the library
- static DSetCreatPropList* getConstant();
+ // Creates the global constant, should only be used by the library
+ static DSetCreatPropList *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp
index 9cc6961..00dba7e 100644
--- a/c++/src/H5DxferProp.cpp
+++ b/c++/src/H5DxferProp.cpp
@@ -13,7 +13,7 @@
#include <string>
-#include "H5private.h" // for HDmemset
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -28,7 +28,7 @@ namespace H5 {
// in "H5PredType.cpp" for information.
// Initialize a pointer for the constant
-DSetMemXferPropList* DSetMemXferPropList::DEFAULT_ = 0;
+DSetMemXferPropList *DSetMemXferPropList::DEFAULT_ = 0;
//--------------------------------------------------------------------------
// Function: DSetMemXferPropList::getConstant
@@ -42,13 +42,13 @@ DSetMemXferPropList* DSetMemXferPropList::DEFAULT_ = 0;
// happen.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-DSetMemXferPropList* DSetMemXferPropList::getConstant()
+DSetMemXferPropList *
+DSetMemXferPropList::getConstant()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -57,8 +57,10 @@ DSetMemXferPropList* DSetMemXferPropList::getConstant()
if (DEFAULT_ == 0)
DEFAULT_ = new DSetMemXferPropList(H5P_DATASET_XFER);
else
- throw PropListIException("DSetMemXferPropList::getConstant", "DSetMemXferPropList::getConstant is being invoked on an allocated DEFAULT_");
- return(DEFAULT_);
+ throw PropListIException(
+ "DSetMemXferPropList::getConstant",
+ "DSetMemXferPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return (DEFAULT_);
}
//--------------------------------------------------------------------------
@@ -67,7 +69,8 @@ DSetMemXferPropList* DSetMemXferPropList::getConstant()
// points to.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void DSetMemXferPropList::deleteConstants()
+void
+DSetMemXferPropList::deleteConstants()
{
if (DEFAULT_ != 0)
delete DEFAULT_;
@@ -76,7 +79,7 @@ void DSetMemXferPropList::deleteConstants()
//--------------------------------------------------------------------------
// Purpose Constant for default dataset memory and transfer property list.
//--------------------------------------------------------------------------
-const DSetMemXferPropList& DSetMemXferPropList::DEFAULT = *getConstant();
+const DSetMemXferPropList &DSetMemXferPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -94,7 +97,7 @@ DSetMemXferPropList::DSetMemXferPropList() : PropList(H5P_DATASET_XFER) {}
/// expression.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DSetMemXferPropList::DSetMemXferPropList(const char* exp) : PropList(H5P_DATASET_XFER)
+DSetMemXferPropList::DSetMemXferPropList(const char *exp) : PropList(H5P_DATASET_XFER)
{
setDataTransform(exp);
}
@@ -107,7 +110,7 @@ DSetMemXferPropList::DSetMemXferPropList(const char* exp) : PropList(H5P_DATASET
/// list object to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DSetMemXferPropList::DSetMemXferPropList(const DSetMemXferPropList& original) : PropList(original ) {}
+DSetMemXferPropList::DSetMemXferPropList(const DSetMemXferPropList &original) : PropList(original) {}
//--------------------------------------------------------------------------
// Function DSetMemXferPropList overloaded constructor
@@ -128,13 +131,12 @@ DSetMemXferPropList::DSetMemXferPropList(const hid_t plist_id) : PropList(plist_
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setBuffer(size_t size, void* tconv, void* bkg) const
+void
+DSetMemXferPropList::setBuffer(size_t size, void *tconv, void *bkg) const
{
herr_t ret_value = H5Pset_buffer(id, size, tconv, bkg);
- if(ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::setBuffer",
- "H5Pset_buffer failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetMemXferPropList::setBuffer", "H5Pset_buffer failed");
}
}
@@ -147,15 +149,15 @@ void DSetMemXferPropList::setBuffer(size_t size, void* tconv, void* bkg) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-size_t DSetMemXferPropList::getBuffer(void** tconv, void** bkg) const
+size_t
+DSetMemXferPropList::getBuffer(void **tconv, void **bkg) const
{
size_t buffer_size = H5Pget_buffer(id, tconv, bkg);
- if(buffer_size == 0)
- {
+ if (buffer_size == 0) {
throw PropListIException("DSetMemXferPropList::getBuffer",
- "H5Pget_buffer returned 0 for buffer size - failure");
+ "H5Pget_buffer returned 0 for buffer size - failure");
}
- return(buffer_size);
+ return (buffer_size);
}
//--------------------------------------------------------------------------
@@ -165,13 +167,12 @@ size_t DSetMemXferPropList::getBuffer(void** tconv, void** bkg) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setPreserve(bool status) const
+void
+DSetMemXferPropList::setPreserve(bool status) const
{
- herr_t ret_value = H5Pset_preserve(id, (hbool_t) status);
- if(ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::setPreserve",
- "H5Pset_preserve failed");
+ herr_t ret_value = H5Pset_preserve(id, (hbool_t)status);
+ if (ret_value < 0) {
+ throw PropListIException("DSetMemXferPropList::setPreserve", "H5Pset_preserve failed");
}
}
@@ -182,17 +183,17 @@ void DSetMemXferPropList::setPreserve(bool status) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-bool DSetMemXferPropList::getPreserve() const
+bool
+DSetMemXferPropList::getPreserve() const
{
int ret_value = H5Pget_preserve(id);
- if(ret_value > 0)
+ if (ret_value > 0)
return true;
- else if(ret_value == 0)
+ else if (ret_value == 0)
return false;
- else
- {
+ else {
throw PropListIException("DSetMemXferPropList::getPreserve",
- "H5Pget_preserve returned negative value for status");
+ "H5Pget_preserve returned negative value for status");
}
}
@@ -205,13 +206,12 @@ bool DSetMemXferPropList::getPreserve() const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setBtreeRatios(double left, double middle, double right) const
+void
+DSetMemXferPropList::setBtreeRatios(double left, double middle, double right) const
{
herr_t ret_value = H5Pset_btree_ratios(id, left, middle, right);
- if(ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::setBtreeRatios",
- "H5Pset_btree_ratios failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetMemXferPropList::setBtreeRatios", "H5Pset_btree_ratios failed");
}
}
@@ -224,13 +224,12 @@ void DSetMemXferPropList::setBtreeRatios(double left, double middle, double righ
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetMemXferPropList::getBtreeRatios(double& left, double& middle, double& right) const
+void
+DSetMemXferPropList::getBtreeRatios(double &left, double &middle, double &right) const
{
herr_t ret_value = H5Pget_btree_ratios(id, &left, &middle, &right);
- if(ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::getBtreeRatios",
- "H5Pget_btree_ratios failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetMemXferPropList::getBtreeRatios", "H5Pget_btree_ratios failed");
}
}
@@ -241,13 +240,12 @@ void DSetMemXferPropList::getBtreeRatios(double& left, double& middle, double& r
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setDataTransform(const char* expression) const
+void
+DSetMemXferPropList::setDataTransform(const char *expression) const
{
herr_t ret_value = H5Pset_data_transform(id, expression);
- if(ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::setDataTransform",
- "H5Pset_data_transform failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetMemXferPropList::setDataTransform", "H5Pset_data_transform failed");
}
}
@@ -259,7 +257,8 @@ void DSetMemXferPropList::setDataTransform(const char* expression) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setDataTransform(const H5std_string& expression) const
+void
+DSetMemXferPropList::setDataTransform(const H5std_string &expression) const
{
setDataTransform(expression.c_str());
}
@@ -273,7 +272,8 @@ void DSetMemXferPropList::setDataTransform(const H5std_string& expression) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
-ssize_t DSetMemXferPropList::getDataTransform(char* exp, size_t buf_size) const
+ssize_t
+DSetMemXferPropList::getDataTransform(char *exp, size_t buf_size) const
{
// H5Pget_data_transform will get buf_size characters of the expression
// including the null terminator
@@ -281,10 +281,8 @@ ssize_t DSetMemXferPropList::getDataTransform(char* exp, size_t buf_size) const
exp_len = H5Pget_data_transform(id, exp, buf_size);
// H5Pget_data_transform returns a negative value, raise an exception
- if (exp_len < 0)
- {
- throw PropListIException("DSetMemXferPropList::getDataTransform",
- "H5Pget_data_transform failed");
+ if (exp_len < 0) {
+ throw PropListIException("DSetMemXferPropList::getDataTransform", "H5Pget_data_transform failed");
}
// H5Pget_data_transform will put a null terminator at the end of the
@@ -292,7 +290,7 @@ ssize_t DSetMemXferPropList::getDataTransform(char* exp, size_t buf_size) const
// of the buffer.
// Return the expression length, which might be different from buf_size
- return(exp_len);
+ return (exp_len);
}
//--------------------------------------------------------------------------
@@ -303,7 +301,8 @@ ssize_t DSetMemXferPropList::getDataTransform(char* exp, size_t buf_size) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
-H5std_string DSetMemXferPropList::getDataTransform() const
+H5std_string
+DSetMemXferPropList::getDataTransform() const
{
// Initialize string to "", so that if there is no expression, the returned
// string will be empty
@@ -313,29 +312,27 @@ H5std_string DSetMemXferPropList::getDataTransform() const
ssize_t exp_len = H5Pget_data_transform(id, NULL, (size_t)0);
// If H5Pget_data_transform returns a negative value, raise an exception
- if (exp_len < 0)
- {
+ if (exp_len < 0) {
throw PropListIException("DSetMemXferPropList::getDataTransform", "H5Pget_data_transform failed");
}
// If expression exists, calls C routine again to get it
- else if (exp_len > 0)
- {
+ else if (exp_len > 0) {
// Temporary buffer for char* expression
- char* exp_C = new char[exp_len+1];
- HDmemset(exp_C, 0, exp_len+1); // clear buffer
+ char *exp_C = new char[exp_len + 1];
+ HDmemset(exp_C, 0, exp_len + 1); // clear buffer
// Used overloaded function
- exp_len = getDataTransform(exp_C, exp_len+1);
+ exp_len = getDataTransform(exp_C, exp_len + 1);
// Convert the C expression to return
expression = exp_C;
// Clean up resource
- delete []exp_C;
+ delete[] exp_C;
}
// Return the string expression
- return(expression);
+ return (expression);
}
//--------------------------------------------------------------------------
@@ -347,13 +344,12 @@ H5std_string DSetMemXferPropList::getDataTransform() const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setTypeConvCB(H5T_conv_except_func_t op, void *user_data) const
+void
+DSetMemXferPropList::setTypeConvCB(H5T_conv_except_func_t op, void *user_data) const
{
herr_t ret_value = H5Pset_type_conv_cb(id, op, user_data);
- if(ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::setTypeConvCB",
- "H5Pset_type_conv_cb failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetMemXferPropList::setTypeConvCB", "H5Pset_type_conv_cb failed");
}
}
@@ -365,13 +361,12 @@ void DSetMemXferPropList::setTypeConvCB(H5T_conv_except_func_t op, void *user_da
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void DSetMemXferPropList::getTypeConvCB(H5T_conv_except_func_t *op, void **user_data) const
+void
+DSetMemXferPropList::getTypeConvCB(H5T_conv_except_func_t *op, void **user_data) const
{
herr_t ret_value = H5Pget_type_conv_cb(id, op, user_data);
- if(ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::getTypeConvCB",
- "H5Pget_type_conv_cb failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetMemXferPropList::getTypeConvCB", "H5Pget_type_conv_cb failed");
}
}
@@ -385,14 +380,13 @@ void DSetMemXferPropList::getTypeConvCB(H5T_conv_except_func_t *op, void **user_
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setVlenMemManager(H5MM_allocate_t alloc_func, void* alloc_info, H5MM_free_t free_func, void* free_info) const
+void
+DSetMemXferPropList::setVlenMemManager(H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func,
+ void *free_info) const
{
- herr_t ret_value = H5Pset_vlen_mem_manager(id, alloc_func, alloc_info,
- free_func, free_info);
- if(ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::setVlenMemManager",
- "H5Pset_vlen_mem_manager failed");
+ herr_t ret_value = H5Pset_vlen_mem_manager(id, alloc_func, alloc_info, free_func, free_info);
+ if (ret_value < 0) {
+ throw PropListIException("DSetMemXferPropList::setVlenMemManager", "H5Pset_vlen_mem_manager failed");
}
}
@@ -404,9 +398,10 @@ void DSetMemXferPropList::setVlenMemManager(H5MM_allocate_t alloc_func, void* al
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setVlenMemManager() const
+void
+DSetMemXferPropList::setVlenMemManager() const
{
- setVlenMemManager(NULL, NULL, NULL, NULL);
+ setVlenMemManager(NULL, NULL, NULL, NULL);
}
//--------------------------------------------------------------------------
@@ -419,13 +414,13 @@ void DSetMemXferPropList::setVlenMemManager() const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetMemXferPropList::getVlenMemManager(H5MM_allocate_t& alloc_func, void** alloc_info, H5MM_free_t& free_func, void** free_info) const
+void
+DSetMemXferPropList::getVlenMemManager(H5MM_allocate_t &alloc_func, void **alloc_info, H5MM_free_t &free_func,
+ void **free_info) const
{
herr_t ret_value = H5Pget_vlen_mem_manager(id, &alloc_func, alloc_info, &free_func, free_info);
- if (ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::getVlenMemManager",
- "H5Pget_vlen_mem_manager failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetMemXferPropList::getVlenMemManager", "H5Pget_vlen_mem_manager failed");
}
}
@@ -439,13 +434,13 @@ void DSetMemXferPropList::getVlenMemManager(H5MM_allocate_t& alloc_func, void**
/// API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setSmallDataBlockSize(hsize_t size) const
+void
+DSetMemXferPropList::setSmallDataBlockSize(hsize_t size) const
{
herr_t ret_value = H5Pset_small_data_block_size(id, size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("DSetMemXferPropList::setSmallDataBlockSize",
- "H5Pset_small_data_block_size failed");
+ "H5Pset_small_data_block_size failed");
}
}
@@ -456,16 +451,16 @@ void DSetMemXferPropList::setSmallDataBlockSize(hsize_t size) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-hsize_t DSetMemXferPropList::getSmallDataBlockSize() const
+hsize_t
+DSetMemXferPropList::getSmallDataBlockSize() const
{
hsize_t size;
- herr_t ret_value = H5Pget_small_data_block_size(id, &size);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Pget_small_data_block_size(id, &size);
+ if (ret_value < 0) {
throw PropListIException("DSetMemXferPropList::getSmallDataBlockSize",
- "H5Pget_small_data_block_size failed");
+ "H5Pget_small_data_block_size failed");
}
- return(size);
+ return (size);
}
//--------------------------------------------------------------------------
@@ -478,13 +473,13 @@ hsize_t DSetMemXferPropList::getSmallDataBlockSize() const
/// API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setHyperVectorSize(size_t vector_size) const
+void
+DSetMemXferPropList::setHyperVectorSize(size_t vector_size) const
{
herr_t ret_value = H5Pset_hyper_vector_size(id, vector_size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("DSetMemXferPropList::setHyperVectorSize",
- "H5Pset_hyper_vector_size failed");
+ "H5Pset_hyper_vector_size failed");
}
}
@@ -496,16 +491,16 @@ void DSetMemXferPropList::setHyperVectorSize(size_t vector_size) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-size_t DSetMemXferPropList::getHyperVectorSize() const
+size_t
+DSetMemXferPropList::getHyperVectorSize() const
{
size_t vector_size;
herr_t ret_value = H5Pget_hyper_vector_size(id, &vector_size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("DSetMemXferPropList::getHyperVectorSize",
- "H5Pget_hyper_vector_size failed");
+ "H5Pget_hyper_vector_size failed");
}
- return(vector_size);
+ return (vector_size);
}
//--------------------------------------------------------------------------
@@ -526,13 +521,12 @@ size_t DSetMemXferPropList::getHyperVectorSize() const
/// \li \c H5Z_DISABLE_EDC
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setEDCCheck(H5Z_EDC_t check) const
+void
+DSetMemXferPropList::setEDCCheck(H5Z_EDC_t check) const
{
herr_t ret_value = H5Pset_edc_check(id, check);
- if (ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::setEDCCheck",
- "H5Pset_edc_check failed");
+ if (ret_value < 0) {
+ throw PropListIException("DSetMemXferPropList::setEDCCheck", "H5Pset_edc_check failed");
}
}
@@ -543,15 +537,14 @@ void DSetMemXferPropList::setEDCCheck(H5Z_EDC_t check) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-H5Z_EDC_t DSetMemXferPropList::getEDCCheck() const
+H5Z_EDC_t
+DSetMemXferPropList::getEDCCheck() const
{
H5Z_EDC_t check = H5Pget_edc_check(id);
- if (check < 0)
- {
- throw PropListIException("DSetMemXferPropList::getEDCCheck",
- "H5Pget_edc_check failed");
+ if (check < 0) {
+ throw PropListIException("DSetMemXferPropList::getEDCCheck", "H5Pget_edc_check failed");
}
- return(check);
+ return (check);
}
//--------------------------------------------------------------------------
@@ -561,5 +554,4 @@ H5Z_EDC_t DSetMemXferPropList::getEDCCheck() const
//--------------------------------------------------------------------------
DSetMemXferPropList::~DSetMemXferPropList() {}
-} // end namespace
-
+} // namespace H5
diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h
index e53a03b..59ece6f 100644
--- a/c++/src/H5DxferProp.h
+++ b/c++/src/H5DxferProp.h
@@ -23,105 +23,108 @@ namespace H5 {
*/
// Inheritance: PropList -> IdComponent
class H5_DLLCPP DSetMemXferPropList : public PropList {
- public:
- ///\brief Default dataset memory and transfer property list.
- static const DSetMemXferPropList& DEFAULT;
+ public:
+ ///\brief Default dataset memory and transfer property list.
+ static const DSetMemXferPropList &DEFAULT;
- // Creates a dataset memory and transfer property list.
- DSetMemXferPropList();
+ // Creates a dataset memory and transfer property list.
+ DSetMemXferPropList();
- // Creates a dataset transform property list.
- DSetMemXferPropList(const char* expression);
+ // Creates a dataset transform property list.
+ DSetMemXferPropList(const char *expression);
- // Sets type conversion and background buffers.
- void setBuffer(size_t size, void* tconv, void* bkg) const;
+ // Sets type conversion and background buffers.
+ void setBuffer(size_t size, void *tconv, void *bkg) const;
- // Reads buffer settings.
- size_t getBuffer(void** tconv, void** bkg) const;
+ // Reads buffer settings.
+ size_t getBuffer(void **tconv, void **bkg) const;
- // Sets B-tree split ratios for a dataset transfer property list.
- void setBtreeRatios(double left, double middle, double right) const;
+ // Sets B-tree split ratios for a dataset transfer property list.
+ void setBtreeRatios(double left, double middle, double right) const;
- // Gets B-tree split ratios for a dataset transfer property list.
- void getBtreeRatios(double& left, double& middle, double& right) const;
+ // Gets B-tree split ratios for a dataset transfer property list.
+ void getBtreeRatios(double &left, double &middle, double &right) const;
- // Sets data transform expression.
- void setDataTransform(const char* expression) const;
- void setDataTransform(const H5std_string& expression) const;
+ // Sets data transform expression.
+ void setDataTransform(const char *expression) const;
+ void setDataTransform(const H5std_string &expression) const;
- // Gets data transform expression.
- ssize_t getDataTransform(char* exp, size_t buf_size=0) const;
- H5std_string getDataTransform() const;
+ // Gets data transform expression.
+ ssize_t getDataTransform(char *exp, size_t buf_size = 0) const;
+ H5std_string getDataTransform() const;
- // Sets the dataset transfer property list status to TRUE or FALSE.
- void setPreserve(bool status) const;
+ // Sets the dataset transfer property list status to TRUE or FALSE.
+ void setPreserve(bool status) const;
- // Checks status of the dataset transfer property list.
- bool getPreserve() const;
+ // Checks status of the dataset transfer property list.
+ bool getPreserve() const;
- // Sets an exception handling callback for datatype conversion.
- void setTypeConvCB(H5T_conv_except_func_t op, void *user_data) const;
+ // Sets an exception handling callback for datatype conversion.
+ void setTypeConvCB(H5T_conv_except_func_t op, void *user_data) const;
- // Gets the exception handling callback for datatype conversion.
- void getTypeConvCB(H5T_conv_except_func_t *op, void **user_data) const;
+ // Gets the exception handling callback for datatype conversion.
+ void getTypeConvCB(H5T_conv_except_func_t *op, void **user_data) const;
- // Sets the memory manager for variable-length datatype
- // allocation in H5Dread and H5Treclaim.
- void setVlenMemManager(H5MM_allocate_t alloc, void* alloc_info,
- H5MM_free_t free, void* free_info) const;
+ // Sets the memory manager for variable-length datatype
+ // allocation in H5Dread and H5Treclaim.
+ void setVlenMemManager(H5MM_allocate_t alloc, void *alloc_info, H5MM_free_t free, void *free_info) const;
- // alloc and free are set to NULL, indicating that system
- // malloc and free are to be used.
- void setVlenMemManager() const;
+ // alloc and free are set to NULL, indicating that system
+ // malloc and free are to be used.
+ void setVlenMemManager() const;
- // Gets the memory manager for variable-length datatype
- // allocation in H5Dread and H5Treclaim.
- void getVlenMemManager(H5MM_allocate_t& alloc, void** alloc_info,
- H5MM_free_t& free, void** free_info) const;
+ // Gets the memory manager for variable-length datatype
+ // allocation in H5Dread and H5Treclaim.
+ void getVlenMemManager(H5MM_allocate_t &alloc, void **alloc_info, H5MM_free_t &free,
+ void **free_info) const;
- // Sets the size of a contiguous block reserved for small data.
- void setSmallDataBlockSize(hsize_t size) const;
+ // Sets the size of a contiguous block reserved for small data.
+ void setSmallDataBlockSize(hsize_t size) const;
- // Returns the current small data block size setting.
- hsize_t getSmallDataBlockSize() const;
+ // Returns the current small data block size setting.
+ hsize_t getSmallDataBlockSize() const;
- // Sets number of I/O vectors to be read/written in hyperslab I/O.
- void setHyperVectorSize(size_t vector_size) const;
+ // Sets number of I/O vectors to be read/written in hyperslab I/O.
+ void setHyperVectorSize(size_t vector_size) const;
- // Returns the number of I/O vectors to be read/written in
- // hyperslab I/O.
- size_t getHyperVectorSize() const;
+ // Returns the number of I/O vectors to be read/written in
+ // hyperslab I/O.
+ size_t getHyperVectorSize() const;
- // Enables or disables error-detecting for a dataset reading
- // process.
- void setEDCCheck(H5Z_EDC_t check) const;
+ // Enables or disables error-detecting for a dataset reading
+ // process.
+ void setEDCCheck(H5Z_EDC_t check) const;
- // Determines whether error-detection is enabled for dataset reads.
- H5Z_EDC_t getEDCCheck() const;
+ // Determines whether error-detection is enabled for dataset reads.
+ H5Z_EDC_t getEDCCheck() const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("DSetMemXferPropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("DSetMemXferPropList");
+ }
- // Copy constructor - same as the original DSetMemXferPropList.
- DSetMemXferPropList(const DSetMemXferPropList& orig);
+ // Copy constructor - same as the original DSetMemXferPropList.
+ DSetMemXferPropList(const DSetMemXferPropList &orig);
- // Creates a copy of an existing dataset memory and transfer
- // property list using the property list id.
- DSetMemXferPropList(const hid_t plist_id);
+ // Creates a copy of an existing dataset memory and transfer
+ // property list using the property list id.
+ DSetMemXferPropList(const hid_t plist_id);
- // Noop destructor
- virtual ~DSetMemXferPropList();
+ // Noop destructor
+ virtual ~DSetMemXferPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the global constant, should only be used by the library
- static void deleteConstants();
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
- private:
- static DSetMemXferPropList* DEFAULT_;
+ private:
+ static DSetMemXferPropList *DEFAULT_;
- // Creates the global constant, should only be used by the library
- static DSetMemXferPropList* getConstant();
+ // Creates the global constant, should only be used by the library
+ static DSetMemXferPropList *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp
index f9adc47..07cff07 100644
--- a/c++/src/H5EnumType.cpp
+++ b/c++/src/H5EnumType.cpp
@@ -13,7 +13,7 @@
#include <string>
-#include "H5private.h" // for HDmemset
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -50,14 +50,14 @@ EnumType::EnumType() : DataType() {}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType::EnumType(const hid_t existing_id) : DataType( existing_id ) {}
+EnumType::EnumType(const hid_t existing_id) : DataType(existing_id) {}
//--------------------------------------------------------------------------
// Function: EnumType copy constructor
///\brief Copy constructor: same HDF5 object as \a original
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType::EnumType(const EnumType& original) : DataType( original ) {}
+EnumType::EnumType(const EnumType &original) : DataType(original) {}
//--------------------------------------------------------------------------
// Function: EnumType overloaded constructor
@@ -69,7 +69,7 @@ EnumType::EnumType(const EnumType& original) : DataType( original ) {}
// the enum datatype.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType::EnumType(size_t size) : DataType( H5T_ENUM, size ) {}
+EnumType::EnumType(size_t size) : DataType(H5T_ENUM, size) {}
//--------------------------------------------------------------------------
// Function: EnumType overloaded constructor
@@ -78,14 +78,13 @@ EnumType::EnumType(size_t size) : DataType( H5T_ENUM, size ) {}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType::EnumType(const DataSet& dataset) : DataType()
+EnumType::EnumType(const DataSet &dataset) : DataType()
{
// Calls C function H5Dget_type to get the id of the datatype
id = H5Dget_type(dataset.getId());
// If the datatype id is not valid, throw an exception
- if (id < 0)
- {
+ if (id < 0) {
throw DataSetIException("EnumType constructor", "H5Dget_type failed");
}
}
@@ -97,14 +96,13 @@ EnumType::EnumType(const DataSet& dataset) : DataType()
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType::EnumType(const IntType& data_type) : DataType()
+EnumType::EnumType(const IntType &data_type) : DataType()
{
// Calls C function H5Tenum_create to get the id of the datatype
id = H5Tenum_create(data_type.getId());
// If the datatype id is not valid, throw an exception
- if (id < 0)
- {
+ if (id < 0) {
throw DataSetIException("EnumType constructor", "H5Tenum_create failed");
}
}
@@ -123,7 +121,7 @@ EnumType::EnumType(const IntType& data_type) : DataType()
// improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-EnumType::EnumType(const H5Location& loc, const char *dtype_name) : DataType()
+EnumType::EnumType(const H5Location &loc, const char *dtype_name) : DataType()
{
id = p_opentype(loc, dtype_name);
}
@@ -142,7 +140,7 @@ EnumType::EnumType(const H5Location& loc, const char *dtype_name) : DataType()
// to improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-EnumType::EnumType(const H5Location& loc, const H5std_string& dtype_name) : DataType()
+EnumType::EnumType(const H5Location &loc, const H5std_string &dtype_name) : DataType()
{
id = p_opentype(loc, dtype_name.c_str());
}
@@ -155,7 +153,8 @@ EnumType::EnumType(const H5Location& loc, const H5std_string& dtype_name) : Data
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-DataType* EnumType::decode() const
+DataType *
+EnumType::decode() const
{
hid_t encoded_enumtype_id = H5I_INVALID_HID;
try {
@@ -166,7 +165,7 @@ DataType* EnumType::decode() const
}
EnumType *encoded_enumtype = new EnumType;
encoded_enumtype->p_setId(encoded_enumtype_id);
- return(encoded_enumtype);
+ return (encoded_enumtype);
}
//--------------------------------------------------------------------------
@@ -177,12 +176,12 @@ DataType* EnumType::decode() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void EnumType::insert(const char* name, void *value) const
+void
+EnumType::insert(const char *name, void *value) const
{
// Calls C routine H5Tenum_insert to insert the new enum datatype member.
herr_t ret_value = H5Tenum_insert(id, name, value);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("EnumType::insert", "H5Tenum_insert failed");
}
}
@@ -194,7 +193,8 @@ void EnumType::insert(const char* name, void *value) const
/// argument \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void EnumType::insert(const H5std_string& name, void *value) const
+void
+EnumType::insert(const H5std_string &name, void *value) const
{
insert(name.c_str(), value);
}
@@ -208,24 +208,24 @@ void EnumType::insert(const H5std_string& name, void *value) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string EnumType::nameOf(void *value, size_t size) const
+H5std_string
+EnumType::nameOf(void *value, size_t size) const
{
- char* name_C = new char[size+1]; // temporary C-string for C API
- HDmemset(name_C, 0, size+1); // clear buffer
+ char *name_C = new char[size + 1]; // temporary C-string for C API
+ HDmemset(name_C, 0, size + 1); // clear buffer
// Calls C routine H5Tenum_nameof to get the name of the specified enum type
herr_t ret_value = H5Tenum_nameof(id, value, name_C, size);
// If H5Tenum_nameof returns a negative value, raise an exception,
- if (ret_value < 0)
- {
- delete []name_C;
+ if (ret_value < 0) {
+ delete[] name_C;
throw DataTypeIException("EnumType::nameOf", "H5Tenum_nameof failed");
}
// otherwise, create the string to hold the datatype name and return it
H5std_string name(name_C);
- delete []name_C;
- return(name);
+ delete[] name_C;
+ return (name);
}
//--------------------------------------------------------------------------
@@ -237,12 +237,12 @@ H5std_string EnumType::nameOf(void *value, size_t size) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void EnumType::valueOf(const char* name, void *value) const
+void
+EnumType::valueOf(const char *name, void *value) const
{
// Calls C routine H5Tenum_valueof to get the enum datatype value
herr_t ret_value = H5Tenum_valueof(id, name, value);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("EnumType::valueOf", "H5Tenum_valueof failed");
}
}
@@ -254,7 +254,8 @@ void EnumType::valueOf(const char* name, void *value) const
/// argument \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void EnumType::valueOf(const H5std_string& name, void *value) const
+void
+EnumType::valueOf(const H5std_string &name, void *value) const
{
valueOf(name.c_str(), value);
}
@@ -269,15 +270,14 @@ void EnumType::valueOf(const H5std_string& name, void *value) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May 16, 2002
//--------------------------------------------------------------------------
-int EnumType::getMemberIndex(const char *name) const
+int
+EnumType::getMemberIndex(const char *name) const
{
int member_index = H5Tget_member_index(id, name);
- if (member_index < 0)
- {
- throw DataTypeIException("EnumType::getMemberIndex",
- "H5Tget_member_index returns negative value");
+ if (member_index < 0) {
+ throw DataTypeIException("EnumType::getMemberIndex", "H5Tget_member_index returns negative value");
}
- return(member_index);
+ return (member_index);
}
//--------------------------------------------------------------------------
@@ -287,9 +287,10 @@ int EnumType::getMemberIndex(const char *name) const
/// argument \a name.
// Programmer Binh-Minh Ribler - May 16, 2002
//--------------------------------------------------------------------------
-int EnumType::getMemberIndex(const H5std_string& name) const
+int
+EnumType::getMemberIndex(const H5std_string &name) const
{
- return(EnumType::getMemberIndex(name.c_str()));
+ return (EnumType::getMemberIndex(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -299,15 +300,15 @@ int EnumType::getMemberIndex(const H5std_string& name) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-int EnumType::getNmembers() const
+int
+EnumType::getNmembers() const
{
int num_members = H5Tget_nmembers(id);
- if (num_members < 0)
- {
+ if (num_members < 0) {
throw DataTypeIException("EnumType::getNmembers",
- "H5Tget_nmembers returns negative number of members");
+ "H5Tget_nmembers returns negative number of members");
}
- return(num_members);
+ return (num_members);
}
//--------------------------------------------------------------------------
@@ -319,12 +320,12 @@ int EnumType::getNmembers() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void EnumType::getMemberValue(unsigned memb_no, void *value) const
+void
+EnumType::getMemberValue(unsigned memb_no, void *value) const
{
// Call C routine H5Tget_member_value to get the datatype member's value
hid_t ret_value = H5Tget_member_value(id, memb_no, value);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("EnumType::getMemberValue", "H5Tget_member_value failed");
}
}
@@ -336,4 +337,4 @@ void EnumType::getMemberValue(unsigned memb_no, void *value) const
//--------------------------------------------------------------------------
EnumType::~EnumType() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5EnumType.h b/c++/src/H5EnumType.h
index 4797ee7..e3d9a50 100644
--- a/c++/src/H5EnumType.h
+++ b/c++/src/H5EnumType.h
@@ -24,61 +24,65 @@ namespace H5 {
// Inheritance: DataType -> H5Object -> H5Location -> IdComponent
class H5_DLLCPP EnumType : public DataType {
- public:
- // Creates an empty enumeration datatype based on a native signed
- // integer type, whose size is given by size.
- EnumType(size_t size);
+ public:
+ // Creates an empty enumeration datatype based on a native signed
+ // integer type, whose size is given by size.
+ EnumType(size_t size);
- // Gets the enum datatype of the specified dataset
- EnumType(const DataSet& dataset); // H5Dget_type
+ // Gets the enum datatype of the specified dataset
+ EnumType(const DataSet &dataset); // H5Dget_type
- // Creates a new enum datatype based on an integer datatype
- EnumType(const IntType& data_type); // H5Tenum_create
+ // Creates a new enum datatype based on an integer datatype
+ EnumType(const IntType &data_type); // H5Tenum_create
- // Constructors that open an enum datatype, given a location.
- EnumType(const H5Location& loc, const char* name);
- EnumType(const H5Location& loc, const H5std_string& name);
+ // Constructors that open an enum datatype, given a location.
+ EnumType(const H5Location &loc, const char *name);
+ EnumType(const H5Location &loc, const H5std_string &name);
- // Returns an EnumType object via DataType* by decoding the
- // binary object description of this type.
- virtual DataType* decode() const;
+ // Returns an EnumType object via DataType* by decoding the
+ // binary object description of this type.
+ virtual DataType *decode() const;
- // Returns the number of members in this enumeration datatype.
- int getNmembers () const;
+ // Returns the number of members in this enumeration datatype.
+ int getNmembers() const;
- // Returns the index of a member in this enumeration data type.
- int getMemberIndex(const char* name) const;
- int getMemberIndex(const H5std_string& name) const;
+ // Returns the index of a member in this enumeration data type.
+ int getMemberIndex(const char *name) const;
+ int getMemberIndex(const H5std_string &name) const;
- // Returns the value of an enumeration datatype member
- void getMemberValue(unsigned memb_no, void *value) const;
+ // Returns the value of an enumeration datatype member
+ void getMemberValue(unsigned memb_no, void *value) const;
- // Inserts a new member to this enumeration type.
- void insert(const char* name, void *value) const;
- void insert(const H5std_string& name, void *value) const;
+ // Inserts a new member to this enumeration type.
+ void insert(const char *name, void *value) const;
+ void insert(const H5std_string &name, void *value) const;
- // Returns the symbol name corresponding to a specified member
- // of this enumeration datatype.
- H5std_string nameOf(void *value, size_t size) const;
+ // Returns the symbol name corresponding to a specified member
+ // of this enumeration datatype.
+ H5std_string nameOf(void *value, size_t size) const;
- // Returns the value corresponding to a specified member of this
- // enumeration datatype.
- void valueOf(const char* name, void *value) const;
- void valueOf(const H5std_string& name, void *value) const;
+ // Returns the value corresponding to a specified member of this
+ // enumeration datatype.
+ void valueOf(const char *name, void *value) const;
+ void valueOf(const H5std_string &name, void *value) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("EnumType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("EnumType");
+ }
- // Default constructor
- EnumType();
+ // Default constructor
+ EnumType();
- // Creates an enumeration datatype using an existing id
- EnumType(const hid_t existing_id);
+ // Creates an enumeration datatype using an existing id
+ EnumType(const hid_t existing_id);
- // Copy constructor: same as the original EnumType.
- EnumType(const EnumType& original);
+ // Copy constructor: same as the original EnumType.
+ EnumType(const EnumType &original);
- virtual ~EnumType();
+ virtual ~EnumType();
}; // end of EnumType
} // namespace H5
diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp
index 7431e6c..5fcd1cf 100644
--- a/c++/src/H5Exception.cpp
+++ b/c++/src/H5Exception.cpp
@@ -35,7 +35,10 @@ Exception::Exception() : detail_message(""), func_name("") {}
///\param message - IN: Message on the failure
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Exception::Exception(const H5std_string& func, const H5std_string& message) : detail_message(message), func_name(func) {}
+Exception::Exception(const H5std_string &func, const H5std_string &message)
+ : detail_message(message), func_name(func)
+{
+}
//--------------------------------------------------------------------------
// Function: Exception copy constructor
@@ -43,7 +46,9 @@ Exception::Exception(const H5std_string& func, const H5std_string& message) : de
///\param orig - IN: Exception instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Exception::Exception(const Exception& orig) : detail_message(orig.detail_message), func_name(orig.func_name) {}
+Exception::Exception(const Exception &orig) : detail_message(orig.detail_message), func_name(orig.func_name)
+{
+}
//--------------------------------------------------------------------------
// Function: Exception::getMajorString
@@ -56,32 +61,30 @@ Exception::Exception(const Exception& orig) : detail_message(orig.detail_message
/// will be returned.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string Exception::getMajorString(hid_t err_major) const
+H5std_string
+Exception::getMajorString(hid_t err_major) const
{
// Preliminary call to H5Eget_msg() to get the length of the message
ssize_t mesg_size = H5Eget_msg(err_major, NULL, NULL, 0);
// If H5Eget_msg() returns a negative value, raise an exception,
if (mesg_size < 0)
- throw IdComponentException("Exception::getMajorString",
- "H5Eget_msg failed");
+ throw IdComponentException("Exception::getMajorString", "H5Eget_msg failed");
// Call H5Eget_msg again to get the actual message
- char* mesg_C = new char[mesg_size+1]; // temporary C-string for C API
- mesg_size = H5Eget_msg(err_major, NULL, mesg_C, mesg_size+1);
+ char *mesg_C = new char[mesg_size + 1]; // temporary C-string for C API
+ mesg_size = H5Eget_msg(err_major, NULL, mesg_C, mesg_size + 1);
// Check for failure again
- if (mesg_size < 0)
- {
- delete []mesg_C;
- throw IdComponentException("Exception::getMajorString",
- "H5Eget_msg failed");
+ if (mesg_size < 0) {
+ delete[] mesg_C;
+ throw IdComponentException("Exception::getMajorString", "H5Eget_msg failed");
}
// Convert the C error description and return
H5std_string major_str(mesg_C);
- delete []mesg_C;
- return(major_str);
+ delete[] mesg_C;
+ return (major_str);
}
//--------------------------------------------------------------------------
@@ -95,32 +98,30 @@ H5std_string Exception::getMajorString(hid_t err_major) const
/// will be returned.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string Exception::getMinorString(hid_t err_minor) const
+H5std_string
+Exception::getMinorString(hid_t err_minor) const
{
// Preliminary call to H5Eget_msg() to get the length of the message
ssize_t mesg_size = H5Eget_msg(err_minor, NULL, NULL, 0);
// If H5Eget_msg() returns a negative value, raise an exception,
if (mesg_size < 0)
- throw IdComponentException("Exception::getMinorString",
- "H5Eget_msg failed");
+ throw IdComponentException("Exception::getMinorString", "H5Eget_msg failed");
// Call H5Eget_msg again to get the actual message
- char* mesg_C = new char[mesg_size+1]; // temporary C-string for C API
- mesg_size = H5Eget_msg(err_minor, NULL, mesg_C, mesg_size+1);
+ char *mesg_C = new char[mesg_size + 1]; // temporary C-string for C API
+ mesg_size = H5Eget_msg(err_minor, NULL, mesg_C, mesg_size + 1);
// Check for failure again
- if (mesg_size < 0)
- {
- delete []mesg_C;
- throw IdComponentException("Exception::getMinorString",
- "H5Eget_msg failed");
+ if (mesg_size < 0) {
+ delete[] mesg_C;
+ throw IdComponentException("Exception::getMinorString", "H5Eget_msg failed");
}
// Convert the C error description and return
H5std_string minor_str(mesg_C);
- delete []mesg_C;
- return(minor_str);
+ delete[] mesg_C;
+ return (minor_str);
}
//--------------------------------------------------------------------------
@@ -139,7 +140,8 @@ H5std_string Exception::getMinorString(hid_t err_minor) const
/// handlers
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Exception::setAutoPrint(H5E_auto2_t& func, void* client_data)
+void
+Exception::setAutoPrint(H5E_auto2_t &func, void *client_data)
{
// calls the C API routine H5Eset_auto to set the auto printing to
// the specified function.
@@ -153,7 +155,8 @@ void Exception::setAutoPrint(H5E_auto2_t& func, void* client_data)
///\brief Turns off the automatic error printing from the C library.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Exception::dontPrint()
+void
+Exception::dontPrint()
{
// calls the C API routine H5Eset_auto with NULL parameters to turn
// off the automatic error printing.
@@ -172,7 +175,8 @@ void Exception::dontPrint()
/// the error function
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Exception::getAutoPrint(H5E_auto2_t& func, void** client_data)
+void
+Exception::getAutoPrint(H5E_auto2_t &func, void **client_data)
{
// calls the C API routine H5Eget_auto to get the current setting of
// the automatic error printing
@@ -189,7 +193,8 @@ void Exception::getAutoPrint(H5E_auto2_t& func, void** client_data)
/// called, with certain exceptions (for instance, \c H5Eprint).
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Exception::clearErrorStack()
+void
+Exception::clearErrorStack()
{
// calls the C API routine H5Eclear to clear the error stack
herr_t ret_value = H5Eclear2(H5E_DEFAULT);
@@ -238,7 +243,8 @@ void Exception::clearErrorStack()
///\endcode
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Exception::walkErrorStack(H5E_direction_t direction, H5E_walk2_t func, void* client_data)
+void
+Exception::walkErrorStack(H5E_direction_t direction, H5E_walk2_t func, void *client_data)
{
// calls the C API routine H5Ewalk to walk the error stack
herr_t ret_value = H5Ewalk2(H5E_DEFAULT, direction, func, client_data);
@@ -253,9 +259,10 @@ void Exception::walkErrorStack(H5E_direction_t direction, H5E_walk2_t func, void
///\return Text message - \c H5std_string
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string Exception::getDetailMsg() const
+H5std_string
+Exception::getDetailMsg() const
{
- return(detail_message);
+ return (detail_message);
}
//--------------------------------------------------------------------------
@@ -265,9 +272,10 @@ H5std_string Exception::getDetailMsg() const
///\return Text message - \c char pointer
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-const char* Exception::getCDetailMsg() const
+const char *
+Exception::getCDetailMsg() const
{
- return(detail_message.c_str());
+ return (detail_message.c_str());
}
//--------------------------------------------------------------------------
@@ -276,9 +284,10 @@ const char* Exception::getCDetailMsg() const
///\return Text message - \c H5std_string
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string Exception::getFuncName() const
+H5std_string
+Exception::getFuncName() const
{
- return(func_name);
+ return (func_name);
}
//--------------------------------------------------------------------------
@@ -287,9 +296,10 @@ H5std_string Exception::getFuncName() const
///\return Text message - \c char pointer
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-const char* Exception::getCFuncName() const
+const char *
+Exception::getCFuncName() const
{
- return(func_name.c_str());
+ return (func_name.c_str());
}
//--------------------------------------------------------------------------
@@ -299,7 +309,8 @@ const char* Exception::getCFuncName() const
///\param err_stack - IN: Error stack ID, default to H5E_DEFAULT(0)
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Exception::printErrorStack(FILE* stream, hid_t err_stack)
+void
+Exception::printErrorStack(FILE *stream, hid_t err_stack)
{
herr_t ret_value = H5Eprint2(err_stack, stream);
if (ret_value < 0)
@@ -319,7 +330,7 @@ void Exception::printErrorStack(FILE* stream, hid_t err_stack)
// Removed from documentation. -BMR, 2016/03/23
// Removed from code. -BMR, 2017/08/11 1.8.20 and 1.10.2
//--------------------------------------------------------------------------
-//void Exception::printError(FILE* stream) const
+// void Exception::printError(FILE* stream) const
//{
// Exception::printErrorStack(stream, H5E_DEFAULT);
//}
@@ -339,7 +350,7 @@ Exception::~Exception() throw() {}
// Function: FileIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-FileIException::FileIException():Exception(){}
+FileIException::FileIException() : Exception() {}
//--------------------------------------------------------------------------
// Function: FileIException overloaded constructor
///\brief Creates a FileIException with the name of the function,
@@ -347,7 +358,10 @@ FileIException::FileIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-FileIException::FileIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+FileIException::FileIException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: FileIException destructor
///\brief Noop destructor.
@@ -362,7 +376,7 @@ FileIException::~FileIException() throw() {}
// Function: GroupIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-GroupIException::GroupIException():Exception(){}
+GroupIException::GroupIException() : Exception() {}
//--------------------------------------------------------------------------
// Function: GroupIException overloaded constructor
///\brief Creates a GroupIException with the name of the function,
@@ -370,7 +384,10 @@ GroupIException::GroupIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-GroupIException::GroupIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+GroupIException::GroupIException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: GroupIException destructor
///\brief Noop destructor.
@@ -385,7 +402,7 @@ GroupIException::~GroupIException() throw() {}
// Function: DataSpaceIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-DataSpaceIException::DataSpaceIException():Exception(){}
+DataSpaceIException::DataSpaceIException() : Exception() {}
//--------------------------------------------------------------------------
// Function: DataSpaceIException overloaded constructor
///\brief Creates a DataSpaceIException with the name of the function,
@@ -393,7 +410,10 @@ DataSpaceIException::DataSpaceIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-DataSpaceIException::DataSpaceIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+DataSpaceIException::DataSpaceIException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: DataSpaceIException destructor
///\brief Noop destructor.
@@ -408,7 +428,7 @@ DataSpaceIException::~DataSpaceIException() throw() {}
// Function: DataTypeIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-DataTypeIException::DataTypeIException():Exception(){}
+DataTypeIException::DataTypeIException() : Exception() {}
//--------------------------------------------------------------------------
// Function: DataTypeIException overloaded constructor
///\brief Creates a DataTypeIException with the name of the function,
@@ -416,7 +436,10 @@ DataTypeIException::DataTypeIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-DataTypeIException::DataTypeIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+DataTypeIException::DataTypeIException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: DataTypeIException destructor
///\brief Noop destructor.
@@ -431,7 +454,7 @@ DataTypeIException::~DataTypeIException() throw() {}
// Function: ObjHeaderIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-ObjHeaderIException::ObjHeaderIException():Exception(){}
+ObjHeaderIException::ObjHeaderIException() : Exception() {}
//--------------------------------------------------------------------------
// Function: ObjHeaderIException overloaded constructor
///\brief Creates an ObjHeaderIException with the name of the function,
@@ -439,7 +462,10 @@ ObjHeaderIException::ObjHeaderIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-ObjHeaderIException::ObjHeaderIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+ObjHeaderIException::ObjHeaderIException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: ObjHeaderIException destructor
///\brief Noop destructor.
@@ -454,7 +480,7 @@ ObjHeaderIException::~ObjHeaderIException() throw() {}
// Function: PropListIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-PropListIException::PropListIException():Exception(){}
+PropListIException::PropListIException() : Exception() {}
//--------------------------------------------------------------------------
// Function: PropListIException overloaded constructor
///\brief Creates a PropListIException with the name of the function,
@@ -462,7 +488,10 @@ PropListIException::PropListIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-PropListIException::PropListIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+PropListIException::PropListIException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: PropListIException destructor
///\brief Noop destructor.
@@ -477,7 +506,7 @@ PropListIException::~PropListIException() throw() {}
// Function: DataSetIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-DataSetIException::DataSetIException():Exception(){}
+DataSetIException::DataSetIException() : Exception() {}
//--------------------------------------------------------------------------
// Function: DataSetIException overloaded constructor
///\brief Creates a DataSetIException with the name of the function,
@@ -485,7 +514,10 @@ DataSetIException::DataSetIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-DataSetIException::DataSetIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+DataSetIException::DataSetIException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: DataSetIException destructor
///\brief Noop destructor.
@@ -500,7 +532,7 @@ DataSetIException::~DataSetIException() throw() {}
// Function: AttributeIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-AttributeIException::AttributeIException():Exception(){}
+AttributeIException::AttributeIException() : Exception() {}
//--------------------------------------------------------------------------
// Function: AttributeIException overloaded constructor
///\brief Creates an AttributeIException with the name of the function,
@@ -508,7 +540,10 @@ AttributeIException::AttributeIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-AttributeIException::AttributeIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+AttributeIException::AttributeIException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: AttributeIException destructor
///\brief Noop destructor.
@@ -523,7 +558,7 @@ AttributeIException::~AttributeIException() throw() {}
// Function: ReferenceException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-ReferenceException::ReferenceException():Exception(){}
+ReferenceException::ReferenceException() : Exception() {}
//--------------------------------------------------------------------------
// Function: ReferenceException overloaded constructor
///\brief Creates a ReferenceException with the name of the function,
@@ -531,7 +566,10 @@ ReferenceException::ReferenceException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-ReferenceException::ReferenceException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+ReferenceException::ReferenceException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: ReferenceException destructor
///\brief Noop destructor.
@@ -546,7 +584,7 @@ ReferenceException::~ReferenceException() throw() {}
// Function: LibraryIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-LibraryIException::LibraryIException():Exception(){}
+LibraryIException::LibraryIException() : Exception() {}
//--------------------------------------------------------------------------
// Function: LibraryIException overloaded constructor
///\brief Creates a LibraryIException with the name of the function,
@@ -554,7 +592,10 @@ LibraryIException::LibraryIException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-LibraryIException::LibraryIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+LibraryIException::LibraryIException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: LibraryIException destructor
///\brief Noop destructor.
@@ -569,7 +610,7 @@ LibraryIException::~LibraryIException() throw() {}
// Function: LocationException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-LocationException::LocationException():Exception(){}
+LocationException::LocationException() : Exception() {}
//--------------------------------------------------------------------------
// Function: LocationException overloaded constructor
///\brief Creates a LocationException with the name of the function,
@@ -577,7 +618,10 @@ LocationException::LocationException():Exception(){}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-LocationException::LocationException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+LocationException::LocationException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: LocationException destructor
///\brief Noop destructor.
@@ -592,7 +636,7 @@ LocationException::~LocationException() throw() {}
// Function: IdComponentException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
-IdComponentException::IdComponentException(): Exception() {}
+IdComponentException::IdComponentException() : Exception() {}
//--------------------------------------------------------------------------
// Function: IdComponentException overloaded constructor
///\brief Creates a IdComponentException with the name of the function,
@@ -600,11 +644,14 @@ IdComponentException::IdComponentException(): Exception() {}
///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-IdComponentException::IdComponentException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+IdComponentException::IdComponentException(const H5std_string &func, const H5std_string &message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: IdComponentException destructor
///\brief Noop destructor.
//--------------------------------------------------------------------------
IdComponentException::~IdComponentException() throw() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h
index cb14a4c..44edac2 100644
--- a/c++/src/H5Exception.h
+++ b/c++/src/H5Exception.h
@@ -19,9 +19,9 @@
namespace H5 {
#ifdef H5_NO_STD
- #define H5std_string ::string
+#define H5std_string ::string
#else
- #define H5std_string std::string
+#define H5std_string std::string
#endif
/*! \class Exception
@@ -30,150 +30,148 @@ namespace H5 {
Many classes are derived from Exception for specific HDF5 C interfaces.
*/
class H5_DLLCPP Exception {
- public:
- // Creates an exception with a function name where the failure occurs
- // and an optional detailed message
- Exception(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
-
- // Returns a character string that describes the error specified by
- // a major error number.
- H5std_string getMajorString(hid_t err_major_id) const;
-
- // Returns a character string that describes the error specified by
- // a minor error number.
- H5std_string getMinorString(hid_t err_minor_id) const;
-
- // Returns the detailed message set at the time the exception is thrown
- H5std_string getDetailMsg() const;
- const char* getCDetailMsg() const; // C string of detailed message
- H5std_string getFuncName() const; // function name as a string object
- const char* getCFuncName() const; // function name as a char string
-
- // Turns on the automatic error printing.
- static void setAutoPrint(H5E_auto2_t& func, void* client_data);
-
- // Turns off the automatic error printing.
- static void dontPrint();
-
- // Retrieves the current settings for the automatic error stack
- // traversal function and its data.
- static void getAutoPrint(H5E_auto2_t& func, void** client_data);
-
- // Clears the error stack for the current thread.
- static void clearErrorStack();
-
- // Walks the error stack for the current thread, calling the
- // specified function.
- static void walkErrorStack(H5E_direction_t direction,
- H5E_walk2_t func, void* client_data);
-
- // Prints the error stack in a default manner.
- static void printErrorStack(FILE* stream = stderr,
- hid_t err_stack = H5E_DEFAULT);
- // Deprecated in favor of printErrorStack.
- // Removed from code. -BMR, 2017/08/11 1.8.20 and 1.10.2
- // virtual void printError(FILE* stream = NULL) const;
-
- // Default constructor
- Exception();
-
- // copy constructor
- Exception(const Exception& orig);
-
- // virtual Destructor
- virtual ~Exception() throw();
-
- protected:
- // Default value for detail_message
- static const char DEFAULT_MSG[];
-
- private:
- H5std_string detail_message;
- H5std_string func_name;
+ public:
+ // Creates an exception with a function name where the failure occurs
+ // and an optional detailed message
+ Exception(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+
+ // Returns a character string that describes the error specified by
+ // a major error number.
+ H5std_string getMajorString(hid_t err_major_id) const;
+
+ // Returns a character string that describes the error specified by
+ // a minor error number.
+ H5std_string getMinorString(hid_t err_minor_id) const;
+
+ // Returns the detailed message set at the time the exception is thrown
+ H5std_string getDetailMsg() const;
+ const char * getCDetailMsg() const; // C string of detailed message
+ H5std_string getFuncName() const; // function name as a string object
+ const char * getCFuncName() const; // function name as a char string
+
+ // Turns on the automatic error printing.
+ static void setAutoPrint(H5E_auto2_t &func, void *client_data);
+
+ // Turns off the automatic error printing.
+ static void dontPrint();
+
+ // Retrieves the current settings for the automatic error stack
+ // traversal function and its data.
+ static void getAutoPrint(H5E_auto2_t &func, void **client_data);
+
+ // Clears the error stack for the current thread.
+ static void clearErrorStack();
+
+ // Walks the error stack for the current thread, calling the
+ // specified function.
+ static void walkErrorStack(H5E_direction_t direction, H5E_walk2_t func, void *client_data);
+
+ // Prints the error stack in a default manner.
+ static void printErrorStack(FILE *stream = stderr, hid_t err_stack = H5E_DEFAULT);
+ // Deprecated in favor of printErrorStack.
+ // Removed from code. -BMR, 2017/08/11 1.8.20 and 1.10.2
+ // virtual void printError(FILE* stream = NULL) const;
+
+ // Default constructor
+ Exception();
+
+ // copy constructor
+ Exception(const Exception &orig);
+
+ // virtual Destructor
+ virtual ~Exception() throw();
+
+ protected:
+ // Default value for detail_message
+ static const char DEFAULT_MSG[];
+
+ private:
+ H5std_string detail_message;
+ H5std_string func_name;
};
class H5_DLLCPP FileIException : public Exception {
- public:
- FileIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- FileIException();
- virtual ~FileIException() throw();
+ public:
+ FileIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ FileIException();
+ virtual ~FileIException() throw();
};
class H5_DLLCPP GroupIException : public Exception {
- public:
- GroupIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- GroupIException();
- virtual ~GroupIException() throw();
+ public:
+ GroupIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ GroupIException();
+ virtual ~GroupIException() throw();
};
class H5_DLLCPP DataSpaceIException : public Exception {
- public:
- DataSpaceIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- DataSpaceIException();
- virtual ~DataSpaceIException() throw();
+ public:
+ DataSpaceIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ DataSpaceIException();
+ virtual ~DataSpaceIException() throw();
};
class H5_DLLCPP DataTypeIException : public Exception {
- public:
- DataTypeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- DataTypeIException();
- virtual ~DataTypeIException() throw();
+ public:
+ DataTypeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ DataTypeIException();
+ virtual ~DataTypeIException() throw();
};
class H5_DLLCPP ObjHeaderIException : public Exception {
- public:
- ObjHeaderIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- ObjHeaderIException();
- virtual ~ObjHeaderIException() throw();
+ public:
+ ObjHeaderIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ ObjHeaderIException();
+ virtual ~ObjHeaderIException() throw();
};
class H5_DLLCPP PropListIException : public Exception {
- public:
- PropListIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- PropListIException();
- virtual ~PropListIException() throw();
+ public:
+ PropListIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ PropListIException();
+ virtual ~PropListIException() throw();
};
class H5_DLLCPP DataSetIException : public Exception {
- public:
- DataSetIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- DataSetIException();
- virtual ~DataSetIException() throw();
+ public:
+ DataSetIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ DataSetIException();
+ virtual ~DataSetIException() throw();
};
class H5_DLLCPP AttributeIException : public Exception {
- public:
- AttributeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- AttributeIException();
- virtual ~AttributeIException() throw();
+ public:
+ AttributeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ AttributeIException();
+ virtual ~AttributeIException() throw();
};
class H5_DLLCPP ReferenceException : public Exception {
- public:
- ReferenceException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- ReferenceException();
- virtual ~ReferenceException() throw();
+ public:
+ ReferenceException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ ReferenceException();
+ virtual ~ReferenceException() throw();
};
class H5_DLLCPP LibraryIException : public Exception {
- public:
- LibraryIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- LibraryIException();
- virtual ~LibraryIException() throw();
+ public:
+ LibraryIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ LibraryIException();
+ virtual ~LibraryIException() throw();
};
class H5_DLLCPP LocationException : public Exception {
- public:
- LocationException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- LocationException();
- virtual ~LocationException() throw();
+ public:
+ LocationException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ LocationException();
+ virtual ~LocationException() throw();
};
class H5_DLLCPP IdComponentException : public Exception {
- public:
- IdComponentException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- IdComponentException();
- virtual ~IdComponentException() throw();
+ public:
+ IdComponentException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ IdComponentException();
+ virtual ~IdComponentException() throw();
}; // end of IdComponentException
} // namespace H5
diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp
index 7bd38ea..0f7184c 100644
--- a/c++/src/H5FaccProp.cpp
+++ b/c++/src/H5FaccProp.cpp
@@ -37,7 +37,7 @@ namespace H5 {
// in "H5PredType.cpp" for information.
// Initialize a pointer for the constant
-FileAccPropList* FileAccPropList::DEFAULT_ = 0;
+FileAccPropList *FileAccPropList::DEFAULT_ = 0;
//--------------------------------------------------------------------------
// Function: FileAccPropList::getConstant
@@ -50,13 +50,13 @@ FileAccPropList* FileAccPropList::DEFAULT_ = 0;
// happen.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-FileAccPropList* FileAccPropList::getConstant()
+FileAccPropList *
+FileAccPropList::getConstant()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -65,8 +65,9 @@ FileAccPropList* FileAccPropList::getConstant()
if (DEFAULT_ == 0)
DEFAULT_ = new FileAccPropList(H5P_FILE_ACCESS);
else
- throw PropListIException("FileAccPropList::getConstant", "FileAccPropList::getConstant is being invoked on an allocated DEFAULT_");
- return(DEFAULT_);
+ throw PropListIException("FileAccPropList::getConstant",
+ "FileAccPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return (DEFAULT_);
}
//--------------------------------------------------------------------------
@@ -76,7 +77,8 @@ FileAccPropList* FileAccPropList::getConstant()
// exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void FileAccPropList::deleteConstants()
+void
+FileAccPropList::deleteConstants()
{
if (DEFAULT_ != 0)
delete DEFAULT_;
@@ -85,7 +87,7 @@ void FileAccPropList::deleteConstants()
//--------------------------------------------------------------------------
// Purpose Constant for default property
//--------------------------------------------------------------------------
-const FileAccPropList& FileAccPropList::DEFAULT = *getConstant();
+const FileAccPropList &FileAccPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -102,7 +104,7 @@ FileAccPropList::FileAccPropList() : PropList(H5P_FILE_ACCESS) {}
///\param original - IN: FileAccPropList instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FileAccPropList::FileAccPropList(const FileAccPropList& original) : PropList(original) {}
+FileAccPropList::FileAccPropList(const FileAccPropList &original) : PropList(original) {}
//--------------------------------------------------------------------------
// Function: FileAccPropList overloaded constructor
@@ -119,11 +121,11 @@ FileAccPropList::FileAccPropList(const hid_t plist_id) : PropList(plist_id) {}
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setStdio() const
+void
+FileAccPropList::setStdio() const
{
herr_t ret_value = H5Pset_fapl_stdio(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setStdio", "H5Pset_fapl_stdio failed");
}
}
@@ -139,14 +141,14 @@ void FileAccPropList::setStdio() const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-hid_t FileAccPropList::getDriver() const
+hid_t
+FileAccPropList::getDriver() const
{
hid_t driver = H5Pget_driver(id);
- if (driver < 0)
- {
+ if (driver < 0) {
throw PropListIException("FileAccPropList::getDriver", "H5Pget_driver failed");
}
- return(driver);
+ return (driver);
}
//--------------------------------------------------------------------------
@@ -160,11 +162,11 @@ hid_t FileAccPropList::getDriver() const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setDriver(hid_t new_driver_id, const void *new_driver_info) const
+void
+FileAccPropList::setDriver(hid_t new_driver_id, const void *new_driver_info) const
{
herr_t ret_value = H5Pset_driver(id, new_driver_id, new_driver_info);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setDriver", "H5Pset_driver failed");
}
}
@@ -176,11 +178,11 @@ void FileAccPropList::setDriver(hid_t new_driver_id, const void *new_driver_info
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setFamilyOffset(hsize_t offset) const
+void
+FileAccPropList::setFamilyOffset(hsize_t offset) const
{
herr_t ret_value = H5Pset_family_offset(id, offset);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setFamilyOffset", "H5Pset_family_offset failed");
}
}
@@ -192,15 +194,15 @@ void FileAccPropList::setFamilyOffset(hsize_t offset) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-hsize_t FileAccPropList::getFamilyOffset() const
+hsize_t
+FileAccPropList::getFamilyOffset() const
{
hsize_t offset;
- herr_t ret_value = H5Pget_family_offset(id, &offset);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Pget_family_offset(id, &offset);
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getFamilyOffset", "H5Pget_family_offset failed");
}
- return(offset);
+ return (offset);
}
//--------------------------------------------------------------------------
@@ -217,12 +219,12 @@ hsize_t FileAccPropList::getFamilyOffset() const
/// refer to the H5Pset_fapl_core API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setCore (size_t increment, hbool_t backing_store) const
+void
+FileAccPropList::setCore(size_t increment, hbool_t backing_store) const
{
- herr_t ret_value = H5Pset_fapl_core (id, increment, backing_store);
- if (ret_value < 0)
- {
- throw PropListIException ("FileAccPropList::setCore", "H5Pset_fapl_core failed");
+ herr_t ret_value = H5Pset_fapl_core(id, increment, backing_store);
+ if (ret_value < 0) {
+ throw PropListIException("FileAccPropList::setCore", "H5Pset_fapl_core failed");
}
}
@@ -235,11 +237,11 @@ void FileAccPropList::setCore (size_t increment, hbool_t backing_store) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::getCore (size_t& increment, hbool_t& backing_store) const
+void
+FileAccPropList::getCore(size_t &increment, hbool_t &backing_store) const
{
herr_t ret_value = H5Pget_fapl_core(id, &increment, &backing_store);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getCore", "H5Pget_fapl_core failed");
}
}
@@ -255,11 +257,11 @@ void FileAccPropList::getCore (size_t& increment, hbool_t& backing_store) const
/// Note that \a memb_size is used only when creating a new file.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setFamily(hsize_t memb_size, const FileAccPropList& memb_plist) const
+void
+FileAccPropList::setFamily(hsize_t memb_size, const FileAccPropList &memb_plist) const
{
- herr_t ret_value = H5Pset_fapl_family (id, memb_size, memb_plist.getId());
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Pset_fapl_family(id, memb_size, memb_plist.getId());
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setFamily", "H5Pset_fapl_family failed");
}
}
@@ -274,12 +276,12 @@ void FileAccPropList::setFamily(hsize_t memb_size, const FileAccPropList& memb_p
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::getFamily(hsize_t& memb_size, FileAccPropList& memb_plist) const
+void
+FileAccPropList::getFamily(hsize_t &memb_size, FileAccPropList &memb_plist) const
{
- hid_t memb_plist_id;
+ hid_t memb_plist_id;
herr_t ret_value = H5Pget_fapl_family(id, &memb_size, &memb_plist_id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getFamily", "H5Pget_fapl_family failed");
}
memb_plist.p_setId(memb_plist_id);
@@ -295,16 +297,16 @@ void FileAccPropList::getFamily(hsize_t& memb_size, FileAccPropList& memb_plist)
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-FileAccPropList FileAccPropList::getFamily(hsize_t& memb_size) const
+FileAccPropList
+FileAccPropList::getFamily(hsize_t &memb_size) const
{
- hid_t memb_plist_id;
+ hid_t memb_plist_id;
herr_t ret_value = H5Pget_fapl_family(id, &memb_size, &memb_plist_id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getFamily", "H5Pget_fapl_family failed");
}
FileAccPropList memb_plist(memb_plist_id);
- return(memb_plist);
+ return (memb_plist);
}
//--------------------------------------------------------------------------
@@ -321,13 +323,14 @@ FileAccPropList FileAccPropList::getFamily(hsize_t& memb_size) const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccPropList& raw_plist, const char* meta_ext, const char* raw_ext) const
+void
+FileAccPropList::setSplit(const FileAccPropList &meta_plist, const FileAccPropList &raw_plist,
+ const char *meta_ext, const char *raw_ext) const
{
- hid_t meta_pid = meta_plist.getId();
- hid_t raw_pid = raw_plist.getId();
+ hid_t meta_pid = meta_plist.getId();
+ hid_t raw_pid = raw_plist.getId();
herr_t ret_value = H5Pset_fapl_split(id, meta_ext, meta_pid, raw_ext, raw_pid);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setSplit", "H5Pset_fapl_split failed");
}
}
@@ -343,7 +346,9 @@ void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccP
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccPropList& raw_plist, const H5std_string& meta_ext, const H5std_string& raw_ext) const
+void
+FileAccPropList::setSplit(const FileAccPropList &meta_plist, const FileAccPropList &raw_plist,
+ const H5std_string &meta_ext, const H5std_string &raw_ext) const
{
setSplit(meta_plist, raw_plist, meta_ext.c_str(), raw_ext.c_str());
}
@@ -360,15 +365,15 @@ void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccP
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-size_t FileAccPropList::getSieveBufSize() const
+size_t
+FileAccPropList::getSieveBufSize() const
{
size_t bufsize;
herr_t ret_value = H5Pget_sieve_buf_size(id, &bufsize);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getSieveBufSize", "H5Pget_sieve_buf_size failed");
}
- return(bufsize);
+ return (bufsize);
}
//--------------------------------------------------------------------------
@@ -381,11 +386,11 @@ size_t FileAccPropList::getSieveBufSize() const
/// API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setSieveBufSize(size_t bufsize) const
+void
+FileAccPropList::setSieveBufSize(size_t bufsize) const
{
herr_t ret_value = H5Pset_sieve_buf_size(id, bufsize);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getSieveBufSize", "H5Pget_sieve_buf_size failed");
}
}
@@ -401,11 +406,11 @@ void FileAccPropList::setSieveBufSize(size_t bufsize) const
/// API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setMetaBlockSize(hsize_t &block_size) const
+void
+FileAccPropList::setMetaBlockSize(hsize_t &block_size) const
{
herr_t ret_value = H5Pset_meta_block_size(id, block_size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setMetaBlockSize", "H5Pset_meta_block_size failed");
}
}
@@ -417,15 +422,15 @@ void FileAccPropList::setMetaBlockSize(hsize_t &block_size) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-hsize_t FileAccPropList::getMetaBlockSize() const
+hsize_t
+FileAccPropList::getMetaBlockSize() const
{
hsize_t block_size;
- herr_t ret_value = H5Pget_meta_block_size(id, &block_size);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Pget_meta_block_size(id, &block_size);
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getMetaBlockSize", "H5Pget_meta_block_size failed");
}
- return(block_size);
+ return (block_size);
}
//--------------------------------------------------------------------------
@@ -441,11 +446,11 @@ hsize_t FileAccPropList::getMetaBlockSize() const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setLog(const char *logfile, unsigned flags, size_t buf_size) const
+void
+FileAccPropList::setLog(const char *logfile, unsigned flags, size_t buf_size) const
{
herr_t ret_value = H5Pset_fapl_log(id, logfile, flags, buf_size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setLog", "H5Pset_fapl_log failed");
}
}
@@ -460,7 +465,8 @@ void FileAccPropList::setLog(const char *logfile, unsigned flags, size_t buf_siz
///\param buf_size - IN: Size of the logging buffer
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setLog(const H5std_string& logfile, unsigned flags, size_t buf_size) const
+void
+FileAccPropList::setLog(const H5std_string &logfile, unsigned flags, size_t buf_size) const
{
setLog(logfile.c_str(), flags, buf_size);
}
@@ -473,11 +479,11 @@ void FileAccPropList::setLog(const H5std_string& logfile, unsigned flags, size_t
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setSec2() const
+void
+FileAccPropList::setSec2() const
{
herr_t ret_value = H5Pset_fapl_sec2(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setSec2", "H5Pset_fapl_sec2 failed");
}
}
@@ -498,11 +504,11 @@ void FileAccPropList::setSec2() const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileAccPropList::setAlignment(hsize_t threshold, hsize_t alignment) const
+void
+FileAccPropList::setAlignment(hsize_t threshold, hsize_t alignment) const
{
herr_t ret_value = H5Pset_alignment(id, threshold, alignment);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setAlignment", "H5Pset_alignment failed");
}
}
@@ -516,11 +522,11 @@ void FileAccPropList::setAlignment(hsize_t threshold, hsize_t alignment) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileAccPropList::getAlignment(hsize_t &threshold, hsize_t &alignment) const
+void
+FileAccPropList::getAlignment(hsize_t &threshold, hsize_t &alignment) const
{
herr_t ret_value = H5Pget_alignment(id, &threshold, &alignment);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getAlignment", "H5Pget_alignment failed");
}
}
@@ -535,11 +541,11 @@ void FileAccPropList::getAlignment(hsize_t &threshold, hsize_t &alignment) const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setMultiType(H5FD_mem_t dtype) const
+void
+FileAccPropList::setMultiType(H5FD_mem_t dtype) const
{
herr_t ret_value = H5Pset_multi_type(id, dtype);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setMultiType", "H5Pset_multi_type failed");
}
}
@@ -554,15 +560,15 @@ void FileAccPropList::setMultiType(H5FD_mem_t dtype) const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-H5FD_mem_t FileAccPropList::getMultiType() const
+H5FD_mem_t
+FileAccPropList::getMultiType() const
{
H5FD_mem_t dtype;
- herr_t ret_value = H5Pget_multi_type(id, &dtype);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Pget_multi_type(id, &dtype);
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getMultiType", "H5Pget_multi_type failed");
}
- return(dtype);
+ return (dtype);
}
//--------------------------------------------------------------------------
@@ -582,11 +588,11 @@ H5FD_mem_t FileAccPropList::getMultiType() const
/// means fully read chunks are always preempted before other chunks.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileAccPropList::setCache(int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0) const
+void
+FileAccPropList::setCache(int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0) const
{
herr_t ret_value = H5Pset_cache(id, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setCache", "H5Pset_cache failed");
}
}
@@ -601,11 +607,11 @@ void FileAccPropList::setCache(int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_n
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileAccPropList::getCache(int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0) const
+void
+FileAccPropList::getCache(int &mdc_nelmts, size_t &rdcc_nelmts, size_t &rdcc_nbytes, double &rdcc_w0) const
{
herr_t ret_value = H5Pget_cache(id, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getCache", "H5Pget_cache failed");
}
}
@@ -617,11 +623,11 @@ void FileAccPropList::getCache(int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rdc
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setFcloseDegree(H5F_close_degree_t degree) const
+void
+FileAccPropList::setFcloseDegree(H5F_close_degree_t degree) const
{
herr_t ret_value = H5Pset_fclose_degree(id, degree);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setFcloseDegree", "H5Pset_fclose_degree failed");
}
}
@@ -633,15 +639,15 @@ void FileAccPropList::setFcloseDegree(H5F_close_degree_t degree) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-H5F_close_degree_t FileAccPropList::getFcloseDegree() const
+H5F_close_degree_t
+FileAccPropList::getFcloseDegree() const
{
H5F_close_degree_t degree;
- herr_t ret_value = H5Pget_fclose_degree(id, &degree);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Pget_fclose_degree(id, &degree);
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getFcloseDegree", "H5Pget_fclose_degree failed");
}
- return(degree);
+ return (degree);
}
//--------------------------------------------------------------------------
@@ -655,11 +661,11 @@ H5F_close_degree_t FileAccPropList::getFcloseDegree() const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileAccPropList::setGcReferences(unsigned gc_ref) const
+void
+FileAccPropList::setGcReferences(unsigned gc_ref) const
{
herr_t ret_value = H5Pset_gc_references(id, gc_ref);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setGcReferences", "H5Pset_gc_references failed");
}
}
@@ -671,17 +677,17 @@ void FileAccPropList::setGcReferences(unsigned gc_ref) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-unsigned FileAccPropList::getGcReferences() const
+unsigned
+FileAccPropList::getGcReferences() const
{
unsigned gc_ref;
// the name of this routine will be changed to H5Pget_gc_references???
herr_t ret_value = H5Pget_gc_references(id, &gc_ref);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getGcReferences", "H5Pget_gc_references failed");
}
- return(gc_ref);
+ return (gc_ref);
}
//--------------------------------------------------------------------------
@@ -710,11 +716,11 @@ unsigned FileAccPropList::getGcReferences() const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - March, 2015
//--------------------------------------------------------------------------
-void FileAccPropList::setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const
+void
+FileAccPropList::setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const
{
herr_t ret_value = H5Pset_libver_bounds(id, libver_low, libver_high);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::setLibverBounds", "H5Pset_libver_bounds failed");
}
}
@@ -744,11 +750,11 @@ void FileAccPropList::setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libv
/// \li \c H5F_LIBVER_LATEST
// Programmer Binh-Minh Ribler - March, 2015
//--------------------------------------------------------------------------
-void FileAccPropList::getLibverBounds(H5F_libver_t& libver_low, H5F_libver_t& libver_high) const
+void
+FileAccPropList::getLibverBounds(H5F_libver_t &libver_low, H5F_libver_t &libver_high) const
{
herr_t ret_value = H5Pget_libver_bounds(id, &libver_low, &libver_high);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileAccPropList::getLibverBounds", "H5Pget_libver_bounds failed");
}
}
@@ -760,4 +766,4 @@ void FileAccPropList::getLibverBounds(H5F_libver_t& libver_low, H5F_libver_t& li
//--------------------------------------------------------------------------
FileAccPropList::~FileAccPropList() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h
index 58f049e..d1a5051 100644
--- a/c++/src/H5FaccProp.h
+++ b/c++/src/H5FaccProp.h
@@ -23,139 +23,139 @@ namespace H5 {
*/
// Inheritance: PropList -> IdComponent
class H5_DLLCPP FileAccPropList : public PropList {
- public:
- ///\brief Default file access property list.
- static const FileAccPropList& DEFAULT;
+ public:
+ ///\brief Default file access property list.
+ static const FileAccPropList &DEFAULT;
- // Creates a file access property list.
- FileAccPropList();
+ // Creates a file access property list.
+ FileAccPropList();
- // Modifies this property list to use the H5FD_STDIO driver
- void setStdio() const;
+ // Modifies this property list to use the H5FD_STDIO driver
+ void setStdio() const;
- // Set file driver for this property list
- void setDriver(hid_t new_driver_id, const void *new_driver_info) const;
+ // Set file driver for this property list
+ void setDriver(hid_t new_driver_id, const void *new_driver_info) const;
- // Returns a low-level file driver identifier.
- hid_t getDriver() const;
+ // Returns a low-level file driver identifier.
+ hid_t getDriver() const;
- // Sets offset for family driver.
- void setFamilyOffset(hsize_t offset) const;
+ // Sets offset for family driver.
+ void setFamilyOffset(hsize_t offset) const;
- // Gets offset for family driver.
- hsize_t getFamilyOffset() const;
+ // Gets offset for family driver.
+ hsize_t getFamilyOffset() const;
- // Modifies this file access property list to use the sec2 driver.
- void setSec2() const;
+ // Modifies this file access property list to use the sec2 driver.
+ void setSec2() const;
- // Modifies this file access property list to use the H5FD_CORE
- // driver.
- void setCore (size_t increment, hbool_t backing_store) const;
+ // Modifies this file access property list to use the H5FD_CORE
+ // driver.
+ void setCore(size_t increment, hbool_t backing_store) const;
- // Queries H5FD_CORE driver properties.
- void getCore (size_t& increment, hbool_t& backing_store) const;
+ // Queries H5FD_CORE driver properties.
+ void getCore(size_t &increment, hbool_t &backing_store) const;
- // Sets this file access properties list to the family driver.
- void setFamily(hsize_t memb_size, const FileAccPropList& memb_plist) const;
+ // Sets this file access properties list to the family driver.
+ void setFamily(hsize_t memb_size, const FileAccPropList &memb_plist) const;
- // Returns information about the family file access property list.
- void getFamily(hsize_t& memb_size, FileAccPropList& memb_plist) const;
- FileAccPropList getFamily(hsize_t& memb_size) const;
+ // Returns information about the family file access property list.
+ void getFamily(hsize_t &memb_size, FileAccPropList &memb_plist) const;
+ FileAccPropList getFamily(hsize_t &memb_size) const;
- // Emulates the old split file driver,
- void setSplit(const FileAccPropList& meta_plist,
- const FileAccPropList& raw_plist,
- const char* meta_ext = ".meta",
- const char* raw_ext = ".raw") const;
- void setSplit(const FileAccPropList& meta_plist,
- const FileAccPropList& raw_plist,
- const H5std_string& meta_ext = ".meta",
- const H5std_string& raw_ext = ".raw") const;
+ // Emulates the old split file driver,
+ void setSplit(const FileAccPropList &meta_plist, const FileAccPropList &raw_plist,
+ const char *meta_ext = ".meta", const char *raw_ext = ".raw") const;
+ void setSplit(const FileAccPropList &meta_plist, const FileAccPropList &raw_plist,
+ const H5std_string &meta_ext = ".meta", const H5std_string &raw_ext = ".raw") const;
- // Sets the maximum size of the data sieve buffer.
- void setSieveBufSize(size_t bufsize) const;
+ // Sets the maximum size of the data sieve buffer.
+ void setSieveBufSize(size_t bufsize) const;
- // Returns the current settings for the data sieve buffer size
- // property
- size_t getSieveBufSize() const;
+ // Returns the current settings for the data sieve buffer size
+ // property
+ size_t getSieveBufSize() const;
- // Sets the minimum size of metadata block allocations.
- void setMetaBlockSize(hsize_t &block_size) const;
+ // Sets the minimum size of metadata block allocations.
+ void setMetaBlockSize(hsize_t &block_size) const;
- // Returns the current metadata block size setting.
- hsize_t getMetaBlockSize() const;
+ // Returns the current metadata block size setting.
+ hsize_t getMetaBlockSize() const;
- // Modifies this file access property list to use the logging driver.
- void setLog(const char *logfile, unsigned flags, size_t buf_size) const;
- void setLog(const H5std_string& logfile, unsigned flags, size_t buf_size) const;
+ // Modifies this file access property list to use the logging driver.
+ void setLog(const char *logfile, unsigned flags, size_t buf_size) const;
+ void setLog(const H5std_string &logfile, unsigned flags, size_t buf_size) const;
- // Sets alignment properties of this file access property list
- void setAlignment(hsize_t threshold = 1, hsize_t alignment = 1) const;
+ // Sets alignment properties of this file access property list
+ void setAlignment(hsize_t threshold = 1, hsize_t alignment = 1) const;
- // Retrieves the current settings for alignment properties from
- // this property list.
- void getAlignment(hsize_t& threshold, hsize_t& alignment) const;
+ // Retrieves the current settings for alignment properties from
+ // this property list.
+ void getAlignment(hsize_t &threshold, hsize_t &alignment) const;
- // Sets data type for multi driver.
- void setMultiType(H5FD_mem_t dtype) const;
+ // Sets data type for multi driver.
+ void setMultiType(H5FD_mem_t dtype) const;
- // Returns the data type property for MULTI driver.
- H5FD_mem_t getMultiType() const;
+ // Returns the data type property for MULTI driver.
+ H5FD_mem_t getMultiType() const;
- // Sets the meta data cache and raw data chunk cache parameters.
- void setCache(int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0) const;
+ // Sets the meta data cache and raw data chunk cache parameters.
+ void setCache(int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0) const;
- // Queries the meta data cache and raw data chunk cache parameters.
- void getCache(int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0) const;
+ // Queries the meta data cache and raw data chunk cache parameters.
+ void getCache(int &mdc_nelmts, size_t &rdcc_nelmts, size_t &rdcc_nbytes, double &rdcc_w0) const;
- // Sets the degree for the file close behavior.
- void setFcloseDegree(H5F_close_degree_t degree) const;
+ // Sets the degree for the file close behavior.
+ void setFcloseDegree(H5F_close_degree_t degree) const;
- // Returns the degree for the file close behavior.
- H5F_close_degree_t getFcloseDegree() const;
+ // Returns the degree for the file close behavior.
+ H5F_close_degree_t getFcloseDegree() const;
- // Sets file access property list to use the H5FD_DIRECT driver.
- void setFileAccDirect(size_t boundary, size_t block_size, size_t cbuf_size) const;
+ // Sets file access property list to use the H5FD_DIRECT driver.
+ void setFileAccDirect(size_t boundary, size_t block_size, size_t cbuf_size) const;
- // Retrieves information about the direct file access property list.
- void getFileAccDirect(size_t &boundary, size_t &block_size, size_t &cbuf_size) const;
+ // Retrieves information about the direct file access property list.
+ void getFileAccDirect(size_t &boundary, size_t &block_size, size_t &cbuf_size) const;
- // Sets garbage collecting references flag.
- void setGcReferences(unsigned gc_ref = 0) const;
+ // Sets garbage collecting references flag.
+ void setGcReferences(unsigned gc_ref = 0) const;
- // Returns garbage collecting references setting.
- unsigned getGcReferences() const;
+ // Returns garbage collecting references setting.
+ unsigned getGcReferences() const;
- // Sets bounds on versions of library format to be used when creating
- // or writing objects.
- void setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const;
+ // Sets bounds on versions of library format to be used when creating
+ // or writing objects.
+ void setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const;
- // Gets the current settings for the library version format bounds.
- void getLibverBounds(H5F_libver_t& libver_low, H5F_libver_t& libver_high) const;
+ // Gets the current settings for the library version format bounds.
+ void getLibverBounds(H5F_libver_t &libver_low, H5F_libver_t &libver_high) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("FileAccPropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("FileAccPropList");
+ }
- // Copy constructor: same as the original FileAccPropList.
- FileAccPropList(const FileAccPropList& original);
+ // Copy constructor: same as the original FileAccPropList.
+ FileAccPropList(const FileAccPropList &original);
- // Creates a copy of an existing file access property list
- // using the property list id.
- FileAccPropList (const hid_t plist_id);
+ // Creates a copy of an existing file access property list
+ // using the property list id.
+ FileAccPropList(const hid_t plist_id);
- // Noop destructor
- virtual ~FileAccPropList();
+ // Noop destructor
+ virtual ~FileAccPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the global constant, should only be used by the library
- static void deleteConstants();
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
- private:
- static FileAccPropList* DEFAULT_;
+ private:
+ static FileAccPropList *DEFAULT_;
- // Creates the global constant, should only be used by the library
- static FileAccPropList* getConstant();
+ // Creates the global constant, should only be used by the library
+ static FileAccPropList *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5FcreatProp.cpp b/c++/src/H5FcreatProp.cpp
index 9b0fecc..4bbebfd 100644
--- a/c++/src/H5FcreatProp.cpp
+++ b/c++/src/H5FcreatProp.cpp
@@ -27,7 +27,7 @@ namespace H5 {
// in "H5PredType.cpp" for information.
// Initialize a pointer for the constant
-FileCreatPropList* FileCreatPropList::DEFAULT_ = 0;
+FileCreatPropList *FileCreatPropList::DEFAULT_ = 0;
//--------------------------------------------------------------------------
// Function: FileCreatPropList::getConstant
@@ -39,13 +39,13 @@ FileCreatPropList* FileCreatPropList::DEFAULT_ = 0;
// object, throw a PropListIException. This scenario should not happen.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-FileCreatPropList* FileCreatPropList::getConstant()
+FileCreatPropList *
+FileCreatPropList::getConstant()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -54,8 +54,9 @@ FileCreatPropList* FileCreatPropList::getConstant()
if (DEFAULT_ == 0)
DEFAULT_ = new FileCreatPropList(H5P_FILE_CREATE);
else
- throw PropListIException("FileCreatPropList::getConstant", "FileCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
- return(DEFAULT_);
+ throw PropListIException("FileCreatPropList::getConstant",
+ "FileCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return (DEFAULT_);
}
//--------------------------------------------------------------------------
@@ -64,7 +65,8 @@ FileCreatPropList* FileCreatPropList::getConstant()
// points to.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void FileCreatPropList::deleteConstants()
+void
+FileCreatPropList::deleteConstants()
{
if (DEFAULT_ != 0)
delete DEFAULT_;
@@ -73,7 +75,7 @@ void FileCreatPropList::deleteConstants()
//--------------------------------------------------------------------------
// Purpose Constant for default property
//--------------------------------------------------------------------------
-const FileCreatPropList& FileCreatPropList::DEFAULT = *getConstant();
+const FileCreatPropList &FileCreatPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -91,7 +93,7 @@ FileCreatPropList::FileCreatPropList() : PropList(H5P_FILE_CREATE) {}
///\param original - IN: FileCreatPropList instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FileCreatPropList::FileCreatPropList(const FileCreatPropList& original) : PropList( original ) {}
+FileCreatPropList::FileCreatPropList(const FileCreatPropList &original) : PropList(original) {}
//--------------------------------------------------------------------------
// Function: FileCreatPropList overloaded constructor
@@ -115,13 +117,12 @@ FileCreatPropList::FileCreatPropList(const hid_t plist_id) : PropList(plist_id)
/// Any (or even all) of the output arguments can be null pointers.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileCreatPropList::getVersion(unsigned& super, unsigned& freelist, unsigned& stab, unsigned& shhdr) const
+void
+FileCreatPropList::getVersion(unsigned &super, unsigned &freelist, unsigned &stab, unsigned &shhdr) const
{
herr_t ret_value = H5Pget_version(id, &super, &freelist, &stab, &shhdr);
- if (ret_value < 0)
- {
- throw PropListIException("FileCreatPropList::getVersion",
- "H5Pget_version failed");
+ if (ret_value < 0) {
+ throw PropListIException("FileCreatPropList::getVersion", "H5Pget_version failed");
}
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -136,13 +137,12 @@ void FileCreatPropList::getVersion(unsigned& super, unsigned& freelist, unsigned
/// of 2 equal to 512 or greater (512, 1024, 2048, etc.)
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileCreatPropList::setUserblock(hsize_t size) const
+void
+FileCreatPropList::setUserblock(hsize_t size) const
{
herr_t ret_value = H5Pset_userblock(id, size);
- if (ret_value < 0)
- {
- throw PropListIException("FileCreatPropList::setUserblock",
- "H5Pset_userblock failed");
+ if (ret_value < 0) {
+ throw PropListIException("FileCreatPropList::setUserblock", "H5Pset_userblock failed");
}
}
@@ -153,16 +153,15 @@ void FileCreatPropList::setUserblock(hsize_t size) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-hsize_t FileCreatPropList::getUserblock() const
+hsize_t
+FileCreatPropList::getUserblock() const
{
hsize_t userblock_size;
- herr_t ret_value = H5Pget_userblock(id, &userblock_size);
- if (ret_value < 0)
- {
- throw PropListIException("FileCreatPropList::getUserblock",
- "H5Pget_userblock failed");
+ herr_t ret_value = H5Pget_userblock(id, &userblock_size);
+ if (ret_value < 0) {
+ throw PropListIException("FileCreatPropList::getUserblock", "H5Pget_userblock failed");
}
- return(userblock_size);
+ return (userblock_size);
}
//--------------------------------------------------------------------------
@@ -177,13 +176,12 @@ hsize_t FileCreatPropList::getUserblock() const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileCreatPropList::setSizes(size_t sizeof_addr, size_t sizeof_size) const
+void
+FileCreatPropList::setSizes(size_t sizeof_addr, size_t sizeof_size) const
{
herr_t ret_value = H5Pset_sizes(id, sizeof_addr, sizeof_size);
- if (ret_value < 0)
- {
- throw PropListIException("FileCreatPropList::setSizes",
- "H5Pset_sizes failed");
+ if (ret_value < 0) {
+ throw PropListIException("FileCreatPropList::setSizes", "H5Pset_sizes failed");
}
}
@@ -195,13 +193,12 @@ void FileCreatPropList::setSizes(size_t sizeof_addr, size_t sizeof_size) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileCreatPropList::getSizes(size_t& sizeof_addr, size_t& sizeof_size) const
+void
+FileCreatPropList::getSizes(size_t &sizeof_addr, size_t &sizeof_size) const
{
herr_t ret_value = H5Pget_sizes(id, &sizeof_addr, &sizeof_size);
- if (ret_value < 0)
- {
- throw PropListIException("FileCreatPropList::getSizes",
- "H5Pget_sizes failed");
+ if (ret_value < 0) {
+ throw PropListIException("FileCreatPropList::getSizes", "H5Pget_sizes failed");
}
}
@@ -217,13 +214,12 @@ void FileCreatPropList::getSizes(size_t& sizeof_addr, size_t& sizeof_size) const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileCreatPropList::setSymk(unsigned ik, unsigned lk) const
+void
+FileCreatPropList::setSymk(unsigned ik, unsigned lk) const
{
herr_t ret_value = H5Pset_sym_k(id, ik, lk);
- if (ret_value < 0)
- {
- throw PropListIException("FileCreatPropList::setSymk",
- "H5Pset_sym_k failed");
+ if (ret_value < 0) {
+ throw PropListIException("FileCreatPropList::setSymk", "H5Pset_sym_k failed");
}
}
@@ -238,13 +234,12 @@ void FileCreatPropList::setSymk(unsigned ik, unsigned lk) const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileCreatPropList::getSymk(unsigned& ik, unsigned& lk) const
+void
+FileCreatPropList::getSymk(unsigned &ik, unsigned &lk) const
{
herr_t ret_value = H5Pget_sym_k(id, &ik, &lk);
- if (ret_value < 0)
- {
- throw PropListIException("FileCreatPropList::getSymk",
- "H5Pget_sym_k failed");
+ if (ret_value < 0) {
+ throw PropListIException("FileCreatPropList::getSymk", "H5Pget_sym_k failed");
}
}
@@ -259,13 +254,12 @@ void FileCreatPropList::getSymk(unsigned& ik, unsigned& lk) const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileCreatPropList::setIstorek(unsigned ik) const
+void
+FileCreatPropList::setIstorek(unsigned ik) const
{
herr_t ret_value = H5Pset_istore_k(id, ik);
- if (ret_value < 0)
- {
- throw PropListIException("FileCreatPropList::setIstorek",
- "H5Pset_istore_k failed");
+ if (ret_value < 0) {
+ throw PropListIException("FileCreatPropList::setIstorek", "H5Pset_istore_k failed");
}
}
@@ -279,16 +273,15 @@ void FileCreatPropList::setIstorek(unsigned ik) const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-unsigned FileCreatPropList::getIstorek() const
+unsigned
+FileCreatPropList::getIstorek() const
{
unsigned ik;
- herr_t ret_value = H5Pget_istore_k(id, &ik);
- if (ret_value < 0)
- {
- throw PropListIException("FileCreatPropList::getIstorek",
- "H5Pget_istore_k failed");
+ herr_t ret_value = H5Pget_istore_k(id, &ik);
+ if (ret_value < 0) {
+ throw PropListIException("FileCreatPropList::getIstorek", "H5Pget_istore_k failed");
}
- return(ik);
+ return (ik);
}
//--------------------------------------------------------------------------
@@ -309,13 +302,14 @@ unsigned FileCreatPropList::getIstorek() const
/// API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - Feb, 2017
//--------------------------------------------------------------------------
-void FileCreatPropList::setFileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold) const
+void
+FileCreatPropList::setFileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist,
+ hsize_t threshold) const
{
herr_t ret_value = H5Pset_file_space_strategy(id, strategy, persist, threshold);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileCreatPropList::setFileSpaceStrategy",
- "H5Pset_file_space_strategy failed");
+ "H5Pset_file_space_strategy failed");
}
}
@@ -329,13 +323,14 @@ void FileCreatPropList::setFileSpaceStrategy(H5F_fspace_strategy_t strategy, hbo
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - Feb, 2017
//--------------------------------------------------------------------------
-void FileCreatPropList::getFileSpaceStrategy(H5F_fspace_strategy_t& strategy, hbool_t& persist, hsize_t& threshold) const
+void
+FileCreatPropList::getFileSpaceStrategy(H5F_fspace_strategy_t &strategy, hbool_t &persist,
+ hsize_t &threshold) const
{
herr_t ret_value = H5Pget_file_space_strategy(id, &strategy, &persist, &threshold);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileCreatPropList::getFileSpaceStrategy",
- "H5Pget_file_space_strategy failed");
+ "H5Pget_file_space_strategy failed");
}
}
@@ -346,13 +341,13 @@ void FileCreatPropList::getFileSpaceStrategy(H5F_fspace_strategy_t& strategy, hb
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - Feb, 2017
//--------------------------------------------------------------------------
-void FileCreatPropList::setFileSpacePagesize(hsize_t fsp_psize) const
+void
+FileCreatPropList::setFileSpacePagesize(hsize_t fsp_psize) const
{
herr_t ret_value = H5Pset_file_space_page_size(id, fsp_psize);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("FileCreatPropList::setFileSpacePagesize",
- "H5Pset_file_space_page_size failed");
+ "H5Pset_file_space_page_size failed");
}
}
@@ -364,16 +359,16 @@ void FileCreatPropList::setFileSpacePagesize(hsize_t fsp_psize) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - Feb, 2017
//--------------------------------------------------------------------------
-hsize_t FileCreatPropList::getFileSpacePagesize() const
+hsize_t
+FileCreatPropList::getFileSpacePagesize() const
{
hsize_t fsp_psize = 0;
- herr_t ret_value = H5Pget_file_space_page_size(id, &fsp_psize);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Pget_file_space_page_size(id, &fsp_psize);
+ if (ret_value < 0) {
throw PropListIException("FileCreatPropList::getFileSpacePagesize",
- "H5Pget_file_space_page_size failed");
+ "H5Pget_file_space_page_size failed");
}
- return(fsp_psize);
+ return (fsp_psize);
}
//--------------------------------------------------------------------------
@@ -383,4 +378,4 @@ hsize_t FileCreatPropList::getFileSpacePagesize() const
//--------------------------------------------------------------------------
FileCreatPropList::~FileCreatPropList() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h
index cc28920..d19b60d 100644
--- a/c++/src/H5FcreatProp.h
+++ b/c++/src/H5FcreatProp.h
@@ -23,82 +23,86 @@ namespace H5 {
*/
// Inheritance: PropList -> IdComponent
class H5_DLLCPP FileCreatPropList : public PropList {
- public:
- ///\brief Default file creation property list.
- static const FileCreatPropList& DEFAULT;
+ public:
+ ///\brief Default file creation property list.
+ static const FileCreatPropList &DEFAULT;
- // Creates a file create property list.
- FileCreatPropList();
+ // Creates a file create property list.
+ FileCreatPropList();
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Retrieves version information for various parts of a file.
- void getVersion(unsigned& super, unsigned& freelist, unsigned& stab, unsigned& shhdr) const;
+ // Retrieves version information for various parts of a file.
+ void getVersion(unsigned &super, unsigned &freelist, unsigned &stab, unsigned &shhdr) const;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- // Sets the userblock size field of a file creation property list.
- void setUserblock(hsize_t size) const;
+ // Sets the userblock size field of a file creation property list.
+ void setUserblock(hsize_t size) const;
- // Gets the size of a user block in this file creation property list.
- hsize_t getUserblock() const;
+ // Gets the size of a user block in this file creation property list.
+ hsize_t getUserblock() const;
- // Retrieves the size-of address and size quantities stored in a
- // file according to this file creation property list.
- void getSizes(size_t& sizeof_addr, size_t& sizeof_size) const;
+ // Retrieves the size-of address and size quantities stored in a
+ // file according to this file creation property list.
+ void getSizes(size_t &sizeof_addr, size_t &sizeof_size) const;
- // Sets file size-of addresses and sizes.
- void setSizes(size_t sizeof_addr = 4, size_t sizeof_size = 4) const;
+ // Sets file size-of addresses and sizes.
+ void setSizes(size_t sizeof_addr = 4, size_t sizeof_size = 4) const;
- // Retrieves the size of the symbol table B-tree 1/2 rank and the
- // symbol table leaf node 1/2 size.
- void getSymk(unsigned& int_nodes_k, unsigned& leaf_nodes_k) const;
+ // Retrieves the size of the symbol table B-tree 1/2 rank and the
+ // symbol table leaf node 1/2 size.
+ void getSymk(unsigned &int_nodes_k, unsigned &leaf_nodes_k) const;
- // Sets the size of parameters used to control the symbol table nodes.
- void setSymk(unsigned int_nodes_k, unsigned leaf_nodes_k) const;
+ // Sets the size of parameters used to control the symbol table nodes.
+ void setSymk(unsigned int_nodes_k, unsigned leaf_nodes_k) const;
- // Returns the 1/2 rank of an indexed storage B-tree.
- unsigned getIstorek() const;
+ // Returns the 1/2 rank of an indexed storage B-tree.
+ unsigned getIstorek() const;
- // Sets the size of parameter used to control the B-trees for
- // indexing chunked datasets.
- void setIstorek(unsigned ik) const;
+ // Sets the size of parameter used to control the B-trees for
+ // indexing chunked datasets.
+ void setIstorek(unsigned ik) const;
- // Sets the strategy and the threshold value that the library will
- // will employ in managing file space.
- void setFileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold) const;
+ // Sets the strategy and the threshold value that the library will
+ // will employ in managing file space.
+ void setFileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold) const;
- // Returns the strategy that the library uses in managing file space.
- void getFileSpaceStrategy(H5F_fspace_strategy_t& strategy, hbool_t& persist, hsize_t& threshold) const;
+ // Returns the strategy that the library uses in managing file space.
+ void getFileSpaceStrategy(H5F_fspace_strategy_t &strategy, hbool_t &persist, hsize_t &threshold) const;
- // Sets the file space page size for paged aggregation.
- void setFileSpacePagesize(hsize_t fsp_psize) const;
+ // Sets the file space page size for paged aggregation.
+ void setFileSpacePagesize(hsize_t fsp_psize) const;
- // Returns the threshold value that the library uses in tracking free
- // space sections.
- hsize_t getFileSpacePagesize() const;
+ // Returns the threshold value that the library uses in tracking free
+ // space sections.
+ hsize_t getFileSpacePagesize() const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass() const { return("FileCreatPropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("FileCreatPropList");
+ }
- // Copy constructor: same as the original FileCreatPropList.
- FileCreatPropList(const FileCreatPropList& orig);
+ // Copy constructor: same as the original FileCreatPropList.
+ FileCreatPropList(const FileCreatPropList &orig);
- // Creates a copy of an existing file create property list
- // using the property list id.
- FileCreatPropList(const hid_t plist_id);
+ // Creates a copy of an existing file create property list
+ // using the property list id.
+ FileCreatPropList(const hid_t plist_id);
- // Noop destructor
- virtual ~FileCreatPropList();
+ // Noop destructor
+ virtual ~FileCreatPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the global constant, should only be used by the library
- static void deleteConstants();
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
- private:
- static FileCreatPropList* DEFAULT_;
+ private:
+ static FileCreatPropList *DEFAULT_;
- // Creates the global constant, should only be used by the library
- static FileCreatPropList* getConstant();
+ // Creates the global constant, should only be used by the library
+ static FileCreatPropList *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index b9ecded..2ed3508 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -41,8 +41,8 @@
#include "H5Alltypes.h"
namespace H5 {
- using std::cerr;
- using std::endl;
+using std::cerr;
+using std::endl;
//--------------------------------------------------------------------------
// Function H5File default constructor
@@ -81,11 +81,14 @@ H5File::H5File() : Group(), id(H5I_INVALID_HID) {}
// block here to catch then re-throw it. -BMR 2013/03/21
// December 2000
//--------------------------------------------------------------------------
-H5File::H5File(const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist) : Group(), id(H5I_INVALID_HID)
+H5File::H5File(const char *name, unsigned int flags, const FileCreatPropList &create_plist,
+ const FileAccPropList &access_plist)
+ : Group(), id(H5I_INVALID_HID)
{
try {
p_get_file(name, flags, create_plist, access_plist);
- } catch (FileIException& open_file) {
+ }
+ catch (FileIException &open_file) {
throw open_file;
}
}
@@ -106,11 +109,14 @@ H5File::H5File(const char* name, unsigned int flags, const FileCreatPropList& cr
// block here to catch then re-throw it. -BMR 2013/03/21
// December 2000
//--------------------------------------------------------------------------
-H5File::H5File(const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist) : Group(), id(H5I_INVALID_HID)
+H5File::H5File(const H5std_string &name, unsigned int flags, const FileCreatPropList &create_plist,
+ const FileAccPropList &access_plist)
+ : Group(), id(H5I_INVALID_HID)
{
try {
p_get_file(name.c_str(), flags, create_plist, access_plist);
- } catch (FileIException& open_file) {
+ }
+ catch (FileIException &open_file) {
throw open_file;
}
}
@@ -123,26 +129,26 @@ H5File::H5File(const H5std_string& name, unsigned int flags, const FileCreatProp
// - removed H5F_ACC_CREAT because H5Fcreate will fail with
// H5F_ACC_CREAT. - BMR, Sep 17, 2014
//--------------------------------------------------------------------------
-void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist)
+void
+H5File::p_get_file(const char *name, unsigned int flags, const FileCreatPropList &create_plist,
+ const FileAccPropList &access_plist)
{
// These bits only set for creation, so if any of them are set,
// create the file.
- if (flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC))
- {
+ if (flags & (H5F_ACC_EXCL | H5F_ACC_TRUNC)) {
hid_t create_plist_id = create_plist.getId();
hid_t access_plist_id = access_plist.getId();
- id = H5Fcreate(name, flags, create_plist_id, access_plist_id);
- if (id < 0) // throw an exception when open/create fail
+ id = H5Fcreate(name, flags, create_plist_id, access_plist_id);
+ if (id < 0) // throw an exception when open/create fail
{
throw FileIException("H5File constructor", "H5Fcreate failed");
}
}
// Open the file if none of the bits above are set.
- else
- {
+ else {
hid_t access_plist_id = access_plist.getId();
- id = H5Fopen(name, flags, access_plist_id);
- if (id < 0) // throw an exception when open/create fail
+ id = H5Fopen(name, flags, access_plist_id);
+ if (id < 0) // throw an exception when open/create fail
{
throw FileIException("H5File constructor", "H5Fopen failed");
}
@@ -176,7 +182,7 @@ H5File::H5File(hid_t existing_id) : Group()
///\param original - IN: H5File instance to copy
// December 2000
//--------------------------------------------------------------------------
-H5File::H5File(const H5File& original) : Group()
+H5File::H5File(const H5File &original) : Group()
{
id = original.getId();
incRefCount(); // increment number of references to this id
@@ -190,7 +196,8 @@ H5File::H5File(const H5File& original) : Group()
///\exception H5::FileIException
// December 2000
//--------------------------------------------------------------------------
-bool H5File::isHdf5(const char* name)
+bool
+H5File::isHdf5(const char *name)
{
// Calls C routine H5Fis_accessible to determine whether the file is in
// HDF5 format. It returns positive value, 0, or negative value
@@ -213,9 +220,10 @@ bool H5File::isHdf5(const char* name)
///\param name - IN: Name of the file - \c H5std_string
// December 2000
//--------------------------------------------------------------------------
-bool H5File::isHdf5(const H5std_string& name)
+bool
+H5File::isHdf5(const H5std_string &name)
{
- return(isHdf5( name.c_str()));
+ return (isHdf5(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -228,12 +236,13 @@ bool H5File::isHdf5(const H5std_string& name)
///\exception H5::FileIException
// September 2018
//--------------------------------------------------------------------------
-bool H5File::isAccessible(const char* name, const FileAccPropList& access_plist)
+bool
+H5File::isAccessible(const char *name, const FileAccPropList &access_plist)
{
// Calls C routine H5Fis_accessible to determine whether the file is in
// HDF5 format. It returns positive value, 0, or negative value
- hid_t access_plist_id = access_plist.getId();
- htri_t ret_value = H5Fis_accessible(name, access_plist_id);
+ hid_t access_plist_id = access_plist.getId();
+ htri_t ret_value = H5Fis_accessible(name, access_plist_id);
if (ret_value > 0)
return true;
else if (ret_value == 0)
@@ -253,9 +262,10 @@ bool H5File::isAccessible(const char* name, const FileAccPropList& access_plist)
/// FileAccPropList::DEFAULT
// September 2018
//--------------------------------------------------------------------------
-bool H5File::isAccessible(const H5std_string& name, const FileAccPropList& access_plist)
+bool
+H5File::isAccessible(const H5std_string &name, const FileAccPropList &access_plist)
{
- return(isAccessible(name.c_str(), access_plist));
+ return (isAccessible(name.c_str(), access_plist));
}
//--------------------------------------------------------------------------
@@ -276,18 +286,19 @@ bool H5File::isAccessible(const H5std_string& name, const FileAccPropList& acces
///
// October 2005
//--------------------------------------------------------------------------
-void H5File::openFile(const char* name, unsigned int flags, const FileAccPropList& access_plist)
+void
+H5File::openFile(const char *name, unsigned int flags, const FileAccPropList &access_plist)
{
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw FileIException("H5File::openFile", close_error.getDetailMsg());
}
hid_t access_plist_id = access_plist.getId();
- id = H5Fopen (name, flags, access_plist_id);
- if (id < 0) // throw an exception when open fails
+ id = H5Fopen(name, flags, access_plist_id);
+ if (id < 0) // throw an exception when open fails
{
throw FileIException("H5File::openFile", "H5Fopen failed");
}
@@ -303,7 +314,8 @@ void H5File::openFile(const char* name, unsigned int flags, const FileAccPropLis
/// FileAccPropList::DEFAULT
// December 2000
//--------------------------------------------------------------------------
-void H5File::openFile(const H5std_string& name, unsigned int flags, const FileAccPropList& access_plist)
+void
+H5File::openFile(const H5std_string &name, unsigned int flags, const FileAccPropList &access_plist)
{
openFile(name.c_str(), flags, access_plist);
}
@@ -324,12 +336,13 @@ void H5File::openFile(const H5std_string& name, unsigned int flags, const FileAc
// - Replaced decRefCount with close() to let the C library
// handle the reference counting - BMR, Jun 1, 2006
//--------------------------------------------------------------------------
-void H5File::reOpen()
+void
+H5File::reOpen()
{
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw FileIException("H5File::reOpen", close_error.getDetailMsg());
}
@@ -347,19 +360,18 @@ void H5File::reOpen()
///\exception H5::FileIException
// December 2000
//--------------------------------------------------------------------------
-FileCreatPropList H5File::getCreatePlist() const
+FileCreatPropList
+H5File::getCreatePlist() const
{
hid_t create_plist_id = H5Fget_create_plist(id);
// if H5Fget_create_plist returns a valid id, create and return
// the FileCreatPropList object for this property list
- if (create_plist_id > 0)
- {
- FileCreatPropList create_plist(create_plist_id);
- return(create_plist);
+ if (create_plist_id > 0) {
+ FileCreatPropList create_plist(create_plist_id);
+ return (create_plist);
}
- else
- {
+ else {
throw FileIException("H5File::getCreatePlist", "H5Fget_create_plist failed");
}
}
@@ -371,16 +383,16 @@ FileCreatPropList H5File::getCreatePlist() const
///\exception H5::FileIException
// December 2000
//--------------------------------------------------------------------------
-FileAccPropList H5File::getAccessPlist() const
+FileAccPropList
+H5File::getAccessPlist() const
{
hid_t access_plist_id = H5Fget_access_plist(id);
// if H5Fget_access_plist returns a valid id, create and return
// the FileAccPropList object for this property list
- if (access_plist_id > 0)
- {
- FileAccPropList access_plist(access_plist_id);
- return access_plist;
+ if (access_plist_id > 0) {
+ FileAccPropList access_plist(access_plist_id);
+ return access_plist;
}
else // Raise an exception
{
@@ -398,11 +410,11 @@ FileAccPropList H5File::getAccessPlist() const
/// superblock extension, free space management, and shared object
// February 2017
//--------------------------------------------------------------------------
-void H5File::getFileInfo(H5F_info2_t& file_info) const
+void
+H5File::getFileInfo(H5F_info2_t &file_info) const
{
herr_t ret_value = H5Fget_info2(id, &file_info);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw FileIException("H5File::getFileInfo", "H5Fget_info2 failed");
}
}
@@ -414,17 +426,16 @@ void H5File::getFileInfo(H5F_info2_t& file_info) const
///\exception H5::FileIException
// May 2004
//--------------------------------------------------------------------------
-hssize_t H5File::getFreeSpace() const
+hssize_t
+H5File::getFreeSpace() const
{
hssize_t free_space = H5Fget_freespace(id);
- if (free_space < 0)
- {
+ if (free_space < 0) {
throw FileIException("H5File::getFreeSpace", "H5Fget_freespace failed");
}
return (free_space);
}
-
//--------------------------------------------------------------------------
// Function: H5File::getObjCount
///\brief Returns the number of opened object IDs (files, datasets,
@@ -446,11 +457,11 @@ hssize_t H5File::getFreeSpace() const
/// Multiple object types can be combined with the logical OR operator (|).
// May 2004
//--------------------------------------------------------------------------
-ssize_t H5File::getObjCount(unsigned types) const
+ssize_t
+H5File::getObjCount(unsigned types) const
{
ssize_t num_objs = H5Fget_obj_count(id, types);
- if (num_objs < 0)
- {
+ if (num_objs < 0) {
throw FileIException("H5File::getObjCount", "H5Fget_obj_count failed");
}
return (num_objs);
@@ -481,11 +492,11 @@ ssize_t H5File::getObjCount(unsigned types) const
// Notes: will do the overload for this one after hearing from Quincey???
// May 2004
//--------------------------------------------------------------------------
-void H5File::getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const
+void
+H5File::getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const
{
ssize_t ret_value = H5Fget_obj_ids(id, types, max_objs, oid_list);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw FileIException("H5File::getObjIDs", "H5Fget_obj_ids failed");
}
}
@@ -509,12 +520,12 @@ void H5File::getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const
/// closed and reopened or opened during a subsequent session.
// May 2004
//--------------------------------------------------------------------------
-void H5File::getVFDHandle(const FileAccPropList& fapl, void **file_handle) const
+void
+H5File::getVFDHandle(const FileAccPropList &fapl, void **file_handle) const
{
- hid_t fapl_id = fapl.getId();
+ hid_t fapl_id = fapl.getId();
herr_t ret_value = H5Fget_vfd_handle(id, fapl_id, file_handle);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw FileIException("H5File::getVFDHandle", "H5Fget_vfd_handle failed");
}
}
@@ -534,7 +545,7 @@ void H5File::getVFDHandle(const FileAccPropList& fapl, void **file_handle) const
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-//void H5File::getVFDHandle(FileAccPropList& fapl, void **file_handle) const
+// void H5File::getVFDHandle(FileAccPropList& fapl, void **file_handle) const
//{
// getVFDHandle((const FileAccPropList)fapl, file_handle);
//}
@@ -549,11 +560,11 @@ void H5File::getVFDHandle(const FileAccPropList& fapl, void **file_handle) const
///\exception H5::FileIException
// May 2004
//--------------------------------------------------------------------------
-void H5File::getVFDHandle(void **file_handle) const
+void
+H5File::getVFDHandle(void **file_handle) const
{
herr_t ret_value = H5Fget_vfd_handle(id, H5P_DEFAULT, file_handle);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw FileIException("H5File::getVFDHandle", "H5Fget_vfd_handle failed");
}
}
@@ -568,12 +579,12 @@ void H5File::getVFDHandle(void **file_handle) const
/// order to learn the true size of the underlying file.
// Programmer Raymond Lu - June 24, 2004
//--------------------------------------------------------------------------
-hsize_t H5File::getFileSize() const
+hsize_t
+H5File::getFileSize() const
{
hsize_t file_size;
- herr_t ret_value = H5Fget_filesize(id, &file_size);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Fget_filesize(id, &file_size);
+ if (ret_value < 0) {
throw FileIException("H5File::getFileSize", "H5Fget_filesize failed");
}
return (file_size);
@@ -589,12 +600,12 @@ hsize_t H5File::getFileSize() const
/// order to retrieve the unique 'file number' for the file.
// Programmer Quincey Koziol - April 13, 2019
//--------------------------------------------------------------------------
-unsigned long H5File::getFileNum() const
+unsigned long
+H5File::getFileNum() const
{
- unsigned long fileno = 0;
- herr_t ret_value = H5Fget_fileno(id, &fileno);
- if (ret_value < 0)
- {
+ unsigned long fileno = 0;
+ herr_t ret_value = H5Fget_fileno(id, &fileno);
+ if (ret_value < 0) {
throw FileIException("H5File::getFileNum", "H5Fget_fileno failed");
}
return (fileno);
@@ -612,9 +623,10 @@ unsigned long H5File::getFileNum() const
// IdComponent::getId now becomes pure virtual function.
// May, 2008
//--------------------------------------------------------------------------
-hid_t H5File::getId() const
+hid_t
+H5File::getId() const
{
- return(id);
+ return (id);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -626,7 +638,8 @@ hid_t H5File::getId() const
// This function is replaced by the above function reOpen.
// December 2000
//--------------------------------------------------------------------------
-void H5File::reopen()
+void
+H5File::reopen()
{
H5File::reOpen();
}
@@ -643,9 +656,10 @@ void H5File::reopen()
// After HDFFV-9920, the Group's methods can use getId() and
// getLocId() is kept for backward compatibility.
//--------------------------------------------------------------------------
-hid_t H5File::getLocId() const
+hid_t
+H5File::getLocId() const
{
- return(getId());
+ return (getId());
}
//--------------------------------------------------------------------------
@@ -660,13 +674,14 @@ hid_t H5File::getLocId() const
// Then the object's id is reset to the new id.
// December 2000
//--------------------------------------------------------------------------
-void H5File::p_setId(const hid_t new_id)
+void
+H5File::p_setId(const hid_t new_id)
{
// handling references to this old id
try {
close();
}
- catch (Exception& E) {
+ catch (Exception &E) {
throw FileIException("H5File::p_setId", E.getDetailMsg());
}
// reset object's id to the given id
@@ -681,13 +696,12 @@ void H5File::p_setId(const hid_t new_id)
///\exception H5::FileIException
// March 2005
//--------------------------------------------------------------------------
-void H5File::close()
+void
+H5File::close()
{
- if (p_valid_id(id))
- {
+ if (p_valid_id(id)) {
herr_t ret_value = H5Fclose(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw FileIException("H5File::close", "H5Fclose failed");
}
// reset the id
@@ -708,7 +722,8 @@ void H5File::close()
// an implementation of H5File.
// December 2000
//--------------------------------------------------------------------------
-void H5File::throwException(const H5std_string& func_name, const H5std_string& msg) const
+void
+H5File::throwException(const H5std_string &func_name, const H5std_string &msg) const
{
H5std_string full_name = func_name;
full_name.insert(0, "H5File::");
@@ -729,9 +744,10 @@ H5File::~H5File()
{
try {
close();
- } catch (Exception& close_error) {
+ }
+ catch (Exception &close_error) {
cerr << "H5File::~H5File - " << close_error.getDetailMsg() << endl;
}
}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5File.h b/c++/src/H5File.h
index 1b1227f..9231d5f 100644
--- a/c++/src/H5File.h
+++ b/c++/src/H5File.h
@@ -23,111 +23,117 @@ namespace H5 {
*/
// Inheritance: Group -> CommonFG/H5Object -> H5Location -> IdComponent
class H5_DLLCPP H5File : public Group {
- public:
- // Creates or opens an HDF5 file.
- H5File(const char* name, unsigned int flags,
- const FileCreatPropList& create_plist = FileCreatPropList::DEFAULT,
- const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
- H5File(const H5std_string& name, unsigned int flags,
- const FileCreatPropList& create_plist = FileCreatPropList::DEFAULT,
- const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
+ public:
+ // Creates or opens an HDF5 file.
+ H5File(const char *name, unsigned int flags,
+ const FileCreatPropList &create_plist = FileCreatPropList::DEFAULT,
+ const FileAccPropList & access_plist = FileAccPropList::DEFAULT);
+ H5File(const H5std_string &name, unsigned int flags,
+ const FileCreatPropList &create_plist = FileCreatPropList::DEFAULT,
+ const FileAccPropList & access_plist = FileAccPropList::DEFAULT);
- // Open the file
- void openFile(const H5std_string& name, unsigned int flags,
- const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
- void openFile(const char* name, unsigned int flags,
- const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
+ // Open the file
+ void openFile(const H5std_string &name, unsigned int flags,
+ const FileAccPropList &access_plist = FileAccPropList::DEFAULT);
+ void openFile(const char *name, unsigned int flags,
+ const FileAccPropList &access_plist = FileAccPropList::DEFAULT);
- // Close this file.
- virtual void close();
+ // Close this file.
+ virtual void close();
- // Gets a copy of the access property list of this file.
- FileAccPropList getAccessPlist() const;
+ // Gets a copy of the access property list of this file.
+ FileAccPropList getAccessPlist() const;
- // Gets a copy of the creation property list of this file.
- FileCreatPropList getCreatePlist() const;
+ // Gets a copy of the creation property list of this file.
+ FileCreatPropList getCreatePlist() const;
- // Gets general information about this file.
- void getFileInfo(H5F_info2_t& file_info) const;
+ // Gets general information about this file.
+ void getFileInfo(H5F_info2_t &file_info) const;
- // Returns the amount of free space in the file.
- hssize_t getFreeSpace() const;
+ // Returns the amount of free space in the file.
+ hssize_t getFreeSpace() const;
- // Returns the number of opened object IDs (files, datasets, groups
- // and datatypes) in the same file.
- ssize_t getObjCount(unsigned types = H5F_OBJ_ALL) const;
+ // Returns the number of opened object IDs (files, datasets, groups
+ // and datatypes) in the same file.
+ ssize_t getObjCount(unsigned types = H5F_OBJ_ALL) const;
- // Retrieves a list of opened object IDs (files, datasets, groups
- // and datatypes) in the same file.
- void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const;
+ // Retrieves a list of opened object IDs (files, datasets, groups
+ // and datatypes) in the same file.
+ void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const;
- // Returns the pointer to the file handle of the low-level file driver.
- void getVFDHandle(void **file_handle) const;
- void getVFDHandle(const FileAccPropList& fapl, void **file_handle) const;
- //void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; // removed from 1.8.18 and 1.10.1
+ // Returns the pointer to the file handle of the low-level file driver.
+ void getVFDHandle(void **file_handle) const;
+ void getVFDHandle(const FileAccPropList &fapl, void **file_handle) const;
+ // void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; // removed from 1.8.18 and 1.10.1
- // Returns the file size of the HDF5 file.
- hsize_t getFileSize() const;
+ // Returns the file size of the HDF5 file.
+ hsize_t getFileSize() const;
- // Returns the 'file number' of the HDF5 file.
- unsigned long getFileNum() const;
+ // Returns the 'file number' of the HDF5 file.
+ unsigned long getFileNum() const;
- // Determines if a file, specified by its name, is in HDF5 format
- static bool isHdf5(const char* name);
- static bool isHdf5(const H5std_string& name);
+ // Determines if a file, specified by its name, is in HDF5 format
+ static bool isHdf5(const char *name);
+ static bool isHdf5(const H5std_string &name);
- // Determines if a file, specified by its name, can be accessed as HDF5
- static bool isAccessible(const char* name, const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
- static bool isAccessible(const H5std_string& name, const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
+ // Determines if a file, specified by its name, can be accessed as HDF5
+ static bool isAccessible(const char * name,
+ const FileAccPropList &access_plist = FileAccPropList::DEFAULT);
+ static bool isAccessible(const H5std_string & name,
+ const FileAccPropList &access_plist = FileAccPropList::DEFAULT);
- // Reopens this file.
- void reOpen(); // added for better name
+ // Reopens this file.
+ void reOpen(); // added for better name
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- void reopen(); // obsolete in favor of reOpen()
+ void reopen(); // obsolete in favor of reOpen()
- // Creates an H5File using an existing file id. Not recommended
- // in applications.
- H5File(hid_t existing_id);
+ // Creates an H5File using an existing file id. Not recommended
+ // in applications.
+ H5File(hid_t existing_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("H5File"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("H5File");
+ }
- // Throw file exception.
- virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
+ // Throw file exception.
+ virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const;
- // For CommonFG to get the file id.
- virtual hid_t getLocId() const;
+ // For CommonFG to get the file id.
+ virtual hid_t getLocId() const;
- // Default constructor
- H5File();
+ // Default constructor
+ H5File();
- // Copy constructor: same as the original H5File.
- H5File(const H5File& original);
+ // Copy constructor: same as the original H5File.
+ H5File(const H5File &original);
- // Gets the HDF5 file id.
- virtual hid_t getId() const;
+ // Gets the HDF5 file id.
+ virtual hid_t getId() const;
- // H5File destructor.
- virtual ~H5File();
+ // H5File destructor.
+ virtual ~H5File();
- protected:
+ protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Sets the HDF5 file id.
- virtual void p_setId(const hid_t new_id);
+ // Sets the HDF5 file id.
+ virtual void p_setId(const hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
- private:
- hid_t id; // HDF5 file id
+ private:
+ hid_t id; // HDF5 file id
- // This function is private and contains common code between the
- // constructors taking a string or a char*
- void p_get_file(const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist);
+ // This function is private and contains common code between the
+ // constructors taking a string or a char*
+ void p_get_file(const char *name, unsigned int flags, const FileCreatPropList &create_plist,
+ const FileAccPropList &access_plist);
}; // end of H5File
} // namespace H5
#endif // __H5File_H
-
diff --git a/c++/src/H5FloatType.cpp b/c++/src/H5FloatType.cpp
index aba826e..7979cfa 100644
--- a/c++/src/H5FloatType.cpp
+++ b/c++/src/H5FloatType.cpp
@@ -49,7 +49,7 @@ FloatType::FloatType() {}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType::FloatType(const PredType& pred_type) : AtomType()
+FloatType::FloatType(const PredType &pred_type) : AtomType()
{
// use DataType::copy to make a copy of this predefined type
copy(pred_type);
@@ -63,14 +63,14 @@ FloatType::FloatType(const PredType& pred_type) : AtomType()
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType::FloatType(const hid_t existing_id) : AtomType( existing_id ) {}
+FloatType::FloatType(const hid_t existing_id) : AtomType(existing_id) {}
//--------------------------------------------------------------------------
// Function: FloatType copy constructor
///\brief Copy constructor: same HDF5 object as \a original
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType::FloatType(const FloatType& original) : AtomType( original ){}
+FloatType::FloatType(const FloatType &original) : AtomType(original) {}
//--------------------------------------------------------------------------
// Function: FloatType overloaded constructor
@@ -80,13 +80,12 @@ FloatType::FloatType(const FloatType& original) : AtomType( original ){}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType::FloatType(const DataSet& dataset) : AtomType()
+FloatType::FloatType(const DataSet &dataset) : AtomType()
{
// Calls C function H5Dget_type to get the id of the datatype
id = H5Dget_type(dataset.getId());
- if (id < 0)
- {
+ if (id < 0) {
throw DataSetIException("FloatType constructor", "H5Dget_type failed");
}
}
@@ -105,7 +104,7 @@ FloatType::FloatType(const DataSet& dataset) : AtomType()
// to improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-FloatType::FloatType(const H5Location& loc, const char *dtype_name) : AtomType()
+FloatType::FloatType(const H5Location &loc, const char *dtype_name) : AtomType()
{
id = p_opentype(loc, dtype_name);
}
@@ -124,7 +123,7 @@ FloatType::FloatType(const H5Location& loc, const char *dtype_name) : AtomType()
// to improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-FloatType::FloatType(const H5Location& loc, const H5std_string& dtype_name) : AtomType()
+FloatType::FloatType(const H5Location &loc, const H5std_string &dtype_name) : AtomType()
{
id = p_opentype(loc, dtype_name.c_str());
}
@@ -137,7 +136,8 @@ FloatType::FloatType(const H5Location& loc, const H5std_string& dtype_name) : At
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-DataType* FloatType::decode() const
+DataType *
+FloatType::decode() const
{
hid_t encoded_flttype_id = H5I_INVALID_HID;
try {
@@ -148,7 +148,7 @@ DataType* FloatType::decode() const
}
FloatType *encoded_flttype = new FloatType;
encoded_flttype->p_setId(encoded_flttype_id);
- return(encoded_flttype);
+ return (encoded_flttype);
}
//--------------------------------------------------------------------------
@@ -162,11 +162,11 @@ DataType* FloatType::decode() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FloatType::getFields(size_t& spos, size_t& epos, size_t& esize, size_t& mpos, size_t& msize) const
+void
+FloatType::getFields(size_t &spos, size_t &epos, size_t &esize, size_t &mpos, size_t &msize) const
{
herr_t ret_value = H5Tget_fields(id, &spos, &epos, &esize, &mpos, &msize);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("FloatType::getFields", "H5Tget_fields failed");
}
}
@@ -183,11 +183,11 @@ void FloatType::getFields(size_t& spos, size_t& epos, size_t& esize, size_t& mpo
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FloatType::setFields(size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize) const
+void
+FloatType::setFields(size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize) const
{
herr_t ret_value = H5Tset_fields(id, spos, epos, esize, mpos, msize);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("FloatType::setFields", "H5Tset_fields failed");
}
}
@@ -199,15 +199,15 @@ void FloatType::setFields(size_t spos, size_t epos, size_t esize, size_t mpos, s
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-size_t FloatType::getEbias() const
+size_t
+FloatType::getEbias() const
{
size_t ebias = H5Tget_ebias(id);
// Returns the bias if successful
- if (ebias == 0)
- {
+ if (ebias == 0) {
throw DataTypeIException("FloatType::getEbias", "H5Tget_ebias failed - returned exponent bias as 0");
}
- return(ebias);
+ return (ebias);
}
//--------------------------------------------------------------------------
@@ -217,11 +217,11 @@ size_t FloatType::getEbias() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FloatType::setEbias(size_t ebias) const
+void
+FloatType::setEbias(size_t ebias) const
{
herr_t ret_value = H5Tset_ebias(id, ebias);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("FloatType::setEbias", "H5Tset_ebias failed");
}
}
@@ -241,12 +241,12 @@ void FloatType::setEbias(size_t ebias) const
/// \a norm_string.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5T_norm_t FloatType::getNorm(H5std_string& norm_string) const
+H5T_norm_t
+FloatType::getNorm(H5std_string &norm_string) const
{
- H5T_norm_t norm = H5Tget_norm(id); // C routine
+ H5T_norm_t norm = H5Tget_norm(id); // C routine
// Returns a valid normalization type if successful
- if (norm == H5T_NORM_ERROR)
- {
+ if (norm == H5T_NORM_ERROR) {
throw DataTypeIException("FloatType::getNorm", "H5Tget_norm failed - returned H5T_NORM_ERROR");
}
if (norm == H5T_NORM_IMPLIED)
@@ -255,7 +255,7 @@ H5T_norm_t FloatType::getNorm(H5std_string& norm_string) const
norm_string = "H5T_NORM_MSBSET (1)";
else if (norm == H5T_NORM_NONE)
norm_string = "H5T_NORM_NONE (2)";
- return(norm);
+ return (norm);
}
//--------------------------------------------------------------------------
@@ -270,11 +270,11 @@ H5T_norm_t FloatType::getNorm(H5std_string& norm_string) const
/// \li \c H5T_NORM_NONE (2) - Mantissa is not normalized
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FloatType::setNorm(H5T_norm_t norm) const
+void
+FloatType::setNorm(H5T_norm_t norm) const
{
herr_t ret_value = H5Tset_norm(id, norm);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("FloatType::setNorm", "H5Tset_norm failed");
}
}
@@ -294,12 +294,12 @@ void FloatType::setNorm(H5T_norm_t norm) const
/// \a pad_string.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5T_pad_t FloatType::getInpad(H5std_string& pad_string) const
+H5T_pad_t
+FloatType::getInpad(H5std_string &pad_string) const
{
H5T_pad_t pad_type = H5Tget_inpad(id);
// Returns a valid padding type if successful
- if (pad_type == H5T_PAD_ERROR)
- {
+ if (pad_type == H5T_PAD_ERROR) {
throw DataTypeIException("FloatType::getInpad", "H5Tget_inpad failed - returned H5T_PAD_ERROR");
}
if (pad_type == H5T_PAD_ZERO)
@@ -308,7 +308,7 @@ H5T_pad_t FloatType::getInpad(H5std_string& pad_string) const
pad_string = "H5T_PAD_ONE (1)";
else if (pad_type == H5T_PAD_BACKGROUND)
pad_string = "H5T_PAD_BACKGROUD (2)";
- return(pad_type);
+ return (pad_type);
}
//--------------------------------------------------------------------------
@@ -328,11 +328,11 @@ H5T_pad_t FloatType::getInpad(H5std_string& pad_string) const
/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FloatType::setInpad(H5T_pad_t inpad) const
+void
+FloatType::setInpad(H5T_pad_t inpad) const
{
herr_t ret_value = H5Tset_inpad(id, inpad);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("FloatType::setInpad", "H5Tset_inpad failed");
}
}
@@ -344,4 +344,4 @@ void FloatType::setInpad(H5T_pad_t inpad) const
//--------------------------------------------------------------------------
FloatType::~FloatType() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h
index f74a9ae..2368113 100644
--- a/c++/src/H5FloatType.h
+++ b/c++/src/H5FloatType.h
@@ -23,59 +23,63 @@ namespace H5 {
*/
// Inheritance: AtomType -> DataType -> H5Object -> H5Location -> IdComponent
class H5_DLLCPP FloatType : public AtomType {
- public:
- // Creates a floating-point type using a predefined type.
- FloatType(const PredType& pred_type);
+ public:
+ // Creates a floating-point type using a predefined type.
+ FloatType(const PredType &pred_type);
- // Gets the floating-point datatype of the specified dataset.
- FloatType(const DataSet& dataset);
+ // Gets the floating-point datatype of the specified dataset.
+ FloatType(const DataSet &dataset);
- // Constructors that open an HDF5 float datatype, given a location.
- FloatType(const H5Location& loc, const char* name);
- FloatType(const H5Location& loc, const H5std_string& name);
+ // Constructors that open an HDF5 float datatype, given a location.
+ FloatType(const H5Location &loc, const char *name);
+ FloatType(const H5Location &loc, const H5std_string &name);
- // Returns an FloatType object via DataType* by decoding the
- // binary object description of this type.
- virtual DataType* decode() const;
+ // Returns an FloatType object via DataType* by decoding the
+ // binary object description of this type.
+ virtual DataType *decode() const;
- // Retrieves the exponent bias of a floating-point type.
- size_t getEbias() const;
+ // Retrieves the exponent bias of a floating-point type.
+ size_t getEbias() const;
- // Sets the exponent bias of a floating-point type.
- void setEbias(size_t ebias) const;
+ // Sets the exponent bias of a floating-point type.
+ void setEbias(size_t ebias) const;
- // Retrieves floating point datatype bit field information.
- void getFields(size_t& spos, size_t& epos, size_t& esize, size_t& mpos, size_t& msize) const;
+ // Retrieves floating point datatype bit field information.
+ void getFields(size_t &spos, size_t &epos, size_t &esize, size_t &mpos, size_t &msize) const;
- // Sets locations and sizes of floating point bit fields.
- void setFields(size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize) const;
+ // Sets locations and sizes of floating point bit fields.
+ void setFields(size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize) const;
- // Retrieves the internal padding type for unused bits in floating-point datatypes.
- H5T_pad_t getInpad(H5std_string& pad_string) const;
+ // Retrieves the internal padding type for unused bits in floating-point datatypes.
+ H5T_pad_t getInpad(H5std_string &pad_string) const;
- // Fills unused internal floating point bits.
- void setInpad(H5T_pad_t inpad) const;
+ // Fills unused internal floating point bits.
+ void setInpad(H5T_pad_t inpad) const;
- // Retrieves mantissa normalization of a floating-point datatype.
- H5T_norm_t getNorm(H5std_string& norm_string) const;
+ // Retrieves mantissa normalization of a floating-point datatype.
+ H5T_norm_t getNorm(H5std_string &norm_string) const;
- // Sets the mantissa normalization of a floating-point datatype.
- void setNorm(H5T_norm_t norm) const;
+ // Sets the mantissa normalization of a floating-point datatype.
+ void setNorm(H5T_norm_t norm) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("FloatType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("FloatType");
+ }
- // Default constructor
- FloatType();
+ // Default constructor
+ FloatType();
- // Creates a floating-point datatype using an existing id.
- FloatType(const hid_t existing_id);
+ // Creates a floating-point datatype using an existing id.
+ FloatType(const hid_t existing_id);
- // Copy constructor: same as the original FloatType.
- FloatType(const FloatType& original);
+ // Copy constructor: same as the original FloatType.
+ FloatType(const FloatType &original);
- // Noop destructor.
- virtual ~FloatType();
+ // Noop destructor.
+ virtual ~FloatType();
}; // end of FloatType
} // namespace H5
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp
index 7132bdf..a1f7dcd 100644
--- a/c++/src/H5Group.cpp
+++ b/c++/src/H5Group.cpp
@@ -42,8 +42,8 @@
#include "H5Alltypes.h"
namespace H5 {
- using std::cerr;
- using std::endl;
+using std::cerr;
+using std::endl;
//--------------------------------------------------------------------------
// Function: Group default constructor
@@ -58,7 +58,7 @@ Group::Group() : H5Object(), CommonFG(), id(H5I_INVALID_HID) {}
///\param original - IN: Original group to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group::Group(const Group& original) : H5Object(), CommonFG(), id(original.id)
+Group::Group(const Group &original) : H5Object(), CommonFG(), id(original.id)
{
incRefCount(); // increment number of references to this id
}
@@ -70,11 +70,11 @@ Group::Group(const Group& original) : H5Object(), CommonFG(), id(original.id)
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - March, 2017
//--------------------------------------------------------------------------
-void Group::closeObjId(hid_t obj_id) const
+void
+Group::closeObjId(hid_t obj_id) const
{
herr_t ret_value = H5Oclose(obj_id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throwException("Group::closeObjId", "H5Oclose failed");
}
}
@@ -91,9 +91,10 @@ void Group::closeObjId(hid_t obj_id) const
// After HDFFV-9920, the Group's methods can use getId() and
// getLocId() is kept for backward compatibility.
//--------------------------------------------------------------------------
-hid_t Group::getLocId() const
+hid_t
+Group::getLocId() const
{
- return(getId());
+ return (getId());
}
//--------------------------------------------------------------------------
@@ -120,7 +121,8 @@ Group::Group(const hid_t existing_id) : H5Object(), CommonFG(), id(existing_id)
/// is a datatype that has been named by DataType::commit.
// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
-Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), CommonFG(), id(H5I_INVALID_HID)
+Group::Group(const H5Location &loc, const void *ref, H5R_type_t ref_type, const PropList &plist)
+ : H5Object(), CommonFG(), id(H5I_INVALID_HID)
{
id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference");
}
@@ -132,12 +134,13 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - January, 2003
//--------------------------------------------------------------------------
-hsize_t Group::getNumObjs() const
+hsize_t
+Group::getNumObjs() const
{
- H5G_info_t ginfo; // Group information
+ H5G_info_t ginfo; // Group information
herr_t ret_value = H5Gget_info(getId(), &ginfo);
- if(ret_value < 0)
+ if (ret_value < 0)
throwException("getNumObjs", "H5Gget_info failed");
return (ginfo.nlinks);
}
@@ -155,14 +158,14 @@ hsize_t Group::getNumObjs() const
/// the object's type.
// Programmer Binh-Minh Ribler - March, 2017
//--------------------------------------------------------------------------
-hid_t Group::getObjId(const char* obj_name, const PropList& plist) const
+hid_t
+Group::getObjId(const char *obj_name, const PropList &plist) const
{
hid_t ret_value = H5Oopen(getId(), obj_name, plist.getId());
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throwException("Group::getObjId", "H5Oopen failed");
}
- return(ret_value);
+ return (ret_value);
}
//--------------------------------------------------------------------------
@@ -175,9 +178,10 @@ hid_t Group::getObjId(const char* obj_name, const PropList& plist) const
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - March, 2017
//--------------------------------------------------------------------------
-hid_t Group::getObjId(const H5std_string& obj_name, const PropList& plist) const
+hid_t
+Group::getObjId(const H5std_string &obj_name, const PropList &plist) const
{
- return(getObjId(obj_name.c_str(), plist));
+ return (getObjId(obj_name.c_str(), plist));
}
//--------------------------------------------------------------------------
@@ -192,9 +196,10 @@ hid_t Group::getObjId(const H5std_string& obj_name, const PropList& plist) const
// IdComponent::getId now becomes pure virtual function.
// Programmer Binh-Minh Ribler - May, 2008
//--------------------------------------------------------------------------
-hid_t Group::getId() const
+hid_t
+Group::getId() const
{
- return(id);
+ return (id);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -210,13 +215,14 @@ hid_t Group::getId() const
// Then the object's id is reset to the new id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Group::p_setId(const hid_t new_id)
+void
+Group::p_setId(const hid_t new_id)
{
// handling references to this old id
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throwException("Group::p_setId", close_error.getDetailMsg());
}
// reset object's id to the given id
@@ -231,13 +237,12 @@ void Group::p_setId(const hid_t new_id)
///\exception H5::GroupIException
// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
-void Group::close()
+void
+Group::close()
{
- if (p_valid_id(id))
- {
+ if (p_valid_id(id)) {
herr_t ret_value = H5Gclose(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throwException("Group::close", "H5Gclose failed");
}
// reset the id
@@ -258,7 +263,8 @@ void Group::close()
// an implementation of Group.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Group::throwException(const H5std_string& func_name, const H5std_string& msg) const
+void
+Group::throwException(const H5std_string &func_name, const H5std_string &msg) const
{
H5std_string full_name = func_name;
full_name.insert(0, "Group::");
@@ -280,9 +286,9 @@ Group::~Group()
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
cerr << "Group::~Group - " << close_error.getDetailMsg() << endl;
}
}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h
index 70b6bff..7b9dc54 100644
--- a/c++/src/H5Group.h
+++ b/c++/src/H5Group.h
@@ -22,57 +22,63 @@ namespace H5 {
*/
// Inheritance: CommonFG/H5Object -> H5Location -> IdComponent
class H5_DLLCPP Group : public H5Object, public CommonFG {
- public:
- // Close this group.
- virtual void close();
+ public:
+ // Close this group.
+ virtual void close();
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("Group"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("Group");
+ }
- // Throw group exception.
- virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
+ // Throw group exception.
+ virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const;
- // for CommonFG to get the file id.
- virtual hid_t getLocId() const;
+ // for CommonFG to get the file id.
+ virtual hid_t getLocId() const;
- // Creates a group by way of dereference.
- Group(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
- // Removed in 1.10.1, because H5Location is baseclass
-// Group(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
+ // Creates a group by way of dereference.
+ Group(const H5Location &loc, const void *ref, H5R_type_t ref_type = H5R_OBJECT,
+ const PropList &plist = PropList::DEFAULT);
+ // Removed in 1.10.1, because H5Location is baseclass
+ // Group(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList&
+ // plist = PropList::DEFAULT);
- // Returns the number of objects in this group.
- hsize_t getNumObjs() const;
+ // Returns the number of objects in this group.
+ hsize_t getNumObjs() const;
- // Opens an object within a group or a file, i.e., root group.
- hid_t getObjId(const char* name, const PropList& plist = PropList::DEFAULT) const;
- hid_t getObjId(const H5std_string& name, const PropList& plist = PropList::DEFAULT) const;
+ // Opens an object within a group or a file, i.e., root group.
+ hid_t getObjId(const char *name, const PropList &plist = PropList::DEFAULT) const;
+ hid_t getObjId(const H5std_string &name, const PropList &plist = PropList::DEFAULT) const;
- // Closes an object opened by getObjId().
- void closeObjId(hid_t obj_id) const;
+ // Closes an object opened by getObjId().
+ void closeObjId(hid_t obj_id) const;
- // default constructor
- Group();
+ // default constructor
+ Group();
- // Copy constructor: same as the original Group.
- Group(const Group& original);
+ // Copy constructor: same as the original Group.
+ Group(const Group &original);
- // Gets the group id.
- virtual hid_t getId() const;
+ // Gets the group id.
+ virtual hid_t getId() const;
- // Destructor
- virtual ~Group();
+ // Destructor
+ virtual ~Group();
- // Creates a copy of an existing group using its id.
- Group(const hid_t group_id);
+ // Creates a copy of an existing group using its id.
+ Group(const hid_t group_id);
- protected:
+ protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Sets the group id.
- virtual void p_setId(const hid_t new_id);
+ // Sets the group id.
+ virtual void p_setId(const hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
- private:
- hid_t id; // HDF5 group id
+ private:
+ hid_t id; // HDF5 group id
}; // end of Group
} // namespace H5
diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp
index 40520aa..ca54551 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -13,7 +13,7 @@
#include <string>
-#include "H5private.h" // for HDmemset
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5Library.h"
@@ -38,7 +38,8 @@ bool IdComponent::H5dontAtexit_called = false;
///\brief Increment reference counter for a given id.
// Programmer Binh-Minh Ribler - May 2005
//--------------------------------------------------------------------------
-void IdComponent::incRefCount(const hid_t obj_id) const
+void
+IdComponent::incRefCount(const hid_t obj_id) const
{
if (p_valid_id(obj_id))
if (H5Iinc_ref(obj_id) < 0)
@@ -50,7 +51,8 @@ void IdComponent::incRefCount(const hid_t obj_id) const
///\brief Increment reference counter for the id of this object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void IdComponent::incRefCount() const
+void
+IdComponent::incRefCount() const
{
incRefCount(getId());
}
@@ -63,17 +65,15 @@ void IdComponent::incRefCount() const
// Added the check for ref counter to give a little more info
// on why H5Idec_ref fails in some cases - BMR 5/19/2005
//--------------------------------------------------------------------------
-void IdComponent::decRefCount(const hid_t obj_id) const
+void
+IdComponent::decRefCount(const hid_t obj_id) const
{
if (p_valid_id(obj_id))
- if (H5Idec_ref(obj_id) < 0)
- {
+ if (H5Idec_ref(obj_id) < 0) {
if (H5Iget_ref(obj_id) <= 0)
- throw IdComponentException(inMemFunc("decRefCount"),
- "object ref count is 0 or negative");
+ throw IdComponentException(inMemFunc("decRefCount"), "object ref count is 0 or negative");
else
- throw IdComponentException(inMemFunc("decRefCount"),
- "decrementing object ref count failed");
+ throw IdComponentException(inMemFunc("decRefCount"), "decrementing object ref count failed");
}
}
@@ -82,7 +82,8 @@ void IdComponent::decRefCount(const hid_t obj_id) const
///\brief Decrement reference counter for the id of this object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void IdComponent::decRefCount() const
+void
+IdComponent::decRefCount() const
{
decRefCount(getId());
}
@@ -93,14 +94,15 @@ void IdComponent::decRefCount() const
///\return Reference count
// Programmer Binh-Minh Ribler - May 2005
//--------------------------------------------------------------------------
-int IdComponent::getCounter(const hid_t obj_id) const
+int
+IdComponent::getCounter(const hid_t obj_id) const
{
int counter = 0;
- if (p_valid_id(obj_id))
- {
+ if (p_valid_id(obj_id)) {
counter = H5Iget_ref(obj_id);
if (counter < 0)
- throw IdComponentException(inMemFunc("incRefCount"), "getting object ref count failed - negative");
+ throw IdComponentException(inMemFunc("incRefCount"),
+ "getting object ref count failed - negative");
}
return (counter);
}
@@ -111,7 +113,8 @@ int IdComponent::getCounter(const hid_t obj_id) const
///\return Reference count
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int IdComponent::getCounter() const
+int
+IdComponent::getCounter() const
{
return (getCounter(getId()));
}
@@ -130,7 +133,8 @@ int IdComponent::getCounter() const
/// input object id is invalid.
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-H5I_type_t IdComponent::getHDFObjType(const hid_t obj_id)
+H5I_type_t
+IdComponent::getHDFObjType(const hid_t obj_id)
{
if (obj_id <= 0)
return H5I_BADID; // invalid
@@ -156,9 +160,10 @@ H5I_type_t IdComponent::getHDFObjType(const hid_t obj_id)
/// input object id is invalid.
// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
-H5I_type_t IdComponent::getHDFObjType() const
+H5I_type_t
+IdComponent::getHDFObjType() const
{
- return(getHDFObjType(getId()));
+ return (getHDFObjType(getId()));
}
//--------------------------------------------------------------------------
@@ -183,14 +188,15 @@ H5I_type_t IdComponent::getHDFObjType() const
/// \li \c H5I_ERROR_STACK
// Programmer Binh-Minh Ribler - Feb, 2017
//--------------------------------------------------------------------------
-hsize_t IdComponent::getNumMembers(H5I_type_t type)
+hsize_t
+IdComponent::getNumMembers(H5I_type_t type)
{
- hsize_t nmembers = 0;
- herr_t ret_value = H5Inmembers(type, &nmembers);
+ hsize_t nmembers = 0;
+ herr_t ret_value = H5Inmembers(type, &nmembers);
if (ret_value < 0)
throw IdComponentException("getNumMembers", "H5Inmembers failed");
else
- return(nmembers);
+ return (nmembers);
}
//--------------------------------------------------------------------------
@@ -202,7 +208,8 @@ hsize_t IdComponent::getNumMembers(H5I_type_t type)
/// reference count of at least 1.
// Programmer Binh-Minh Ribler - Mar 1, 2017
//--------------------------------------------------------------------------
-bool IdComponent::isValid(hid_t an_id)
+bool
+IdComponent::isValid(hid_t an_id)
{
// Call C function
htri_t ret_value = H5Iis_valid(an_id);
@@ -236,7 +243,8 @@ bool IdComponent::isValid(hid_t an_id)
/// \li \c H5I_ERROR_STACK
// Programmer Binh-Minh Ribler - Feb, 2017
//--------------------------------------------------------------------------
-bool IdComponent::typeExists(H5I_type_t type)
+bool
+IdComponent::typeExists(H5I_type_t type)
{
// Call C function
htri_t ret_value = H5Itype_exists(type);
@@ -266,17 +274,17 @@ bool IdComponent::typeExists(H5I_type_t type)
// care of close() and setId takes care incRefCount().
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IdComponent& IdComponent::operator=(const IdComponent& rhs)
+IdComponent &
+IdComponent::operator=(const IdComponent &rhs)
{
- if (this != &rhs)
- {
+ if (this != &rhs) {
// handling references to this id
try {
setId(rhs.getId());
// Note: a = b, so there are two objects with the same hdf5 id
// that's why incRefCount is needed, and it is called by setId
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw FileIException(inMemFunc("operator="), close_error.getDetailMsg());
}
}
@@ -304,7 +312,8 @@ IdComponent& IdComponent::operator=(const IdComponent& rhs)
// the id passed to setId is that of another C++ API object, so
// setId must call incRefCount.
//--------------------------------------------------------------------------
-void IdComponent::setId(const hid_t new_id)
+void
+IdComponent::setId(const hid_t new_id)
{
// set to new_id
p_setId(new_id);
@@ -338,7 +347,8 @@ IdComponent::~IdComponent() {}
/// an exception is thrown.
// Programmer Binh-Minh Ribler - Aug 6, 2005
//--------------------------------------------------------------------------
-H5std_string IdComponent::inMemFunc(const char* func_name) const
+H5std_string
+IdComponent::inMemFunc(const char *func_name) const
{
H5std_string full_name = func_name;
full_name.insert(0, "::");
@@ -355,8 +365,7 @@ IdComponent::IdComponent()
{
// initH5cpp will register the terminating functions with atexit().
// This should only be done once.
- if (!H5cppinit)
- {
+ if (!H5cppinit) {
H5Library::initH5cpp();
H5cppinit = true;
}
@@ -374,7 +383,8 @@ IdComponent::IdComponent()
// inherits from H5Location.
// Programmer Binh-Minh Ribler - Jul, 2004
//--------------------------------------------------------------------------
-H5std_string IdComponent::p_get_file_name() const
+H5std_string
+IdComponent::p_get_file_name() const
{
hid_t temp_id = getId();
@@ -382,28 +392,26 @@ H5std_string IdComponent::p_get_file_name() const
ssize_t name_size = H5Fget_name(temp_id, NULL, 0);
// If H5Aget_name returns a negative value, raise an exception,
- if (name_size < 0)
- {
+ if (name_size < 0) {
throw IdComponentException("", "H5Fget_name failed");
}
// Call H5Fget_name again to get the actual file name
- char* name_C = new char[name_size+1]; // temporary C-string for C API
- HDmemset(name_C, 0, name_size+1); // clear buffer
+ char *name_C = new char[name_size + 1]; // temporary C-string for C API
+ HDmemset(name_C, 0, name_size + 1); // clear buffer
- name_size = H5Fget_name(temp_id, name_C, name_size+1);
+ name_size = H5Fget_name(temp_id, name_C, name_size + 1);
// Check for failure again
- if (name_size < 0)
- {
- delete []name_C;
+ if (name_size < 0) {
+ delete[] name_C;
throw IdComponentException("", "H5Fget_name failed");
}
// Convert the C file name and return
H5std_string file_name(name_C);
- delete []name_C;
- return(file_name);
+ delete[] name_C;
+ return (file_name);
}
//
@@ -417,7 +425,8 @@ H5std_string IdComponent::p_get_file_name() const
// Return true if id is valid, false, otherwise
// Programmer Binh-Minh Ribler - May, 2005
//--------------------------------------------------------------------------
-bool IdComponent::p_valid_id(const hid_t obj_id)
+bool
+IdComponent::p_valid_id(const hid_t obj_id)
{
if (obj_id <= 0)
return false;
@@ -439,4 +448,4 @@ bool IdComponent::p_valid_id(const hid_t obj_id)
#endif // DOXYGEN_SHOULD_SKIP_THIS
-}
+} // namespace H5
diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h
index b4070b0..8db1af2 100644
--- a/c++/src/H5IdComponent.h
+++ b/c++/src/H5IdComponent.h
@@ -25,85 +25,88 @@ namespace H5 {
rarely needs them.
*/
class H5_DLLCPP IdComponent {
- public:
+ public:
+ // Increment reference counter.
+ void incRefCount(const hid_t obj_id) const;
+ void incRefCount() const;
- // Increment reference counter.
- void incRefCount(const hid_t obj_id) const;
- void incRefCount() const;
+ // Decrement reference counter.
+ void decRefCount(const hid_t obj_id) const;
+ void decRefCount() const;
- // Decrement reference counter.
- void decRefCount(const hid_t obj_id) const;
- void decRefCount() const;
+ // Get the reference counter to this identifier.
+ int getCounter(const hid_t obj_id) const;
+ int getCounter() const;
- // Get the reference counter to this identifier.
- int getCounter(const hid_t obj_id) const;
- int getCounter() const;
+ // Returns an HDF5 object type, given the object id.
+ static H5I_type_t getHDFObjType(const hid_t obj_id);
- // Returns an HDF5 object type, given the object id.
- static H5I_type_t getHDFObjType(const hid_t obj_id);
+ // Returns an HDF5 object type of this object.
+ H5I_type_t getHDFObjType() const;
- // Returns an HDF5 object type of this object.
- H5I_type_t getHDFObjType() const;
+ // Returns the number of members in a type.
+ static hsize_t getNumMembers(H5I_type_t type);
- // Returns the number of members in a type.
- static hsize_t getNumMembers(H5I_type_t type);
+ // Checks if the given ID is valid.
+ static bool isValid(hid_t an_id);
- // Checks if the given ID is valid.
- static bool isValid(hid_t an_id);
+ // Determines if an type exists.
+ static bool typeExists(H5I_type_t type);
- // Determines if an type exists.
- static bool typeExists(H5I_type_t type);
+ // Assignment operator.
+ IdComponent &operator=(const IdComponent &rhs);
- // Assignment operator.
- IdComponent& operator=(const IdComponent& rhs);
-
- // Sets the identifier of this object to a new value.
- void setId(const hid_t new_id);
+ // Sets the identifier of this object to a new value.
+ void setId(const hid_t new_id);
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Gets the identifier of this object.
- virtual hid_t getId () const = 0;
+ // Gets the identifier of this object.
+ virtual hid_t getId() const = 0;
- // Pure virtual function for there are various H5*close for the
- // subclasses.
- virtual void close() = 0;
+ // Pure virtual function for there are various H5*close for the
+ // subclasses.
+ virtual void close() = 0;
- // Makes and returns the string "<class-name>::<func_name>";
- // <class-name> is returned by fromClass().
- H5std_string inMemFunc(const char* func_name) const;
+ // Makes and returns the string "<class-name>::<func_name>";
+ // <class-name> is returned by fromClass().
+ H5std_string inMemFunc(const char *func_name) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass() const { return("IdComponent");}
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("IdComponent");
+ }
#endif // DOXYGEN_SHOULD_SKIP_THIS
- // Destructor
- virtual ~IdComponent();
+ // Destructor
+ virtual ~IdComponent();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- protected:
- // Default constructor.
- IdComponent();
+ protected:
+ // Default constructor.
+ IdComponent();
- // Gets the name of the file, in which an HDF5 object belongs.
- H5std_string p_get_file_name() const;
+ // Gets the name of the file, in which an HDF5 object belongs.
+ H5std_string p_get_file_name() const;
- // Verifies that the given id is valid.
- static bool p_valid_id(const hid_t obj_id);
+ // Verifies that the given id is valid.
+ static bool p_valid_id(const hid_t obj_id);
- // Sets the identifier of this object to a new value. - this one
- // doesn't increment reference count
- virtual void p_setId(const hid_t new_id) = 0;
+ // Sets the identifier of this object to a new value. - this one
+ // doesn't increment reference count
+ virtual void p_setId(const hid_t new_id) = 0;
- // This flag is used to decide whether H5dont_atexit should be called
- static bool H5dontAtexit_called;
+ // This flag is used to decide whether H5dont_atexit should be called
+ static bool H5dontAtexit_called;
- private:
- // This flag indicates whether H5Library::initH5cpp has been called
- // to register various terminating functions with atexit()
- static bool H5cppinit;
+ private:
+ // This flag indicates whether H5Library::initH5cpp has been called
+ // to register various terminating functions with atexit()
+ static bool H5cppinit;
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5Include.h b/c++/src/H5Include.h
index a180430..c26ba33 100644
--- a/c++/src/H5Include.h
+++ b/c++/src/H5Include.h
@@ -23,18 +23,17 @@
#undef true
#endif
typedef int bool;
-const bool false = 0;
-const bool true = 1;
+const bool false = 0;
+const bool true = 1;
#endif
// These are defined in H5Opkg.h, which should not be included in the C++ API,
// so re-define them here for now.
/* Initial version of the object header format */
-#define H5O_VERSION_1 1
+#define H5O_VERSION_1 1
/* Revised version - leaves out reserved bytes and alignment padding, and adds
* magic number as prefix and checksum as suffix for all chunks.
*/
-#define H5O_VERSION_2 2
-
+#define H5O_VERSION_2 2
diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp
index 01c20e9..7f3bcb5 100644
--- a/c++/src/H5IntType.cpp
+++ b/c++/src/H5IntType.cpp
@@ -47,7 +47,7 @@ IntType::IntType() {}
///\brief Copy constructor: same HDF5 object as \a original
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType::IntType(const IntType& original) : AtomType( original ) {}
+IntType::IntType(const IntType &original) : AtomType(original) {}
//--------------------------------------------------------------------------
// Function: IntType overloaded constructor
@@ -56,7 +56,7 @@ IntType::IntType(const IntType& original) : AtomType( original ) {}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType::IntType(const PredType& pred_type) : AtomType()
+IntType::IntType(const PredType &pred_type) : AtomType()
{
// use DataType::copy to make a copy of this predefined type
copy(pred_type);
@@ -70,7 +70,7 @@ IntType::IntType(const PredType& pred_type) : AtomType()
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType::IntType(const hid_t existing_id) : AtomType( existing_id ) {}
+IntType::IntType(const hid_t existing_id) : AtomType(existing_id) {}
//--------------------------------------------------------------------------
// Function: IntType overloaded constructor
@@ -79,13 +79,12 @@ IntType::IntType(const hid_t existing_id) : AtomType( existing_id ) {}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType::IntType(const DataSet& dataset) : AtomType()
+IntType::IntType(const DataSet &dataset) : AtomType()
{
// Calls C function H5Dget_type to get the id of the datatype
id = H5Dget_type(dataset.getId());
- if (id < 0)
- {
+ if (id < 0) {
throw DataSetIException("IntType constructor", "H5Dget_type failed");
}
}
@@ -104,7 +103,7 @@ IntType::IntType(const DataSet& dataset) : AtomType()
// improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-IntType::IntType(const H5Location& loc, const char *dtype_name) : AtomType()
+IntType::IntType(const H5Location &loc, const char *dtype_name) : AtomType()
{
id = p_opentype(loc, dtype_name);
}
@@ -123,7 +122,7 @@ IntType::IntType(const H5Location& loc, const char *dtype_name) : AtomType()
// to improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-IntType::IntType(const H5Location& loc, const H5std_string& dtype_name) : AtomType()
+IntType::IntType(const H5Location &loc, const H5std_string &dtype_name) : AtomType()
{
id = p_opentype(loc, dtype_name.c_str());
}
@@ -136,7 +135,8 @@ IntType::IntType(const H5Location& loc, const H5std_string& dtype_name) : AtomTy
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-DataType* IntType::decode() const
+DataType *
+IntType::decode() const
{
hid_t encoded_inttype_id = H5I_INVALID_HID;
try {
@@ -147,7 +147,7 @@ DataType* IntType::decode() const
}
IntType *encoded_inttype = new IntType;
encoded_inttype->p_setId(encoded_inttype_id);
- return(encoded_inttype);
+ return (encoded_inttype);
}
//--------------------------------------------------------------------------
@@ -157,17 +157,17 @@ DataType* IntType::decode() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5T_sign_t IntType::getSign() const
+H5T_sign_t
+IntType::getSign() const
{
- H5T_sign_t type_sign = H5Tget_sign(id); // C routine
+ H5T_sign_t type_sign = H5Tget_sign(id); // C routine
// Returns a valid sign type if no errors
- if (type_sign == H5T_SGN_ERROR)
- {
+ if (type_sign == H5T_SGN_ERROR) {
throw DataTypeIException("IntType::getSign",
- "H5Tget_sign failed - returned H5T_SGN_ERROR for the sign type");
+ "H5Tget_sign failed - returned H5T_SGN_ERROR for the sign type");
}
- return(type_sign);
+ return (type_sign);
}
//--------------------------------------------------------------------------
@@ -177,12 +177,12 @@ H5T_sign_t IntType::getSign() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void IntType::setSign(H5T_sign_t sign) const
+void
+IntType::setSign(H5T_sign_t sign) const
{
// Call C routine to set the sign property
herr_t ret_value = H5Tset_sign(id, sign);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("IntType::setSign", "H5Tset_sign failed");
}
}
@@ -194,4 +194,4 @@ void IntType::setSign(H5T_sign_t sign) const
//--------------------------------------------------------------------------
IntType::~IntType() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h
index 496872b..e8bccca 100644
--- a/c++/src/H5IntType.h
+++ b/c++/src/H5IntType.h
@@ -23,41 +23,45 @@ namespace H5 {
*/
// Inheritance: AtomType -> DataType -> H5Object -> H5Location -> IdComponent
class H5_DLLCPP IntType : public AtomType {
- public:
- // Creates an integer type using a predefined type
- IntType(const PredType& pred_type);
+ public:
+ // Creates an integer type using a predefined type
+ IntType(const PredType &pred_type);
- // Gets the integer datatype of the specified dataset
- IntType(const DataSet& dataset);
+ // Gets the integer datatype of the specified dataset
+ IntType(const DataSet &dataset);
- // Constructors that open an HDF5 integer datatype, given a location.
- IntType(const H5Location& loc, const char* name);
- IntType(const H5Location& loc, const H5std_string& name);
+ // Constructors that open an HDF5 integer datatype, given a location.
+ IntType(const H5Location &loc, const char *name);
+ IntType(const H5Location &loc, const H5std_string &name);
- // Returns an IntType object via DataType* by decoding the
- // binary object description of this type.
- virtual DataType* decode() const;
+ // Returns an IntType object via DataType* by decoding the
+ // binary object description of this type.
+ virtual DataType *decode() const;
- // Retrieves the sign type for an integer type
- H5T_sign_t getSign() const;
+ // Retrieves the sign type for an integer type
+ H5T_sign_t getSign() const;
- // Sets the sign proprety for an integer type.
- void setSign(H5T_sign_t sign) const;
+ // Sets the sign proprety for an integer type.
+ void setSign(H5T_sign_t sign) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("IntType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("IntType");
+ }
- // Default constructor
- IntType();
+ // Default constructor
+ IntType();
- // Creates a integer datatype using an existing id
- IntType(const hid_t existing_id);
+ // Creates a integer datatype using an existing id
+ IntType(const hid_t existing_id);
- // Copy constructor: same as the original IntType.
- IntType(const IntType& original);
+ // Copy constructor: same as the original IntType.
+ IntType(const IntType &original);
- // Noop destructor.
- virtual ~IntType();
+ // Noop destructor.
+ virtual ~IntType();
}; // end of IntType
} // namespace H5
diff --git a/c++/src/H5LaccProp.cpp b/c++/src/H5LaccProp.cpp
index 1905cce..bd9cd1b 100644
--- a/c++/src/H5LaccProp.cpp
+++ b/c++/src/H5LaccProp.cpp
@@ -27,7 +27,7 @@ namespace H5 {
// in "H5PredType.cpp" for information.
// Initialize a pointer for the constant
-LinkAccPropList* LinkAccPropList::DEFAULT_ = 0;
+LinkAccPropList *LinkAccPropList::DEFAULT_ = 0;
//--------------------------------------------------------------------------
// Function: LinkAccPropList::getConstant
@@ -40,13 +40,13 @@ LinkAccPropList* LinkAccPropList::DEFAULT_ = 0;
// happen.
// Programmer Binh-Minh Ribler - December, 2016
//--------------------------------------------------------------------------
-LinkAccPropList* LinkAccPropList::getConstant()
+LinkAccPropList *
+LinkAccPropList::getConstant()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -55,8 +55,9 @@ LinkAccPropList* LinkAccPropList::getConstant()
if (DEFAULT_ == 0)
DEFAULT_ = new LinkAccPropList(H5P_LINK_ACCESS);
else
- throw PropListIException("LinkAccPropList::getConstant", "LinkAccPropList::getConstant is being invoked on an allocated DEFAULT_");
- return(DEFAULT_);
+ throw PropListIException("LinkAccPropList::getConstant",
+ "LinkAccPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return (DEFAULT_);
}
//--------------------------------------------------------------------------
@@ -66,7 +67,8 @@ LinkAccPropList* LinkAccPropList::getConstant()
// exception H5::PropListIException
// Programmer Binh-Minh Ribler - December, 2016
//--------------------------------------------------------------------------
-void LinkAccPropList::deleteConstants()
+void
+LinkAccPropList::deleteConstants()
{
if (DEFAULT_ != 0)
delete DEFAULT_;
@@ -75,7 +77,7 @@ void LinkAccPropList::deleteConstants()
//--------------------------------------------------------------------------
// Purpose: Constant for default property
//--------------------------------------------------------------------------
-const LinkAccPropList& LinkAccPropList::DEFAULT = *getConstant();
+const LinkAccPropList &LinkAccPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -92,7 +94,7 @@ LinkAccPropList::LinkAccPropList() : PropList(H5P_LINK_ACCESS) {}
///\param original - IN: LinkAccPropList instance to copy
// Programmer Binh-Minh Ribler - December, 2016
//--------------------------------------------------------------------------
-LinkAccPropList::LinkAccPropList(const LinkAccPropList& original) : PropList(original) {}
+LinkAccPropList::LinkAccPropList(const LinkAccPropList &original) : PropList(original) {}
//--------------------------------------------------------------------------
// Function: LinkAccPropList overloaded constructor
@@ -111,12 +113,12 @@ LinkAccPropList::LinkAccPropList(const hid_t plist_id) : PropList(plist_id) {}
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - March 1, 2017
//--------------------------------------------------------------------------
-void LinkAccPropList::setNumLinks(size_t nlinks) const
+void
+LinkAccPropList::setNumLinks(size_t nlinks) const
{
herr_t ret_value = H5Pset_nlinks(id, nlinks);
// Throw exception if H5Pset_nlinks returns failure
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("setNumLinks", "H5Pset_nlinks failed");
}
}
@@ -129,16 +131,16 @@ void LinkAccPropList::setNumLinks(size_t nlinks) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - March 1, 2017
//--------------------------------------------------------------------------
-size_t LinkAccPropList::getNumLinks() const
+size_t
+LinkAccPropList::getNumLinks() const
{
- size_t nlinks = 0;
+ size_t nlinks = 0;
herr_t ret_value = H5Pget_nlinks(id, &nlinks);
// Throw exception if H5Pget_nlinks returns failure
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("getNumLinks", "H5Pget_nlinks failed");
}
- return(nlinks);
+ return (nlinks);
}
//--------------------------------------------------------------------------
@@ -148,4 +150,4 @@ size_t LinkAccPropList::getNumLinks() const
//--------------------------------------------------------------------------
LinkAccPropList::~LinkAccPropList() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5LaccProp.h b/c++/src/H5LaccProp.h
index ec5e54f..337f0b7 100644
--- a/c++/src/H5LaccProp.h
+++ b/c++/src/H5LaccProp.h
@@ -23,43 +23,47 @@ namespace H5 {
*/
// Inheritance: PropList -> IdComponent
class H5_DLLCPP LinkAccPropList : public PropList {
- public:
- ///\brief Default link access property list.
- static const LinkAccPropList& DEFAULT;
+ public:
+ ///\brief Default link access property list.
+ static const LinkAccPropList &DEFAULT;
- // Creates a link access property list.
- LinkAccPropList();
+ // Creates a link access property list.
+ LinkAccPropList();
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("LinkAccPropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("LinkAccPropList");
+ }
- // Copy constructor: same as the original LinkAccPropList.
- LinkAccPropList(const LinkAccPropList& original);
+ // Copy constructor: same as the original LinkAccPropList.
+ LinkAccPropList(const LinkAccPropList &original);
- // Creates a copy of an existing link access property list
- // using the property list id.
- LinkAccPropList (const hid_t plist_id);
+ // Creates a copy of an existing link access property list
+ // using the property list id.
+ LinkAccPropList(const hid_t plist_id);
- // Sets the number of soft or user-defined links that can be
- // traversed before a failure occurs.
- void setNumLinks(size_t nlinks) const;
+ // Sets the number of soft or user-defined links that can be
+ // traversed before a failure occurs.
+ void setNumLinks(size_t nlinks) const;
- // Gets the number of soft or user-defined link traversals allowed
- size_t getNumLinks() const;
+ // Gets the number of soft or user-defined link traversals allowed
+ size_t getNumLinks() const;
- // Noop destructor
- virtual ~LinkAccPropList();
+ // Noop destructor
+ virtual ~LinkAccPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the global constant, should only be used by the library
- static void deleteConstants();
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
- private:
- static LinkAccPropList* DEFAULT_;
+ private:
+ static LinkAccPropList *DEFAULT_;
- // Creates the global constant, should only be used by the library
- static LinkAccPropList* getConstant();
+ // Creates the global constant, should only be used by the library
+ static LinkAccPropList *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5LcreatProp.cpp b/c++/src/H5LcreatProp.cpp
index bde9339..e40d6ba 100644
--- a/c++/src/H5LcreatProp.cpp
+++ b/c++/src/H5LcreatProp.cpp
@@ -27,7 +27,7 @@ namespace H5 {
// in "H5PredType.cpp" for information.
// Initialize a pointer for the constant
-LinkCreatPropList* LinkCreatPropList::DEFAULT_ = 0;
+LinkCreatPropList *LinkCreatPropList::DEFAULT_ = 0;
//--------------------------------------------------------------------------
// Function: LinkCreatPropList::getConstant
@@ -40,13 +40,13 @@ LinkCreatPropList* LinkCreatPropList::DEFAULT_ = 0;
// happen.
// December, 2016
//--------------------------------------------------------------------------
-LinkCreatPropList* LinkCreatPropList::getConstant()
+LinkCreatPropList *
+LinkCreatPropList::getConstant()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -55,8 +55,9 @@ LinkCreatPropList* LinkCreatPropList::getConstant()
if (DEFAULT_ == 0)
DEFAULT_ = new LinkCreatPropList(H5P_LINK_CREATE);
else
- throw PropListIException("LinkCreatPropList::getConstant", "LinkCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
- return(DEFAULT_);
+ throw PropListIException("LinkCreatPropList::getConstant",
+ "LinkCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return (DEFAULT_);
}
//--------------------------------------------------------------------------
@@ -66,7 +67,8 @@ LinkCreatPropList* LinkCreatPropList::getConstant()
// exception H5::PropListIException
// December, 2016
//--------------------------------------------------------------------------
-void LinkCreatPropList::deleteConstants()
+void
+LinkCreatPropList::deleteConstants()
{
if (DEFAULT_ != 0)
delete DEFAULT_;
@@ -75,7 +77,7 @@ void LinkCreatPropList::deleteConstants()
//--------------------------------------------------------------------------
// Purpose: Constant for default property
//--------------------------------------------------------------------------
-const LinkCreatPropList& LinkCreatPropList::DEFAULT = *getConstant();
+const LinkCreatPropList &LinkCreatPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -92,7 +94,7 @@ LinkCreatPropList::LinkCreatPropList() : PropList(H5P_LINK_CREATE) {}
///\param original - IN: LinkCreatPropList instance to copy
// December, 2016
//--------------------------------------------------------------------------
-LinkCreatPropList::LinkCreatPropList(const LinkCreatPropList& original) : PropList(original) {}
+LinkCreatPropList::LinkCreatPropList(const LinkCreatPropList &original) : PropList(original) {}
//--------------------------------------------------------------------------
// Function: LinkCreatPropList overloaded constructor
@@ -111,12 +113,12 @@ LinkCreatPropList::LinkCreatPropList(const hid_t plist_id) : PropList(plist_id)
///\exception H5::PropListIException
// April, 2019
//--------------------------------------------------------------------------
-void LinkCreatPropList::setCreateIntermediateGroup(bool crt_intmd_group) const
+void
+LinkCreatPropList::setCreateIntermediateGroup(bool crt_intmd_group) const
{
herr_t ret_value = H5Pset_create_intermediate_group(id, (unsigned)crt_intmd_group);
// Throw exception if H5Pset_create_intermediate_group returns failure
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("setCreateIntermediateGroup", "H5Pset_create_intermediate_group failed");
}
}
@@ -129,17 +131,17 @@ void LinkCreatPropList::setCreateIntermediateGroup(bool crt_intmd_group) const
///\exception H5::PropListIException
// April, 2019
//--------------------------------------------------------------------------
-bool LinkCreatPropList::getCreateIntermediateGroup() const
+bool
+LinkCreatPropList::getCreateIntermediateGroup() const
{
unsigned crt_intmd_group;
- herr_t ret_value = H5Pget_create_intermediate_group(id, &crt_intmd_group);
+ herr_t ret_value = H5Pget_create_intermediate_group(id, &crt_intmd_group);
// Throw exception if H5Pget_create_intermediate_group returns failure
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("getCreateIntermediateGroup", "H5Pget_create_intermediate_group failed");
}
- return((bool)crt_intmd_group);
+ return ((bool)crt_intmd_group);
}
//--------------------------------------------------------------------------
@@ -149,12 +151,12 @@ bool LinkCreatPropList::getCreateIntermediateGroup() const
///\exception H5::PropListIException
// March, 2018
//--------------------------------------------------------------------------
-void LinkCreatPropList::setCharEncoding(H5T_cset_t encoding) const
+void
+LinkCreatPropList::setCharEncoding(H5T_cset_t encoding) const
{
herr_t ret_value = H5Pset_char_encoding(id, encoding);
// Throw exception if H5Pset_char_encoding returns failure
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("setCharEncoding", "H5Pset_char_encoding failed");
}
}
@@ -166,16 +168,16 @@ void LinkCreatPropList::setCharEncoding(H5T_cset_t encoding) const
///\exception H5::PropListIException
// March, 2018
//--------------------------------------------------------------------------
-H5T_cset_t LinkCreatPropList::getCharEncoding() const
+H5T_cset_t
+LinkCreatPropList::getCharEncoding() const
{
H5T_cset_t encoding;
- herr_t ret_value = H5Pget_char_encoding(id, &encoding);
+ herr_t ret_value = H5Pget_char_encoding(id, &encoding);
// Throw exception if H5Pget_char_encoding returns failure
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("getCharEncoding", "H5Pget_char_encoding failed");
}
- return(encoding);
+ return (encoding);
}
//--------------------------------------------------------------------------
@@ -185,4 +187,4 @@ H5T_cset_t LinkCreatPropList::getCharEncoding() const
//--------------------------------------------------------------------------
LinkCreatPropList::~LinkCreatPropList() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5LcreatProp.h b/c++/src/H5LcreatProp.h
index 908ef63..7194bdc 100644
--- a/c++/src/H5LcreatProp.h
+++ b/c++/src/H5LcreatProp.h
@@ -23,50 +23,54 @@ namespace H5 {
*/
// Inheritance: PropList -> IdComponent
class H5_DLLCPP LinkCreatPropList : public PropList {
- public:
- ///\brief Default link creation property list.
- static const LinkCreatPropList& DEFAULT;
+ public:
+ ///\brief Default link creation property list.
+ static const LinkCreatPropList &DEFAULT;
- // Creates a link creation property list.
- LinkCreatPropList();
+ // Creates a link creation property list.
+ LinkCreatPropList();
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("LinkCreatPropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("LinkCreatPropList");
+ }
- // Copy constructor: same as the original LinkCreatPropList.
- LinkCreatPropList(const LinkCreatPropList& original);
+ // Copy constructor: same as the original LinkCreatPropList.
+ LinkCreatPropList(const LinkCreatPropList &original);
- // Creates a copy of an existing link creation property list
- // using the property list id.
- LinkCreatPropList (const hid_t plist_id);
+ // Creates a copy of an existing link creation property list
+ // using the property list id.
+ LinkCreatPropList(const hid_t plist_id);
- // Specifies in property list whether to create missing
- // intermediate groups
- void setCreateIntermediateGroup(bool crt_intmd_group) const;
+ // Specifies in property list whether to create missing
+ // intermediate groups
+ void setCreateIntermediateGroup(bool crt_intmd_group) const;
- // Determines whether property is set to enable creating missing
- // intermediate groups
- bool getCreateIntermediateGroup() const;
+ // Determines whether property is set to enable creating missing
+ // intermediate groups
+ bool getCreateIntermediateGroup() const;
- // Sets the character encoding of the string.
- void setCharEncoding(H5T_cset_t encoding) const;
+ // Sets the character encoding of the string.
+ void setCharEncoding(H5T_cset_t encoding) const;
- // Gets the character encoding of the string.
- H5T_cset_t getCharEncoding() const;
+ // Gets the character encoding of the string.
+ H5T_cset_t getCharEncoding() const;
- // Noop destructor
- virtual ~LinkCreatPropList();
+ // Noop destructor
+ virtual ~LinkCreatPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the global constant, should only be used by the library
- static void deleteConstants();
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
- private:
- static LinkCreatPropList* DEFAULT_;
+ private:
+ static LinkCreatPropList *DEFAULT_;
- // Creates the global constant, should only be used by the library
- static LinkCreatPropList* getConstant();
+ // Creates the global constant, should only be used by the library
+ static LinkCreatPropList *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp
index fde5599..8b8d7ba 100644
--- a/c++/src/H5Library.cpp
+++ b/c++/src/H5Library.cpp
@@ -14,7 +14,7 @@
#include <string>
#include <cstdlib>
-#include "H5CppDoc.h" // included only for Doxygen to generate part of RM
+#include "H5CppDoc.h" // included only for Doxygen to generate part of RM
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -44,11 +44,11 @@ namespace H5 {
///\exception H5::LibraryIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Library::open()
+void
+H5Library::open()
{
herr_t ret_value = H5open();
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw LibraryIException("H5Library::open", "H5open failed");
}
}
@@ -60,11 +60,11 @@ void H5Library::open()
///\exception H5::LibraryIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Library::close()
+void
+H5Library::close()
{
herr_t ret_value = H5close();
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw LibraryIException("H5Library::close", "H5close failed");
}
}
@@ -79,9 +79,10 @@ void H5Library::close()
// Removed the check for failure returned from H5dont_atexit.
// will be fixed to not fail (HDFFV-9540)
//--------------------------------------------------------------------------
-void H5Library::dontAtExit()
+void
+H5Library::dontAtExit()
{
- (void)H5dont_atexit();
+ (void)H5dont_atexit();
}
//--------------------------------------------------------------------------
@@ -93,11 +94,11 @@ void H5Library::dontAtExit()
///\exception H5::LibraryIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Library::getLibVersion(unsigned& majnum, unsigned& minnum, unsigned& relnum)
+void
+H5Library::getLibVersion(unsigned &majnum, unsigned &minnum, unsigned &relnum)
{
herr_t ret_value = H5get_libversion(&majnum, &minnum, &relnum);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw LibraryIException("H5Library::getLibVersion", "H5get_libversion failed");
}
}
@@ -115,11 +116,11 @@ void H5Library::getLibVersion(unsigned& majnum, unsigned& minnum, unsigned& reln
/// the H5check_version API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Library::checkVersion(unsigned majnum, unsigned minnum, unsigned relnum)
+void
+H5Library::checkVersion(unsigned majnum, unsigned minnum, unsigned relnum)
{
herr_t ret_value = H5check_version(majnum, minnum, relnum);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw LibraryIException("H5Library::checkVersion", "H5check_version failed");
}
}
@@ -144,11 +145,11 @@ void H5Library::checkVersion(unsigned majnum, unsigned minnum, unsigned relnum)
/// lists when the application ends.
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-void H5Library::garbageCollect()
+void
+H5Library::garbageCollect()
{
herr_t ret_value = H5garbage_collect();
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw LibraryIException("H5Library::garbageCollect", "H5garbage_collect failed");
}
}
@@ -168,12 +169,13 @@ void H5Library::garbageCollect()
//
// Programmer Binh-Minh Ribler - September, 2015
//--------------------------------------------------------------------------
-void H5Library::initH5cpp()
+void
+H5Library::initH5cpp()
{
// Register terminating functions with atexit(); they will be invoked in
// the reversed order
int ret_value = 0;
- ret_value = std::atexit(termH5cpp);
+ ret_value = std::atexit(termH5cpp);
if (ret_value != 0)
throw LibraryIException("H5Library::initH5cpp", "Registering termH5cpp failed");
@@ -187,35 +189,43 @@ void H5Library::initH5cpp()
ret_value = std::atexit(DSetAccPropList::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registering DSetAccPropList::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp",
+ "Registering DSetAccPropList::deleteConstants failed");
ret_value = std::atexit(LinkAccPropList::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registering LinkAccPropList::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp",
+ "Registering LinkAccPropList::deleteConstants failed");
ret_value = std::atexit(LinkCreatPropList::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registering LinkCreatPropList::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp",
+ "Registering LinkCreatPropList::deleteConstants failed");
ret_value = std::atexit(FileAccPropList::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registering FileAccPropList::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp",
+ "Registering FileAccPropList::deleteConstants failed");
ret_value = std::atexit(FileCreatPropList::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registering FileCreatPropList::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp",
+ "Registering FileCreatPropList::deleteConstants failed");
ret_value = std::atexit(DSetMemXferPropList::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registering DSetMemXferPropList::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp",
+ "Registering DSetMemXferPropList::deleteConstants failed");
ret_value = std::atexit(DSetCreatPropList::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registering DSetCreatPropList::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp",
+ "Registering DSetCreatPropList::deleteConstants failed");
ret_value = std::atexit(ObjCreatPropList::deleteConstants);
if (ret_value != 0)
- throw LibraryIException("H5Library::initH5cpp", "Registering ObjCreatPropList::deleteConstants failed");
+ throw LibraryIException("H5Library::initH5cpp",
+ "Registering ObjCreatPropList::deleteConstants failed");
ret_value = std::atexit(DataSpace::deleteConstants);
if (ret_value != 0)
@@ -229,7 +239,8 @@ void H5Library::initH5cpp()
/// If the C library fails to terminate, exit with a failure.
// Programmer Binh-Minh Ribler - September, 2015
//--------------------------------------------------------------------------
-void H5Library::termH5cpp()
+void
+H5Library::termH5cpp()
{
// Close the C library
herr_t ret_value = H5close();
@@ -253,13 +264,13 @@ void H5Library::termH5cpp()
/// the H5set_free_list_limits API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-void H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim,
- int arr_global_lim, int arr_list_lim, int blk_global_lim,
- int blk_list_lim)
+void
+H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim, int arr_global_lim, int arr_list_lim,
+ int blk_global_lim, int blk_list_lim)
{
- herr_t ret_value = H5set_free_list_limits(reg_global_lim, reg_list_lim, arr_global_lim, arr_list_lim, blk_global_lim, blk_list_lim);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5set_free_list_limits(reg_global_lim, reg_list_lim, arr_global_lim, arr_list_lim,
+ blk_global_lim, blk_list_lim);
+ if (ret_value < 0) {
throw LibraryIException("H5Library::setFreeListLimits", "H5set_free_list_limits failed");
}
}
@@ -270,14 +281,14 @@ void H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim,
///\brief Default constructor: Creates a stub H5Library object
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5Library::H5Library(){}
+H5Library::H5Library() {}
//--------------------------------------------------------------------------
// Function: H5Library destructor
///\brief Noop destructor
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5Library::~H5Library(){}
+H5Library::~H5Library() {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5Library.h b/c++/src/H5Library.h
index b9be3d0..d3f2831 100644
--- a/c++/src/H5Library.h
+++ b/c++/src/H5Library.h
@@ -24,47 +24,46 @@ namespace H5 {
methods.
*/
class H5_DLLCPP H5Library {
- public:
- // Initializes the HDF5 library.
- static void open();
+ public:
+ // Initializes the HDF5 library.
+ static void open();
- // Flushes all data to disk, closes files, and cleans up memory.
- static void close();
+ // Flushes all data to disk, closes files, and cleans up memory.
+ static void close();
- // Instructs library not to install atexit cleanup routine
- static void dontAtExit();
+ // Instructs library not to install atexit cleanup routine
+ static void dontAtExit();
- // Returns the HDF library release number.
- static void getLibVersion(unsigned& majnum, unsigned& minnum, unsigned& relnum);
+ // Returns the HDF library release number.
+ static void getLibVersion(unsigned &majnum, unsigned &minnum, unsigned &relnum);
- // Verifies that the arguments match the version numbers compiled
- // into the library
- static void checkVersion(unsigned majnum, unsigned minnum, unsigned relnum);
+ // Verifies that the arguments match the version numbers compiled
+ // into the library
+ static void checkVersion(unsigned majnum, unsigned minnum, unsigned relnum);
- // Walks through all the garbage collection routines for the library,
- // which are supposed to free any unused memory they have allocated.
- static void garbageCollect();
+ // Walks through all the garbage collection routines for the library,
+ // which are supposed to free any unused memory they have allocated.
+ static void garbageCollect();
- // Sets limits on the different kinds of free lists.
- static void setFreeListLimits(int reg_global_lim, int reg_list_lim, int
- arr_global_lim, int arr_list_lim, int blk_global_lim, int blk_list_lim);
+ // Sets limits on the different kinds of free lists.
+ static void setFreeListLimits(int reg_global_lim, int reg_list_lim, int arr_global_lim, int arr_list_lim,
+ int blk_global_lim, int blk_list_lim);
- // Initializes C++ library and registers terminating functions at exit.
- // Only for the library functions, not for user-defined functions.
- static void initH5cpp(void);
+ // Initializes C++ library and registers terminating functions at exit.
+ // Only for the library functions, not for user-defined functions.
+ static void initH5cpp(void);
- // Sends request for terminating the HDF5 library.
- static void termH5cpp(void);
+ // Sends request for terminating the HDF5 library.
+ static void termH5cpp(void);
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- private:
+ private:
+ // Default constructor - no instance ever created from outsiders
+ H5Library();
- // Default constructor - no instance ever created from outsiders
- H5Library();
-
- // Destructor
- ~H5Library();
+ // Destructor
+ ~H5Library();
#endif // DOXYGEN_SHOULD_SKIP_THIS
}; // end of H5Library
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp
index 89a7890..687ff5b 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -15,7 +15,7 @@
#include <iostream>
using namespace std;
-#include "H5private.h" // for HDmemset
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -88,7 +88,8 @@ H5Location::H5Location() : IdComponent() {}
// Modification
// Renamed from exists() in 1.10.2 -BMR
//--------------------------------------------------------------------------
-bool H5Location::nameExists(const char* name, const LinkAccPropList& lapl) const
+bool
+H5Location::nameExists(const char *name, const LinkAccPropList &lapl) const
{
htri_t ret_value = H5Lexists(getId(), name, lapl.getId());
if (ret_value > 0)
@@ -110,9 +111,10 @@ bool H5Location::nameExists(const char* name, const LinkAccPropList& lapl) const
// Modification
// Renamed from exists() in 1.10.2 -BMR
//--------------------------------------------------------------------------
-bool H5Location::nameExists(const H5std_string& name, const LinkAccPropList& lapl) const
+bool
+H5Location::nameExists(const H5std_string &name, const LinkAccPropList &lapl) const
{
- return(nameExists(name.c_str(), lapl));
+ return (nameExists(name.c_str(), lapl));
}
//--------------------------------------------------------------------------
@@ -126,9 +128,10 @@ bool H5Location::nameExists(const H5std_string& name, const LinkAccPropList& lap
// Modification
// Renamed to nameExists() in 1.10.2 -BMR
//--------------------------------------------------------------------------
-bool H5Location::exists(const char* name, const LinkAccPropList& lapl) const
+bool
+H5Location::exists(const char *name, const LinkAccPropList &lapl) const
{
- return(nameExists(name, lapl));
+ return (nameExists(name, lapl));
}
//--------------------------------------------------------------------------
@@ -142,9 +145,10 @@ bool H5Location::exists(const char* name, const LinkAccPropList& lapl) const
// Modification
// Renamed to nameExists() in 1.10.2 -BMR
//--------------------------------------------------------------------------
-bool H5Location::exists(const H5std_string& name, const LinkAccPropList& lapl) const
+bool
+H5Location::exists(const H5std_string &name, const LinkAccPropList &lapl) const
{
- return(nameExists(name.c_str(), lapl));
+ return (nameExists(name.c_str(), lapl));
}
//--------------------------------------------------------------------------
@@ -162,11 +166,11 @@ bool H5Location::exists(const H5std_string& name, const LinkAccPropList& lapl) c
// Sep 2012 - BMR
// Moved from H5File/H5Object
//--------------------------------------------------------------------------
-void H5Location::flush(H5F_scope_t scope) const
+void
+H5Location::flush(H5F_scope_t scope) const
{
herr_t ret_value = H5Fflush(getId(), scope);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw LocationException(inMemFunc("flush"), "H5Fflush failed");
}
}
@@ -179,12 +183,13 @@ void H5Location::flush(H5F_scope_t scope) const
///\exception H5::LocationException
// Programmer Binh-Minh Ribler - Jul, 2004
//--------------------------------------------------------------------------
-H5std_string H5Location::getFileName() const
+H5std_string
+H5Location::getFileName() const
{
try {
- return(p_get_file_name());
+ return (p_get_file_name());
}
- catch (IdComponentException& E) {
+ catch (IdComponentException &E) {
throw LocationException(inMemFunc("getFileName"), E.getDetailMsg());
}
}
@@ -209,7 +214,8 @@ H5std_string H5Location::getFileName() const
// to another class to accommodate attribute, dataset, and named
// datatype. - BMR
//--------------------------------------------------------------------------
-void H5Location::setComment(const char* name, const char* comment) const
+void
+H5Location::setComment(const char *name, const char *comment) const
{
herr_t ret_value = H5Oset_comment_by_name(getId(), name, comment, H5P_DEFAULT);
if (ret_value < 0)
@@ -223,7 +229,8 @@ void H5Location::setComment(const char* name, const char* comment) const
/// \c H5std_string for \a name and \a comment.
// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013)
//--------------------------------------------------------------------------
-void H5Location::setComment(const H5std_string& name, const H5std_string& comment) const
+void
+H5Location::setComment(const H5std_string &name, const H5std_string &comment) const
{
setComment(name.c_str(), comment.c_str());
}
@@ -235,7 +242,8 @@ void H5Location::setComment(const H5std_string& name, const H5std_string& commen
/// an object name.
// Programmer Binh-Minh Ribler - Sep 2013
//--------------------------------------------------------------------------
-void H5Location::setComment(const char* comment) const
+void
+H5Location::setComment(const char *comment) const
{
herr_t ret_value = H5Oset_comment_by_name(getId(), ".", comment, H5P_DEFAULT);
if (ret_value < 0)
@@ -249,7 +257,8 @@ void H5Location::setComment(const char* comment) const
/// \c H5std_string for \a comment.
// Programmer Binh-Minh Ribler - Sep 2013
//--------------------------------------------------------------------------
-void H5Location::setComment(const H5std_string& comment) const
+void
+H5Location::setComment(const H5std_string &comment) const
{
setComment(comment.c_str());
}
@@ -265,7 +274,8 @@ void H5Location::setComment(const H5std_string& comment) const
// to another class to accommodate attribute, dataset, and named
// datatype. - BMR
//--------------------------------------------------------------------------
-void H5Location::removeComment(const char* name) const
+void
+H5Location::removeComment(const char *name) const
{
herr_t ret_value = H5Oset_comment_by_name(getId(), name, NULL, H5P_DEFAULT);
if (ret_value < 0)
@@ -279,9 +289,10 @@ void H5Location::removeComment(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013)
//--------------------------------------------------------------------------
-void H5Location::removeComment(const H5std_string& name) const
+void
+H5Location::removeComment(const H5std_string &name) const
{
- removeComment (name.c_str());
+ removeComment(name.c_str());
}
//--------------------------------------------------------------------------
@@ -299,7 +310,8 @@ void H5Location::removeComment(const H5std_string& name) const
/// will be truncated to accommodate the null terminator.
// Programmer Binh-Minh Ribler - Mar 2014
//--------------------------------------------------------------------------
-ssize_t H5Location::getComment(const char* name, size_t buf_size, char* comment) const
+ssize_t
+H5Location::getComment(const char *name, size_t buf_size, char *comment) const
{
// H5Oget_comment_by_name will get buf_size chars of the comment including
// the null terminator
@@ -307,17 +319,16 @@ ssize_t H5Location::getComment(const char* name, size_t buf_size, char* comment)
comment_len = H5Oget_comment_by_name(getId(), name, comment, buf_size, H5P_DEFAULT);
// If H5Oget_comment_by_name returns a negative value, raise an exception
- if (comment_len < 0)
- {
+ if (comment_len < 0) {
throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed");
}
// If the comment is longer than the provided buffer size, the C library
// will not null terminate it
if (static_cast<size_t>(comment_len) >= buf_size)
- comment[buf_size-1] = '\0';
+ comment[buf_size - 1] = '\0';
// Return the actual comment length, which might be different from buf_size
- return(comment_len);
+ return (comment_len);
}
//--------------------------------------------------------------------------
@@ -330,7 +341,8 @@ ssize_t H5Location::getComment(const char* name, size_t buf_size, char* comment)
///\exception H5::LocationException
// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013)
//--------------------------------------------------------------------------
-H5std_string H5Location::getComment(const char* name, size_t buf_size) const
+H5std_string
+H5Location::getComment(const char *name, size_t buf_size) const
{
// Initialize string to "", so that if there is no comment, the returned
// string will be empty
@@ -340,14 +352,12 @@ H5std_string H5Location::getComment(const char* name, size_t buf_size) const
ssize_t comment_len = H5Oget_comment_by_name(getId(), name, NULL, (size_t)0, H5P_DEFAULT);
// If H5Oget_comment_by_name returns a negative value, raise an exception
- if (comment_len < 0)
- {
+ if (comment_len < 0) {
throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed");
}
// If comment exists, calls C routine again to get it
- else if (comment_len > 0)
- {
+ else if (comment_len > 0) {
size_t tmp_len = buf_size;
// If buffer size is not provided, use comment length
@@ -355,14 +365,13 @@ H5std_string H5Location::getComment(const char* name, size_t buf_size) const
tmp_len = comment_len;
// Temporary buffer for char* comment
- char* comment_C = new char[tmp_len+1];
- HDmemset(comment_C, 0, tmp_len+1); // clear buffer
+ char *comment_C = new char[tmp_len + 1];
+ HDmemset(comment_C, 0, tmp_len + 1); // clear buffer
// Used overloaded function
- ssize_t temp_len = getComment(name, tmp_len+1, comment_C);
- if (temp_len < 0)
- {
- delete []comment_C;
+ ssize_t temp_len = getComment(name, tmp_len + 1, comment_C);
+ if (temp_len < 0) {
+ delete[] comment_C;
throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed");
}
@@ -370,11 +379,11 @@ H5std_string H5Location::getComment(const char* name, size_t buf_size) const
comment = comment_C;
// Clean up resource
- delete []comment_C;
+ delete[] comment_C;
}
// Return the string comment
- return(comment);
+ return (comment);
}
//--------------------------------------------------------------------------
@@ -384,9 +393,10 @@ H5std_string H5Location::getComment(const char* name, size_t buf_size) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013)
//--------------------------------------------------------------------------
-H5std_string H5Location::getComment(const H5std_string& name, size_t buf_size) const
+H5std_string
+H5Location::getComment(const H5std_string &name, size_t buf_size) const
{
- return(getComment(name.c_str(), buf_size));
+ return (getComment(name.c_str(), buf_size));
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -400,11 +410,11 @@ H5std_string H5Location::getComment(const H5std_string& name, size_t buf_size) c
// Exception H5::ReferenceException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-void H5Location::p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const
+void
+H5Location::p_reference(void *ref, const char *name, hid_t space_id, H5R_type_t ref_type) const
{
herr_t ret_value = H5Rcreate(ref, getId(), name, ref_type, space_id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw ReferenceException(inMemFunc("reference"), "H5Rcreate failed");
}
}
@@ -425,12 +435,13 @@ void H5Location::p_reference(void* ref, const char* name, hid_t space_id, H5R_ty
///\note This method is more suitable for a dataset region reference.
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-void H5Location::reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type) const
+void
+H5Location::reference(void *ref, const char *name, const DataSpace &dataspace, H5R_type_t ref_type) const
{
try {
p_reference(ref, name, dataspace.getId(), ref_type);
}
- catch (ReferenceException& E) {
+ catch (ReferenceException &E) {
throw ReferenceException(inMemFunc("reference"), E.getDetailMsg());
}
}
@@ -451,12 +462,14 @@ void H5Location::reference(void* ref, const char* name, const DataSpace& dataspa
///\note This method is more suitable for a dataset region reference.
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-void H5Location::reference(void* ref, const H5std_string& name, const DataSpace& dataspace, H5R_type_t ref_type) const
+void
+H5Location::reference(void *ref, const H5std_string &name, const DataSpace &dataspace,
+ H5R_type_t ref_type) const
{
try {
p_reference(ref, name.c_str(), dataspace.getId(), ref_type);
}
- catch (ReferenceException& E) {
+ catch (ReferenceException &E) {
throw ReferenceException(inMemFunc("reference"), E.getDetailMsg());
}
}
@@ -475,12 +488,13 @@ void H5Location::reference(void* ref, const H5std_string& name, const DataSpace&
///\note This method is more suitable for an object reference.
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-void H5Location::reference(void* ref, const char* name, H5R_type_t ref_type) const
+void
+H5Location::reference(void *ref, const char *name, H5R_type_t ref_type) const
{
try {
p_reference(ref, name, -1, ref_type);
}
- catch (ReferenceException& E) {
+ catch (ReferenceException &E) {
throw ReferenceException(inMemFunc("reference"), E.getDetailMsg());
}
}
@@ -498,9 +512,10 @@ void H5Location::reference(void* ref, const char* name, H5R_type_t ref_type) con
///\note This method is more suitable for an object reference.
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-void H5Location::reference(void* ref, const H5std_string& name, H5R_type_t ref_type) const
+void
+H5Location::reference(void *ref, const H5std_string &name, H5R_type_t ref_type) const
{
- reference(ref, name.c_str(), ref_type);
+ reference(ref, name.c_str(), ref_type);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -517,7 +532,9 @@ void H5Location::reference(void* ref, const H5std_string& name, H5R_type_t ref_t
// Exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
-hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist, const char* from_func)
+hid_t
+H5Location::p_dereference(hid_t loc_id, const void *ref, H5R_type_t ref_type, const PropList &plist,
+ const char *from_func)
{
hid_t plist_id;
if (p_valid_id(plist.getId()))
@@ -526,12 +543,11 @@ hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_ty
plist_id = H5P_DEFAULT;
hid_t temp_id = H5Rdereference2(loc_id, plist_id, ref_type, ref);
- if (temp_id < 0)
- {
+ if (temp_id < 0) {
throw ReferenceException(inMemFunc(from_func), "H5Rdereference2 failed");
}
- return(temp_id);
+ return (temp_id);
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -545,7 +561,8 @@ hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_ty
///\exception H5::ReferenceException
// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
-void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist)
+void
+H5Location::dereference(const H5Location &loc, const void *ref, H5R_type_t ref_type, const PropList &plist)
{
p_setId(p_dereference(loc.getId(), ref, ref_type, plist, "dereference"));
}
@@ -564,11 +581,12 @@ void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t
// Removed in 1.10.1 because H5Location is Attribute's baseclass
// now. -BMR
//--------------------------------------------------------------------------
- /* void H5Location::dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist)
+/* void H5Location::dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList&
+plist)
{
- p_setId(p_dereference(attr.getId(), ref, ref_type, plist, "dereference"));
+ p_setId(p_dereference(attr.getId(), ref, ref_type, plist, "dereference"));
}
- */
+*/
#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
@@ -590,12 +608,13 @@ void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t
// Modification
// Sep 2012: Moved up from H5File, Group, DataSet, and DataType
//--------------------------------------------------------------------------
-H5G_obj_t H5Location::getObjType(void *ref, H5R_type_t ref_type) const
+H5G_obj_t
+H5Location::getObjType(void *ref, H5R_type_t ref_type) const
{
try {
- return(p_get_obj_type(ref, ref_type));
+ return (p_get_obj_type(ref, ref_type));
}
- catch (ReferenceException& E) {
+ catch (ReferenceException &E) {
throw ReferenceException(inMemFunc("getObjType"), E.getDetailMsg());
}
}
@@ -617,14 +636,14 @@ H5G_obj_t H5Location::getObjType(void *ref, H5R_type_t ref_type) const
// Exception H5::ReferenceException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const
+H5G_obj_t
+H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const
{
- H5G_obj_t obj_type = H5Rget_obj_type1(getId(), ref_type, ref);
- if (obj_type == H5G_UNKNOWN)
- {
+ H5G_obj_t obj_type = H5Rget_obj_type1(getId(), ref_type, ref);
+ if (obj_type == H5G_UNKNOWN) {
throw ReferenceException(inMemFunc("getObjType"), "H5Rget_obj_type1 failed");
}
- return(obj_type);
+ return (obj_type);
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -645,12 +664,13 @@ H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const
///\exception H5::ReferenceException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const
+H5O_type_t
+H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const
{
try {
- return(p_get_ref_obj_type(ref, ref_type));
+ return (p_get_ref_obj_type(ref, ref_type));
}
- catch (ReferenceException& E) {
+ catch (ReferenceException &E) {
throw ReferenceException(inMemFunc("getRefObjType"), E.getDetailMsg());
}
}
@@ -671,22 +691,20 @@ H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const
// Exception H5::ReferenceException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const
+H5O_type_t
+H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const
{
- H5O_type_t obj_type = H5O_TYPE_UNKNOWN;
- herr_t ret_value = H5Rget_obj_type2(getId(), ref_type, ref, &obj_type);
- if (ret_value < 0)
- {
+ H5O_type_t obj_type = H5O_TYPE_UNKNOWN;
+ herr_t ret_value = H5Rget_obj_type2(getId(), ref_type, ref, &obj_type);
+ if (ret_value < 0) {
throw ReferenceException(inMemFunc("getRefObjType"), "H5Rget_obj_type2 failed");
}
- if (obj_type == H5O_TYPE_UNKNOWN || obj_type >= H5O_TYPE_NTYPES)
- {
+ if (obj_type == H5O_TYPE_UNKNOWN || obj_type >= H5O_TYPE_NTYPES) {
throw ReferenceException(inMemFunc("getRefObjType"), "H5Rget_obj_type2 returned invalid type");
}
- return(obj_type);
+ return (obj_type);
}
-
//--------------------------------------------------------------------------
// Function: H5Location::getRegion
///\brief Retrieves a dataspace with the region pointed to selected.
@@ -703,24 +721,23 @@ H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const
// ref count, as a work-around for a problem described in the JIRA
// issue HDFFV-7947. -BMR
//--------------------------------------------------------------------------
-DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const
+DataSpace
+H5Location::getRegion(void *ref, H5R_type_t ref_type) const
{
hid_t space_id = H5Rget_region(getId(), ref_type, ref);
- if (space_id < 0)
- {
+ if (space_id < 0) {
throw ReferenceException(inMemFunc("getRegion"), "H5Rget_region failed");
}
try {
DataSpace dataspace;
f_DataSpace_setId(&dataspace, space_id);
- return(dataspace);
+ return (dataspace);
}
- catch (DataSpaceIException& E) {
+ catch (DataSpaceIException &E) {
throw ReferenceException(inMemFunc("getRegion"), E.getDetailMsg());
}
}
-
// From H5CommonFG.cpp
// Notes with "***Updated" are new and for Group.cpp
// Original notes are from December 2000
@@ -768,7 +785,8 @@ DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const
/// then a default size is chosen.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group H5Location::createGroup(const char* name, const LinkCreatPropList& lcpl) const
+Group
+H5Location::createGroup(const char *name, const LinkCreatPropList &lcpl) const
{
// Call C routine H5Gcreate2 to create the named group, giving the
// location id which can be a file id or a group id
@@ -779,10 +797,10 @@ Group H5Location::createGroup(const char* name, const LinkCreatPropList& lcpl) c
throwException("createGroup", "H5Gcreate2 failed");
// No failure, create and return the Group object
- Group group;
+ Group group;
H5Location *ptr = &group;
ptr->p_setId(group_id);
- return(group);
+ return (group);
}
//--------------------------------------------------------------------------
@@ -792,9 +810,10 @@ Group H5Location::createGroup(const char* name, const LinkCreatPropList& lcpl) c
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group H5Location::createGroup(const H5std_string& name, const LinkCreatPropList& lcpl) const
+Group
+H5Location::createGroup(const H5std_string &name, const LinkCreatPropList &lcpl) const
{
- return(createGroup( name.c_str(), lcpl));
+ return (createGroup(name.c_str(), lcpl));
}
//--------------------------------------------------------------------------
@@ -813,22 +832,22 @@ Group H5Location::createGroup(const H5std_string& name, const LinkCreatPropList&
/// then a default size is chosen.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group H5Location::createGroup(const char* name, size_t size_hint) const
+Group
+H5Location::createGroup(const char *name, size_t size_hint) const
{
// Group creation property list for size hint
hid_t gcpl_id = 0;
// Set the local heap size hint
- if (size_hint > 0)
- {
- // If the creation of the property list failed, throw an exception
- if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
- throwException("createGroup", "H5Pcreate failed");
-
- if (H5Pset_local_heap_size_hint(gcpl_id, size_hint) < 0) {
- H5Pclose(gcpl_id);
- throwException("createGroup", "H5Pset_local_heap_size_hint failed");
- }
+ if (size_hint > 0) {
+ // If the creation of the property list failed, throw an exception
+ if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ throwException("createGroup", "H5Pcreate failed");
+
+ if (H5Pset_local_heap_size_hint(gcpl_id, size_hint) < 0) {
+ H5Pclose(gcpl_id);
+ throwException("createGroup", "H5Pset_local_heap_size_hint failed");
+ }
}
// Call C routine H5Gcreate2 to create the named group, giving the
@@ -836,18 +855,18 @@ Group H5Location::createGroup(const char* name, size_t size_hint) const
hid_t group_id = H5Gcreate2(getId(), name, H5P_DEFAULT, gcpl_id, H5P_DEFAULT);
// Close the group creation property list, if necessary
- if(gcpl_id > 0)
- H5Pclose(gcpl_id);
+ if (gcpl_id > 0)
+ H5Pclose(gcpl_id);
// If the creation of the group failed, throw an exception
if (group_id < 0)
throwException("createGroup", "H5Gcreate2 failed");
// No failure, create and return the Group object
- Group group;
+ Group group;
H5Location *ptr = &group;
ptr->p_setId(group_id);
- return(group);
+ return (group);
}
//--------------------------------------------------------------------------
@@ -857,9 +876,10 @@ Group H5Location::createGroup(const char* name, size_t size_hint) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group H5Location::createGroup(const H5std_string& name, size_t size_hint) const
+Group
+H5Location::createGroup(const H5std_string &name, size_t size_hint) const
{
- return(createGroup( name.c_str(), size_hint));
+ return (createGroup(name.c_str(), size_hint));
}
//--------------------------------------------------------------------------
@@ -871,7 +891,8 @@ Group H5Location::createGroup(const H5std_string& name, size_t size_hint) const
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group H5Location::openGroup(const char* name) const
+Group
+H5Location::openGroup(const char *name) const
{
// Call C routine H5Gopen2 to open the named group, giving the
// location id which can be a file id or a group id
@@ -883,10 +904,10 @@ Group H5Location::openGroup(const char* name) const
// No failure, create and return the Group object
Group group;
- //group.p_setId(group_id);
+ // group.p_setId(group_id);
H5Location *ptr = &group;
ptr->p_setId(group_id);
- return(group);
+ return (group);
}
//--------------------------------------------------------------------------
@@ -896,9 +917,10 @@ Group H5Location::openGroup(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group H5Location::openGroup(const H5std_string& name) const
+Group
+H5Location::openGroup(const H5std_string &name) const
{
- return(openGroup( name.c_str()));
+ return (openGroup(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -919,14 +941,17 @@ Group H5Location::openGroup(const H5std_string& name) const
// follow the order in the C function: lcpl, dcpl, dapl, to
// accommodate the existing createDataSet calls.
//--------------------------------------------------------------------------
-DataSet H5Location::createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& dcpl, const DSetAccPropList& dapl, const LinkCreatPropList& lcpl) const
+DataSet
+H5Location::createDataSet(const char *name, const DataType &data_type, const DataSpace &data_space,
+ const DSetCreatPropList &dcpl, const DSetAccPropList &dapl,
+ const LinkCreatPropList &lcpl) const
{
- // Obtain identifiers for C API
- hid_t type_id = data_type.getId();
+ // Obtain identifiers for C API
+ hid_t type_id = data_type.getId();
hid_t space_id = data_space.getId();
- hid_t dcpl_id = dcpl.getId();
- hid_t lcpl_id = lcpl.getId();
- hid_t dapl_id = dapl.getId();
+ hid_t dcpl_id = dcpl.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t dapl_id = dapl.getId();
// Call C routine H5Dcreate2 to create the named dataset
hid_t dataset_id = H5Dcreate2(getId(), name, type_id, space_id, lcpl_id, dcpl_id, dapl_id);
@@ -938,7 +963,7 @@ DataSet H5Location::createDataSet(const char* name, const DataType& data_type, c
// No failure, create and return the DataSet object
DataSet dataset;
f_DataSet_setId(&dataset, dataset_id);
- return(dataset);
+ return (dataset);
}
//--------------------------------------------------------------------------
@@ -953,9 +978,12 @@ DataSet H5Location::createDataSet(const char* name, const DataType& data_type, c
// follow the order in the C function: lcpl, dcpl, dapl, to
// accommodate the existing createDataSet calls.
//--------------------------------------------------------------------------
-DataSet H5Location::createDataSet(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& dcpl, const DSetAccPropList& dapl, const LinkCreatPropList& lcpl) const
+DataSet
+H5Location::createDataSet(const H5std_string &name, const DataType &data_type, const DataSpace &data_space,
+ const DSetCreatPropList &dcpl, const DSetAccPropList &dapl,
+ const LinkCreatPropList &lcpl) const
{
- return(createDataSet(name.c_str(), data_type, data_space, dcpl, dapl, lcpl));
+ return (createDataSet(name.c_str(), data_type, data_space, dcpl, dapl, lcpl));
}
//--------------------------------------------------------------------------
@@ -969,21 +997,22 @@ DataSet H5Location::createDataSet(const H5std_string& name, const DataType& data
// Jul 2018
// Added DSetAccPropList argument
//--------------------------------------------------------------------------
-DataSet H5Location::openDataSet(const char* name, const DSetAccPropList& dapl) const
+DataSet
+H5Location::openDataSet(const char *name, const DSetAccPropList &dapl) const
{
// Call C function H5Dopen2 to open the specified dataset, giving
// the location id and the dataset's name
- hid_t dapl_id = dapl.getId();
+ hid_t dapl_id = dapl.getId();
hid_t dataset_id = H5Dopen2(getId(), name, dapl_id);
// If the dataset's opening failed, throw an exception
- if(dataset_id < 0)
+ if (dataset_id < 0)
throwException("openDataSet", "H5Dopen2 failed");
// No failure, create and return the DataSet object
DataSet dataset;
f_DataSet_setId(&dataset, dataset_id);
- return(dataset);
+ return (dataset);
}
//--------------------------------------------------------------------------
@@ -996,9 +1025,10 @@ DataSet H5Location::openDataSet(const char* name, const DSetAccPropList& dapl) c
// Jul 2018
// Added DSetAccPropList argument
//--------------------------------------------------------------------------
-DataSet H5Location::openDataSet(const H5std_string& name, const DSetAccPropList& dapl) const
+DataSet
+H5Location::openDataSet(const H5std_string &name, const DSetAccPropList &dapl) const
{
- return(openDataSet(name.c_str(), dapl));
+ return (openDataSet(name.c_str(), dapl));
}
//--------------------------------------------------------------------------
@@ -1016,12 +1046,13 @@ DataSet H5Location::openDataSet(const H5std_string& name, const DSetAccPropList&
/// H5Lcreate_soft APIs in the HDF5 C Reference Manual.
// March 2018
//--------------------------------------------------------------------------
-void H5Location::link(const char *target_name, const char *link_name,
- const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void
+H5Location::link(const char *target_name, const char *link_name, const LinkCreatPropList &lcpl,
+ const LinkAccPropList &lapl) const
{
herr_t ret_value = -1;
- hid_t lcpl_id = lcpl.getId();
- hid_t lapl_id = lapl.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
ret_value = H5Lcreate_soft(target_name, getId(), link_name, lcpl_id, lapl_id);
if (ret_value < 0)
@@ -1036,8 +1067,9 @@ void H5Location::link(const char *target_name, const char *link_name,
///\exception H5::FileIException or H5::GroupIException
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::link(const H5std_string& target_name, const H5std_string&
- link_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void
+H5Location::link(const H5std_string &target_name, const H5std_string &link_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
link(target_name.c_str(), link_name.c_str(), lcpl, lapl);
}
@@ -1058,16 +1090,17 @@ void H5Location::link(const H5std_string& target_name, const H5std_string&
/// H5Lcreate_hard APIs in the HDF5 C Reference Manual.
// March 2018
//--------------------------------------------------------------------------
-void H5Location::link(const char *curr_name, const Group& new_loc,
- const char *new_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void
+H5Location::link(const char *curr_name, const Group &new_loc, const char *new_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
- herr_t ret_value = -1;
- hid_t new_loc_id = new_loc.getId();
- hid_t lcpl_id = lcpl.getId();
- hid_t lapl_id = lapl.getId();
+ herr_t ret_value = -1;
+ hid_t new_loc_id = new_loc.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
ret_value = H5Lcreate_hard(getId(), curr_name, new_loc_id, new_name, lcpl_id, lapl_id);
- if (ret_value < 0)
+ if (ret_value < 0)
throwException("link", "creating link failed");
}
@@ -1079,8 +1112,9 @@ void H5Location::link(const char *curr_name, const Group& new_loc,
///\exception H5::FileIException or H5::GroupIException
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::link(const H5std_string& curr_name, const Group& new_loc,
- const H5std_string& new_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void
+H5Location::link(const H5std_string &curr_name, const Group &new_loc, const H5std_string &new_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
link(curr_name.c_str(), new_loc, new_name.c_str(), lcpl, lapl);
}
@@ -1102,15 +1136,17 @@ void H5Location::link(const H5std_string& curr_name, const Group& new_loc,
/// H5Lcreate_hard APIs in the HDF5 C Reference Manual.
// March 2018
//--------------------------------------------------------------------------
-void H5Location::link(const char *curr_name, const hid_t same_loc, const char *new_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void
+H5Location::link(const char *curr_name, const hid_t same_loc, const char *new_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
herr_t ret_value = -1;
- hid_t lcpl_id = lcpl.getId();
- hid_t lapl_id = lapl.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
ret_value = H5Lcreate_hard(getId(), curr_name, same_loc, new_name, lcpl_id, lapl_id);
- if (ret_value < 0)
+ if (ret_value < 0)
throwException("link", "creating link failed");
}
@@ -1122,8 +1158,9 @@ void H5Location::link(const char *curr_name, const hid_t same_loc, const char *n
///\exception H5::FileIException or H5::GroupIException
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::link(const H5std_string& curr_name, const hid_t same_loc,
- const H5std_string& new_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void
+H5Location::link(const H5std_string &curr_name, const hid_t same_loc, const H5std_string &new_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
link(curr_name.c_str(), same_loc, new_name.c_str(), lcpl, lapl);
}
@@ -1152,17 +1189,18 @@ void H5Location::link(const H5std_string& curr_name, const hid_t same_loc,
// H5L_SAME_LOC. This function will be retired in favor of
// its replacement. - BMR
//--------------------------------------------------------------------------
-void H5Location::link(H5L_type_t link_type, const char* curr_name, const char* new_name) const
+void
+H5Location::link(H5L_type_t link_type, const char *curr_name, const char *new_name) const
{
herr_t ret_value = -1;
- switch(link_type) {
+ switch (link_type) {
case H5L_TYPE_HARD:
ret_value = H5Lcreate_hard(getId(), curr_name, H5L_SAME_LOC, new_name, H5P_DEFAULT, H5P_DEFAULT);
break;
case H5L_TYPE_SOFT:
- ret_value = H5Lcreate_soft(curr_name,getId(), new_name, H5P_DEFAULT, H5P_DEFAULT);
+ ret_value = H5Lcreate_soft(curr_name, getId(), new_name, H5P_DEFAULT, H5P_DEFAULT);
break;
case H5L_TYPE_ERROR:
@@ -1173,7 +1211,7 @@ void H5Location::link(H5L_type_t link_type, const char* curr_name, const char* n
break;
} /* end switch */
- if (ret_value < 0)
+ if (ret_value < 0)
throwException("link", "creating link failed");
}
@@ -1184,7 +1222,8 @@ void H5Location::link(H5L_type_t link_type, const char* curr_name, const char* n
/// \c H5std_string for \a curr_name and \a new_name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Location::link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const
+void
+H5Location::link(H5L_type_t link_type, const H5std_string &curr_name, const H5std_string &new_name) const
{
link(link_type, curr_name.c_str(), new_name.c_str());
}
@@ -1200,17 +1239,17 @@ void H5Location::link(H5L_type_t link_type, const H5std_string& curr_name, const
///\exception H5::FileIException or H5::GroupIException
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::copyLink(const char *src_name,
- const Group& dst, const char *dst_name, const LinkCreatPropList& lcpl,
- const LinkAccPropList& lapl) const
+void
+H5Location::copyLink(const char *src_name, const Group &dst, const char *dst_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
herr_t ret_value;
- hid_t dst_id = dst.getId();
- hid_t lcpl_id = lcpl.getId();
- hid_t lapl_id = lapl.getId();
+ hid_t dst_id = dst.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
ret_value = H5Lcopy(getId(), src_name, dst_id, dst_name, lcpl_id, lapl_id);
- if(ret_value < 0)
+ if (ret_value < 0)
throwException("copyLink", "H5Lcopy failed");
}
@@ -1222,9 +1261,9 @@ void H5Location::copyLink(const char *src_name,
///\exception H5::FileIException or H5::GroupIException
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::copyLink(const H5std_string& src_name,
- const Group& dst, const H5std_string& dst_name, const LinkCreatPropList& lcpl,
- const LinkAccPropList& lapl) const
+void
+H5Location::copyLink(const H5std_string &src_name, const Group &dst, const H5std_string &dst_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
copyLink(src_name.c_str(), dst, dst_name.c_str(), lcpl, lapl);
}
@@ -1239,16 +1278,16 @@ void H5Location::copyLink(const H5std_string& src_name,
///\exception H5::FileIException or H5::GroupIException
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::copyLink(const char *src_name,
- const char *dst_name, const LinkCreatPropList& lcpl,
- const LinkAccPropList& lapl) const
+void
+H5Location::copyLink(const char *src_name, const char *dst_name, const LinkCreatPropList &lcpl,
+ const LinkAccPropList &lapl) const
{
herr_t ret_value;
- hid_t lcpl_id = lcpl.getId();
- hid_t lapl_id = lapl.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
ret_value = H5Lcopy(getId(), src_name, H5L_SAME_LOC, dst_name, lcpl_id, lapl_id);
- if(ret_value < 0)
+ if (ret_value < 0)
throwException("copyLink", "H5Lcopy H5L_SAME_LOC failed");
}
@@ -1260,9 +1299,9 @@ void H5Location::copyLink(const char *src_name,
///\exception H5::FileIException or H5::GroupIException
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::copyLink(const H5std_string& src_name,
- const H5std_string& dst_name, const LinkCreatPropList& lcpl,
- const LinkAccPropList& lapl) const
+void
+H5Location::copyLink(const H5std_string &src_name, const H5std_string &dst_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
copyLink(src_name.c_str(), dst_name.c_str(), lcpl, lapl);
}
@@ -1282,12 +1321,14 @@ void H5Location::copyLink(const H5std_string& src_name,
/// to the Group Interface in the HDF5 User's Guide for details.
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::moveLink(const char* src_name, const Group& dst, const char* dst_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void
+H5Location::moveLink(const char *src_name, const Group &dst, const char *dst_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
herr_t ret_value;
- hid_t dst_id = dst.getId();
- hid_t lcpl_id = lcpl.getId();
- hid_t lapl_id = lapl.getId();
+ hid_t dst_id = dst.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
ret_value = H5Lmove(getId(), src_name, dst_id, dst_name, lcpl_id, lapl_id);
if (ret_value < 0)
@@ -1302,7 +1343,9 @@ void H5Location::moveLink(const char* src_name, const Group& dst, const char* ds
///\exception H5::FileIException or H5::GroupIException
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::moveLink(const H5std_string& src_name, const Group& dst, const H5std_string& dst_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void
+H5Location::moveLink(const H5std_string &src_name, const Group &dst, const H5std_string &dst_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
moveLink(src_name.c_str(), dst, dst_name.c_str(), lcpl, lapl);
}
@@ -1321,11 +1364,13 @@ void H5Location::moveLink(const H5std_string& src_name, const Group& dst, const
/// to the Group Interface in the HDF5 User's Guide for details.
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::moveLink(const char* src_name, const char* dst_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void
+H5Location::moveLink(const char *src_name, const char *dst_name, const LinkCreatPropList &lcpl,
+ const LinkAccPropList &lapl) const
{
herr_t ret_value;
- hid_t lcpl_id = lcpl.getId();
- hid_t lapl_id = lapl.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
ret_value = H5Lmove(getId(), src_name, H5L_SAME_LOC, dst_name, lcpl_id, lapl_id);
if (ret_value < 0)
@@ -1340,7 +1385,9 @@ void H5Location::moveLink(const char* src_name, const char* dst_name, const Link
///\exception H5::FileIException or H5::GroupIException
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::moveLink(const H5std_string& src_name, const H5std_string& dst_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+void
+H5Location::moveLink(const H5std_string &src_name, const H5std_string &dst_name,
+ const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const
{
moveLink(src_name.c_str(), dst_name.c_str(), lcpl, lapl);
}
@@ -1359,7 +1406,8 @@ void H5Location::moveLink(const H5std_string& src_name, const H5std_string& dst_
// 2007: QAK modified to use H5L APIs - BMR
// 2018: Will be replaced by H5Location::moveLink() -BMR
//--------------------------------------------------------------------------
-void H5Location::move(const char* src, const char* dst) const
+void
+H5Location::move(const char *src, const char *dst) const
{
moveLink(src, dst, LinkCreatPropList::DEFAULT, LinkAccPropList::DEFAULT);
}
@@ -1372,7 +1420,8 @@ void H5Location::move(const char* src, const char* dst) const
// Modification
// 2018: Will be replaced by H5Location::moveLink() -BMR
//--------------------------------------------------------------------------
-void H5Location::move(const H5std_string& src, const H5std_string& dst) const
+void
+H5Location::move(const H5std_string &src, const H5std_string &dst) const
{
moveLink(src.c_str(), dst.c_str(), LinkCreatPropList::DEFAULT, LinkAccPropList::DEFAULT);
}
@@ -1384,7 +1433,8 @@ void H5Location::move(const H5std_string& src, const H5std_string& dst) const
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::unlink(const char* name, const LinkAccPropList& lapl) const
+void
+H5Location::unlink(const char *name, const LinkAccPropList &lapl) const
{
herr_t ret_value = H5Ldelete(getId(), name, lapl.getId());
if (ret_value < 0)
@@ -1398,7 +1448,8 @@ void H5Location::unlink(const char* name, const LinkAccPropList& lapl) const
/// \c H5std_string for \a name.
// March, 2018
//--------------------------------------------------------------------------
-void H5Location::unlink(const H5std_string& name, const LinkAccPropList& lapl) const
+void
+H5Location::unlink(const H5std_string &name, const LinkAccPropList &lapl) const
{
unlink(name.c_str(), lapl);
}
@@ -1415,7 +1466,8 @@ void H5Location::unlink(const H5std_string& name, const LinkAccPropList& lapl) c
/// \li \c H5O_INFO_ALL
// July, 2018
//--------------------------------------------------------------------------
-void H5Location::getNativeObjinfo(H5O_native_info_t& objinfo, unsigned fields) const
+void
+H5Location::getNativeObjinfo(H5O_native_info_t &objinfo, unsigned fields) const
{
// Use C API to get information of the object
@@ -1441,7 +1493,9 @@ void H5Location::getNativeObjinfo(H5O_native_info_t& objinfo, unsigned fields) c
/// \li \c H5O_INFO_ALL
// July, 2018
//--------------------------------------------------------------------------
-void H5Location::getNativeObjinfo(const char* name, H5O_native_info_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const
+void
+H5Location::getNativeObjinfo(const char *name, H5O_native_info_t &objinfo, unsigned fields,
+ const LinkAccPropList &lapl) const
{
// Use C API to get information of the object
herr_t ret_value = H5Oget_native_info_by_name(getId(), name, &objinfo, fields, lapl.getId());
@@ -1463,7 +1517,9 @@ void H5Location::getNativeObjinfo(const char* name, H5O_native_info_t& objinfo,
///\param lapl - IN: Link access property list
// July, 2018
//--------------------------------------------------------------------------
-void H5Location::getNativeObjinfo(const H5std_string& name, H5O_native_info_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const
+void
+H5Location::getNativeObjinfo(const H5std_string &name, H5O_native_info_t &objinfo, unsigned fields,
+ const LinkAccPropList &lapl) const
{
getNativeObjinfo(name.c_str(), objinfo, fields, lapl);
}
@@ -1486,13 +1542,13 @@ void H5Location::getNativeObjinfo(const H5std_string& name, H5O_native_info_t& o
/// \li \c H5O_INFO_ALL
// July, 2018
//--------------------------------------------------------------------------
-void H5Location::getNativeObjinfo(const char* grp_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, H5O_native_info_t& objinfo, unsigned fields,
- const LinkAccPropList& lapl) const
+void
+H5Location::getNativeObjinfo(const char *grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx,
+ H5O_native_info_t &objinfo, unsigned fields, const LinkAccPropList &lapl) const
{
// Use C API to get information of the object
- herr_t ret_value = H5Oget_native_info_by_idx(getId(), grp_name, idx_type, order,
- idx, &objinfo, fields, lapl.getId());
+ herr_t ret_value =
+ H5Oget_native_info_by_idx(getId(), grp_name, idx_type, order, idx, &objinfo, fields, lapl.getId());
// Throw exception if C API returns failure
if (ret_value < 0)
@@ -1511,9 +1567,10 @@ void H5Location::getNativeObjinfo(const char* grp_name, H5_index_t idx_type,
///\param lapl - IN: Link access property list
// July, 2018
//--------------------------------------------------------------------------
-void H5Location::getNativeObjinfo(const H5std_string& grp_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, H5O_native_info_t& objinfo, unsigned fields,
- const LinkAccPropList& lapl) const
+void
+H5Location::getNativeObjinfo(const H5std_string &grp_name, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t idx, H5O_native_info_t &objinfo, unsigned fields,
+ const LinkAccPropList &lapl) const
{
getNativeObjinfo(grp_name.c_str(), idx_type, order, idx, objinfo, fields, lapl);
}
@@ -1533,7 +1590,8 @@ void H5Location::getNativeObjinfo(const H5std_string& grp_name, H5_index_t idx_t
/// \li \c H5O_INFO_ALL
// July, 2018
//--------------------------------------------------------------------------
-void H5Location::getObjinfo(H5O_info2_t& objinfo, unsigned fields) const
+void
+H5Location::getObjinfo(H5O_info2_t &objinfo, unsigned fields) const
{
// Use C API to get information of the object
@@ -1562,7 +1620,9 @@ void H5Location::getObjinfo(H5O_info2_t& objinfo, unsigned fields) const
/// \li \c H5O_INFO_ALL
// July, 2018
//--------------------------------------------------------------------------
-void H5Location::getObjinfo(const char* name, H5O_info2_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const
+void
+H5Location::getObjinfo(const char *name, H5O_info2_t &objinfo, unsigned fields,
+ const LinkAccPropList &lapl) const
{
// Use C API to get information of the object
herr_t ret_value = H5Oget_info_by_name3(getId(), name, &objinfo, fields, lapl.getId());
@@ -1584,7 +1644,9 @@ void H5Location::getObjinfo(const char* name, H5O_info2_t& objinfo, unsigned fie
///\param lapl - IN: Link access property list
// July, 2018
//--------------------------------------------------------------------------
-void H5Location::getObjinfo(const H5std_string& name, H5O_info2_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const
+void
+H5Location::getObjinfo(const H5std_string &name, H5O_info2_t &objinfo, unsigned fields,
+ const LinkAccPropList &lapl) const
{
getObjinfo(name.c_str(), objinfo, fields, lapl);
}
@@ -1610,13 +1672,13 @@ void H5Location::getObjinfo(const H5std_string& name, H5O_info2_t& objinfo, unsi
/// \li \c H5O_INFO_ALL
// July, 2018
//--------------------------------------------------------------------------
-void H5Location::getObjinfo(const char* grp_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, H5O_info2_t& objinfo, unsigned fields,
- const LinkAccPropList& lapl) const
+void
+H5Location::getObjinfo(const char *grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx,
+ H5O_info2_t &objinfo, unsigned fields, const LinkAccPropList &lapl) const
{
// Use C API to get information of the object
- herr_t ret_value = H5Oget_info_by_idx3(getId(), grp_name, idx_type, order,
- idx, &objinfo, fields, lapl.getId());
+ herr_t ret_value =
+ H5Oget_info_by_idx3(getId(), grp_name, idx_type, order, idx, &objinfo, fields, lapl.getId());
// Throw exception if C API returns failure
if (ret_value < 0)
@@ -1635,9 +1697,9 @@ void H5Location::getObjinfo(const char* grp_name, H5_index_t idx_type,
///\param lapl - IN: Link access property list
// July, 2018
//--------------------------------------------------------------------------
-void H5Location::getObjinfo(const H5std_string& grp_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, H5O_info2_t& objinfo, unsigned fields,
- const LinkAccPropList& lapl) const
+void
+H5Location::getObjinfo(const H5std_string &grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx,
+ H5O_info2_t &objinfo, unsigned fields, const LinkAccPropList &lapl) const
{
getObjinfo(grp_name.c_str(), idx_type, order, idx, objinfo, fields, lapl);
}
@@ -1655,7 +1717,8 @@ void H5Location::getObjinfo(const H5std_string& grp_name, H5_index_t idx_type,
/// the HDF5 C Reference Manual.
// 2000
//--------------------------------------------------------------------------
-void H5Location::getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const
+void
+H5Location::getObjinfo(const char *name, hbool_t follow_link, H5G_stat_t &statbuf) const
{
herr_t ret_value = H5Gget_objinfo(getId(), name, follow_link, &statbuf);
if (ret_value < 0)
@@ -1669,7 +1732,8 @@ void H5Location::getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& s
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Location::getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf) const
+void
+H5Location::getObjinfo(const H5std_string &name, hbool_t follow_link, H5G_stat_t &statbuf) const
{
getObjinfo(name.c_str(), follow_link, statbuf);
}
@@ -1681,7 +1745,8 @@ void H5Location::getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_s
/// the paramemter \a follow_link.
// Nov, 2005
//--------------------------------------------------------------------------
-void H5Location::getObjinfo(const char* name, H5G_stat_t& statbuf) const
+void
+H5Location::getObjinfo(const char *name, H5G_stat_t &statbuf) const
{
herr_t ret_value = H5Gget_objinfo(getId(), name, 0, &statbuf);
if (ret_value < 0)
@@ -1695,7 +1760,8 @@ void H5Location::getObjinfo(const char* name, H5G_stat_t& statbuf) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - Nov, 2005
//--------------------------------------------------------------------------
-void H5Location::getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const
+void
+H5Location::getObjinfo(const H5std_string &name, H5G_stat_t &statbuf) const
{
getObjinfo(name.c_str(), statbuf);
}
@@ -1711,7 +1777,8 @@ void H5Location::getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
// 2000
//--------------------------------------------------------------------------
-H5L_info2_t H5Location::getLinkInfo(const char* link_name, const LinkAccPropList& lapl) const
+H5L_info2_t
+H5Location::getLinkInfo(const char *link_name, const LinkAccPropList &lapl) const
{
H5L_info2_t linkinfo; // link info structure
@@ -1719,7 +1786,7 @@ H5L_info2_t H5Location::getLinkInfo(const char* link_name, const LinkAccPropList
if (ret_value < 0)
throwException("getLinkInfo", "H5Lget_info to find buffer size failed");
- return(linkinfo);
+ return (linkinfo);
}
//--------------------------------------------------------------------------
@@ -1728,9 +1795,10 @@ H5L_info2_t H5Location::getLinkInfo(const char* link_name, const LinkAccPropList
/// It differs from the above function in that it takes an
/// \c H5std_string for \a link_name.
//--------------------------------------------------------------------------
-H5L_info2_t H5Location::getLinkInfo(const H5std_string& link_name, const LinkAccPropList& lapl) const
+H5L_info2_t
+H5Location::getLinkInfo(const H5std_string &link_name, const LinkAccPropList &lapl) const
{
- return(getLinkInfo(link_name.c_str(), lapl));
+ return (getLinkInfo(link_name.c_str(), lapl));
}
//--------------------------------------------------------------------------
@@ -1742,17 +1810,17 @@ H5L_info2_t H5Location::getLinkInfo(const H5std_string& link_name, const LinkAcc
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
// 2000
//--------------------------------------------------------------------------
-H5std_string H5Location::getLinkval(const char* name, size_t size) const
+H5std_string
+H5Location::getLinkval(const char *name, size_t size) const
{
- H5L_info2_t linkinfo;
- char *value_C; // value in C string
- size_t val_size = size;
- H5std_string value = "";
- herr_t ret_value;
+ H5L_info2_t linkinfo;
+ char * value_C; // value in C string
+ size_t val_size = size;
+ H5std_string value = "";
+ herr_t ret_value;
// if user doesn't provide buffer size, determine it
- if (size == 0)
- {
+ if (size == 0) {
ret_value = H5Lget_info2(getId(), name, &linkinfo, H5P_DEFAULT);
if (ret_value < 0)
throwException("getLinkval", "H5Lget_info to find buffer size failed");
@@ -1761,22 +1829,20 @@ H5std_string H5Location::getLinkval(const char* name, size_t size) const
}
// if link has value, retrieve the value, otherwise, return null string
- if (val_size > 0)
- {
- value_C = new char[val_size+1]; // temporary C-string for C API
- HDmemset(value_C, 0, val_size+1); // clear buffer
+ if (val_size > 0) {
+ value_C = new char[val_size + 1]; // temporary C-string for C API
+ HDmemset(value_C, 0, val_size + 1); // clear buffer
ret_value = H5Lget_val(getId(), name, value_C, val_size, H5P_DEFAULT);
- if (ret_value < 0)
- {
- delete []value_C;
+ if (ret_value < 0) {
+ delete[] value_C;
throwException("getLinkval", "H5Lget_val failed");
}
value = H5std_string(value_C);
- delete []value_C;
+ delete[] value_C;
}
- return(value);
+ return (value);
}
//--------------------------------------------------------------------------
@@ -1786,9 +1852,10 @@ H5std_string H5Location::getLinkval(const char* name, size_t size) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string H5Location::getLinkval(const H5std_string& name, size_t size) const
+H5std_string
+H5Location::getLinkval(const H5std_string &name, size_t size) const
{
- return(getLinkval( name.c_str(), size));
+ return (getLinkval(name.c_str(), size));
}
//--------------------------------------------------------------------------
@@ -1800,7 +1867,8 @@ H5std_string H5Location::getLinkval(const H5std_string& name, size_t size) const
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - 2014 (original 2000)
//--------------------------------------------------------------------------
-void H5Location::mount(const char* name, const H5File& child, const PropList& plist) const
+void
+H5Location::mount(const char *name, const H5File &child, const PropList &plist) const
{
// Obtain identifiers for C API
hid_t plist_id = plist.getId();
@@ -1829,7 +1897,7 @@ void H5Location::mount(const char* name, const H5File& child, const PropList& pl
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-//void H5Location::mount(const char* name, H5File& child, PropList& plist) const
+// void H5Location::mount(const char* name, H5File& child, PropList& plist) const
//{
// mount(name, child, plist);
//}
@@ -1840,7 +1908,8 @@ void H5Location::mount(const char* name, const H5File& child, const PropList& pl
/// It takes an \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Location::mount(const H5std_string& name, const H5File& child, const PropList& plist) const
+void
+H5Location::mount(const H5std_string &name, const H5File &child, const PropList &plist) const
{
mount(name.c_str(), child, plist);
}
@@ -1856,7 +1925,7 @@ void H5Location::mount(const H5std_string& name, const H5File& child, const Prop
// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-//void H5Location::mount(const H5std_string& name, H5File& child, PropList& plist) const
+// void H5Location::mount(const H5std_string& name, H5File& child, PropList& plist) const
//{
// mount(name.c_str(), child, plist);
//}
@@ -1868,7 +1937,8 @@ void H5Location::mount(const H5std_string& name, const H5File& child, const Prop
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Location::unmount(const char* name) const
+void
+H5Location::unmount(const char *name) const
{
// Call C routine H5Fmount to do the mouting
herr_t ret_value = H5Funmount(getId(), name);
@@ -1885,7 +1955,8 @@ void H5Location::unmount(const char* name) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Location::unmount(const H5std_string& name) const
+void
+H5Location::unmount(const H5std_string &name) const
{
unmount(name.c_str());
}
@@ -1904,14 +1975,14 @@ void H5Location::unmount(const H5std_string& name) const
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int H5Location::iterateElems(const char* name, int *idx, H5G_iterate_t op , void* op_data)
+int
+H5Location::iterateElems(const char *name, int *idx, H5G_iterate_t op, void *op_data)
{
int ret_value = H5Giterate(getId(), name, idx, op, op_data);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throwException("iterateElems", "H5Giterate failed");
}
- return(ret_value);
+ return (ret_value);
}
//--------------------------------------------------------------------------
@@ -1921,9 +1992,10 @@ int H5Location::iterateElems(const char* name, int *idx, H5G_iterate_t op , void
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int H5Location::iterateElems(const H5std_string& name, int *idx, H5G_iterate_t op , void* op_data)
+int
+H5Location::iterateElems(const H5std_string &name, int *idx, H5G_iterate_t op, void *op_data)
{
- return(iterateElems( name.c_str(), idx, op, op_data));
+ return (iterateElems(name.c_str(), idx, op, op_data));
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -1934,12 +2006,13 @@ int H5Location::iterateElems(const H5std_string& name, int *idx, H5G_iterate_t o
///\exception Deprecated
// Programmer Binh-Minh Ribler - January, 2003
//--------------------------------------------------------------------------
-hsize_t H5Location::getNumObjs() const
+hsize_t
+H5Location::getNumObjs() const
{
- H5G_info_t ginfo; // Group information
+ H5G_info_t ginfo; // Group information
herr_t ret_value = H5Gget_info(getId(), &ginfo);
- if(ret_value < 0)
+ if (ret_value < 0)
throwException("getNumObjs", "H5Gget_info failed");
return (ginfo.nlinks);
}
@@ -1959,28 +2032,30 @@ hsize_t H5Location::getNumObjs() const
/// each time the group is opened.
// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
-H5std_string H5Location::getObjnameByIdx(hsize_t idx) const
+H5std_string
+H5Location::getObjnameByIdx(hsize_t idx) const
{
// call H5Lget_name_by_idx with name as NULL to get its length
- ssize_t name_len = H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, NULL, 0, H5P_DEFAULT);
- if(name_len < 0)
+ ssize_t name_len =
+ H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, NULL, 0, H5P_DEFAULT);
+ if (name_len < 0)
throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
// now, allocate C buffer to get the name
- char* name_C = new char[name_len+1];
- HDmemset(name_C, 0, name_len+1); // clear buffer
+ char *name_C = new char[name_len + 1];
+ HDmemset(name_C, 0, name_len + 1); // clear buffer
- name_len = H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name_C, name_len+1, H5P_DEFAULT);
+ name_len =
+ H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name_C, name_len + 1, H5P_DEFAULT);
- if (name_len < 0)
- {
- delete []name_C;
+ if (name_len < 0) {
+ delete[] name_C;
throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
}
// clean up and return the string
H5std_string name = H5std_string(name_C);
- delete []name_C;
+ delete[] name_C;
return (name);
}
@@ -2001,10 +2076,12 @@ H5std_string H5Location::getObjnameByIdx(hsize_t idx) const
/// each time the group is opened.
// Programmer Binh-Minh Ribler - January, 2003
//--------------------------------------------------------------------------
-ssize_t H5Location::getObjnameByIdx(hsize_t idx, char* name, size_t size) const
+ssize_t
+H5Location::getObjnameByIdx(hsize_t idx, char *name, size_t size) const
{
- ssize_t name_len = H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5P_DEFAULT);
- if(name_len < 0)
+ ssize_t name_len =
+ H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5P_DEFAULT);
+ if (name_len < 0)
throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
return (name_len);
@@ -2017,22 +2094,22 @@ ssize_t H5Location::getObjnameByIdx(hsize_t idx, char* name, size_t size) const
/// \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - January, 2003
//--------------------------------------------------------------------------
-ssize_t H5Location::getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const
+ssize_t
+H5Location::getObjnameByIdx(hsize_t idx, H5std_string &name, size_t size) const
{
- char* name_C = new char[size+1]; // temporary C-string for object name
- HDmemset(name_C, 0, size+1); // clear buffer
+ char *name_C = new char[size + 1]; // temporary C-string for object name
+ HDmemset(name_C, 0, size + 1); // clear buffer
// call overloaded function to get the name
- ssize_t name_len = getObjnameByIdx(idx, name_C, size+1);
- if(name_len < 0)
- {
- delete []name_C;
+ ssize_t name_len = getObjnameByIdx(idx, name_C, size + 1);
+ if (name_len < 0) {
+ delete[] name_C;
throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
}
// clean up and return the string
name = H5std_string(name_C);
- delete []name_C;
+ delete[] name_C;
return (name_len);
}
@@ -2054,10 +2131,11 @@ ssize_t H5Location::getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size
/// - object type is not one of the valid values above
// Programmer Binh-Minh Ribler - April, 2014
//--------------------------------------------------------------------------
-H5O_type_t H5Location::childObjType(const char* objname) const
+H5O_type_t
+H5Location::childObjType(const char *objname) const
{
H5O_info2_t objinfo;
- H5O_type_t objtype = H5O_TYPE_UNKNOWN;
+ H5O_type_t objtype = H5O_TYPE_UNKNOWN;
// Use C API to get information of the object
herr_t ret_value = H5Oget_info_by_name3(getId(), objname, &objinfo, H5O_INFO_BASIC, H5P_DEFAULT);
@@ -2067,19 +2145,18 @@ H5O_type_t H5Location::childObjType(const char* objname) const
throwException("childObjType", "H5Oget_info_by_name failed");
// Return a valid type or throw an exception for unknown type
else
- switch (objinfo.type)
- {
- case H5O_TYPE_GROUP:
- case H5O_TYPE_DATASET:
- case H5O_TYPE_NAMED_DATATYPE:
- objtype = objinfo.type;
- break;
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- throwException("childObjType", "Unknown type of object");
+ switch (objinfo.type) {
+ case H5O_TYPE_GROUP:
+ case H5O_TYPE_DATASET:
+ case H5O_TYPE_NAMED_DATATYPE:
+ objtype = objinfo.type;
+ break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ throwException("childObjType", "Unknown type of object");
}
- return(objtype);
+ return (objtype);
}
//--------------------------------------------------------------------------
@@ -2092,11 +2169,12 @@ H5O_type_t H5Location::childObjType(const char* objname) const
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
// Programmer Binh-Minh Ribler - April, 2014
//--------------------------------------------------------------------------
-H5O_type_t H5Location::childObjType(const H5std_string& objname) const
+H5O_type_t
+H5Location::childObjType(const H5std_string &objname) const
{
// Use overloaded function
H5O_type_t objtype = childObjType(objname.c_str());
- return(objtype);
+ return (objtype);
}
//--------------------------------------------------------------------------
@@ -2128,33 +2206,35 @@ H5O_type_t H5Location::childObjType(const H5std_string& objname) const
// can be added later when needed.
// Programmer Binh-Minh Ribler - April, 2014
//--------------------------------------------------------------------------
-H5O_type_t H5Location::childObjType(hsize_t index, H5_index_t index_type, H5_iter_order_t order, const char* objname) const
+H5O_type_t
+H5Location::childObjType(hsize_t index, H5_index_t index_type, H5_iter_order_t order,
+ const char *objname) const
{
- herr_t ret_value;
+ herr_t ret_value;
H5O_info2_t objinfo;
- H5O_type_t objtype = H5O_TYPE_UNKNOWN;
+ H5O_type_t objtype = H5O_TYPE_UNKNOWN;
// Use C API to get information of the object
- ret_value = H5Oget_info_by_idx3(getId(), objname, index_type, order, index, &objinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ ret_value = H5Oget_info_by_idx3(getId(), objname, index_type, order, index, &objinfo, H5O_INFO_BASIC,
+ H5P_DEFAULT);
// Throw exception if C API returns failure
if (ret_value < 0)
throwException("childObjType", "H5Oget_info_by_idx failed");
// Return a valid type or throw an exception for unknown type
else
- switch (objinfo.type)
- {
- case H5O_TYPE_GROUP:
- case H5O_TYPE_DATASET:
- case H5O_TYPE_NAMED_DATATYPE:
- objtype = objinfo.type;
- break;
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- throwException("childObjType", "Unknown type of object");
+ switch (objinfo.type) {
+ case H5O_TYPE_GROUP:
+ case H5O_TYPE_DATASET:
+ case H5O_TYPE_NAMED_DATATYPE:
+ objtype = objinfo.type;
+ break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ throwException("childObjType", "Unknown type of object");
}
- return(objtype);
+ return (objtype);
}
//--------------------------------------------------------------------------
@@ -2171,25 +2251,26 @@ H5O_type_t H5Location::childObjType(hsize_t index, H5_index_t index_type, H5_ite
/// - version number is not one of the valid values above
// Programmer Binh-Minh Ribler - April, 2014
//--------------------------------------------------------------------------
-unsigned H5Location::childObjVersion(const char* objname) const
+unsigned
+H5Location::childObjVersion(const char *objname) const
{
H5O_native_info_t objinfo;
- unsigned version = 0;
+ unsigned version = 0;
// Use C API to get information of the object
- herr_t ret_value = H5Oget_native_info_by_name(getId(), objname, &objinfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT);
+ herr_t ret_value =
+ H5Oget_native_info_by_name(getId(), objname, &objinfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT);
// Throw exception if C API returns failure
if (ret_value < 0)
throwException("childObjVersion", "H5Oget_info_by_name failed");
// Return a valid version or throw an exception for invalid value
- else
- {
+ else {
version = objinfo.hdr.version;
if (version != H5O_VERSION_1 && version != H5O_VERSION_2)
throwException("childObjVersion", "Invalid version for object");
}
- return(version);
+ return (version);
}
//--------------------------------------------------------------------------
@@ -2202,11 +2283,12 @@ unsigned H5Location::childObjVersion(const char* objname) const
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
// Programmer Binh-Minh Ribler - April, 2014
//--------------------------------------------------------------------------
-unsigned H5Location::childObjVersion(const H5std_string& objname) const
+unsigned
+H5Location::childObjVersion(const H5std_string &objname) const
{
// Use overloaded function
unsigned version = childObjVersion(objname.c_str());
- return(version);
+ return (version);
}
#ifndef H5_NO_DEPRECATED_SYMBOLS
@@ -2220,13 +2302,14 @@ unsigned H5Location::childObjVersion(const H5std_string& objname) const
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
// Programmer Binh-Minh Ribler - January, 2003
//--------------------------------------------------------------------------
-H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx) const
+H5G_obj_t
+H5Location::getObjTypeByIdx(hsize_t idx) const
{
- H5G_obj_t obj_type = H5Gget_objtype_by_idx(getId(), idx);
- if (obj_type == H5G_UNKNOWN)
+ H5G_obj_t obj_type = H5Gget_objtype_by_idx(getId(), idx);
+ if (obj_type == H5G_UNKNOWN)
throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed");
- return (obj_type);
+ return (obj_type);
}
//--------------------------------------------------------------------------
@@ -2242,10 +2325,11 @@ H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx) const
// Modification
// Modified to use the other function. -BMR, 2016/03/07
//--------------------------------------------------------------------------
-H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx, char* type_name) const
+H5G_obj_t
+H5Location::getObjTypeByIdx(hsize_t idx, char *type_name) const
{
H5std_string stype_name(type_name);
- return(getObjTypeByIdx(idx, stype_name));
+ return (getObjTypeByIdx(idx, stype_name));
}
//--------------------------------------------------------------------------
// Function: H5Location::getObjTypeByIdx
@@ -2258,22 +2342,30 @@ H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx, char* type_name) const
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
// Programmer Binh-Minh Ribler - January, 2003
//--------------------------------------------------------------------------
-H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const
+H5G_obj_t
+H5Location::getObjTypeByIdx(hsize_t idx, H5std_string &type_name) const
{
H5G_obj_t obj_type = H5Gget_objtype_by_idx(getId(), idx);
- switch (obj_type)
- {
- case H5G_LINK: type_name = H5std_string("symbolic link"); break;
- case H5G_GROUP: type_name = H5std_string("group"); break;
- case H5G_DATASET: type_name = H5std_string("dataset"); break;
- case H5G_TYPE: type_name = H5std_string("datatype"); break;
- case H5G_UNKNOWN:
- case H5G_UDLINK:
- case H5G_RESERVED_5:
- case H5G_RESERVED_6:
- case H5G_RESERVED_7:
- default:
- throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed");
+ switch (obj_type) {
+ case H5G_LINK:
+ type_name = H5std_string("symbolic link");
+ break;
+ case H5G_GROUP:
+ type_name = H5std_string("group");
+ break;
+ case H5G_DATASET:
+ type_name = H5std_string("dataset");
+ break;
+ case H5G_TYPE:
+ type_name = H5std_string("datatype");
+ break;
+ case H5G_UNKNOWN:
+ case H5G_UDLINK:
+ case H5G_RESERVED_5:
+ case H5G_RESERVED_6:
+ case H5G_RESERVED_7:
+ default:
+ throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed");
}
return (obj_type);
}
@@ -2294,7 +2386,8 @@ H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) cons
// maintain backward compatibility. For other subclasses, throw
// LocationException.
//--------------------------------------------------------------------------
-void H5Location::throwException(const H5std_string& func_name, const H5std_string& msg) const
+void
+H5Location::throwException(const H5std_string &func_name, const H5std_string &msg) const
{
throw LocationException(inMemFunc(func_name.c_str()), msg);
}
@@ -2325,7 +2418,8 @@ void H5Location::throwException(const H5std_string& func_name, const H5std_strin
// param new_id - IN: New id to set
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void f_DataSpace_setId(DataSpace* dspace, hid_t new_id)
+void
+f_DataSpace_setId(DataSpace *dspace, hid_t new_id)
{
dspace->p_setId(new_id);
}
@@ -2339,4 +2433,4 @@ H5Location::~H5Location() {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h
index 3c30715..3ea58cd 100644
--- a/c++/src/H5Location.h
+++ b/c++/src/H5Location.h
@@ -15,7 +15,7 @@
#ifndef __H5Location_H
#define __H5Location_H
-#include "H5Classes.h" // constains forward class declarations
+#include "H5Classes.h" // constains forward class declarations
namespace H5 {
@@ -29,319 +29,312 @@ namespace H5 {
*/
// Inheritance: IdComponent
class H5_DLLCPP H5Location : public IdComponent {
- public:
- // Checks if a link of a given name exists in a location
- bool nameExists(const char* name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- bool nameExists(const H5std_string& name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ public:
+ // Checks if a link of a given name exists in a location
+ bool nameExists(const char *name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+ bool nameExists(const H5std_string &name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
- // Checks if a link of a given name exists in a location
- // Deprecated in favor of nameExists for better name.
- bool exists(const char* name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- bool exists(const H5std_string& name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ // Checks if a link of a given name exists in a location
+ // Deprecated in favor of nameExists for better name.
+ bool exists(const char *name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+ bool exists(const H5std_string &name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
- // Flushes all buffers associated with this location to disk.
- void flush(H5F_scope_t scope) const;
+ // Flushes all buffers associated with this location to disk.
+ void flush(H5F_scope_t scope) const;
- // Gets the name of the file, specified by this location.
- H5std_string getFileName() const;
+ // Gets the name of the file, specified by this location.
+ H5std_string getFileName() const;
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Retrieves the type of object that an object reference points to.
- H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
+ // Retrieves the type of object that an object reference points to.
+ H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- // Retrieves the type of object that an object reference points to.
- H5O_type_t getRefObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
- // Note: getRefObjType deprecates getObjType, but getObjType's name is
- // misleading, so getRefObjType is used in the new function instead.
-
- // Sets the comment for an HDF5 object specified by its name.
- void setComment(const char* name, const char* comment) const;
- void setComment(const H5std_string& name, const H5std_string& comment) const;
- void setComment(const char* comment) const;
- void setComment(const H5std_string& comment) const;
-
- // Retrieves comment for the HDF5 object specified by its name.
- ssize_t getComment(const char* name, size_t buf_size, char* comment) const;
- H5std_string getComment(const char* name, size_t buf_size=0) const;
- H5std_string getComment(const H5std_string& name, size_t buf_size=0) const;
-
- // Removes the comment for the HDF5 object specified by its name.
- void removeComment(const char* name) const;
- void removeComment(const H5std_string& name) const;
-
- // Creates a reference to a named object or to a dataset region
- // in this object.
- void reference(void* ref, const char* name,
- H5R_type_t ref_type = H5R_OBJECT) const;
- void reference(void* ref, const H5std_string& name,
- H5R_type_t ref_type = H5R_OBJECT) const;
- void reference(void* ref, const char* name, const DataSpace& dataspace,
- H5R_type_t ref_type = H5R_DATASET_REGION) const;
- void reference(void* ref, const H5std_string& name, const DataSpace& dataspace,
- H5R_type_t ref_type = H5R_DATASET_REGION) const;
-
- // Open a referenced object whose location is specified by either
- // a file, an HDF5 object, or an attribute.
- void dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
- // Removed in 1.10.1, because H5Location is baseclass
- //void dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
-
- // Retrieves a dataspace with the region pointed to selected.
- DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
-
- // Create a new group with using link create property list.
- Group createGroup(const char* name, const LinkCreatPropList& lcpl) const;
- Group createGroup(const H5std_string& name, const LinkCreatPropList& lcpl) const;
-
-// From CommonFG
- // Creates a new group at this location which can be a file
- // or another group.
- Group createGroup(const char* name, size_t size_hint = 0) const;
- Group createGroup(const H5std_string& name, size_t size_hint = 0) const;
-
- // Opens an existing group in a location which can be a file
- // or another group.
- Group openGroup(const char* name) const;
- Group openGroup(const H5std_string& name) const;
-
- // Creates a new dataset in this location.
- DataSet createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT, const DSetAccPropList& dapl = DSetAccPropList::DEFAULT, const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT) const;
- DataSet createDataSet(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT, const DSetAccPropList& dapl = DSetAccPropList::DEFAULT, const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT) const;
-
- // Deprecated to add LinkCreatPropList and DSetAccPropList - 1.10.3
- // DataSet createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const;
- // DataSet createDataSet(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const;
-
- // Opens an existing dataset at this location.
- // DSetAccPropList is added - 1.10.3
- DataSet openDataSet(const char* name, const DSetAccPropList& dapl = DSetAccPropList::DEFAULT) const;
- DataSet openDataSet(const H5std_string& name, const DSetAccPropList& dapl = DSetAccPropList::DEFAULT) const;
-
- H5L_info2_t getLinkInfo(const char* link_name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- H5L_info2_t getLinkInfo(const H5std_string& link_name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Returns the value of a symbolic link.
- H5std_string getLinkval(const char* link_name, size_t size=0) const;
- H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const;
-
- // Returns the number of objects in this group.
- // Deprecated - moved to H5::Group in 1.10.2.
- hsize_t getNumObjs() const;
-
- // Retrieves the name of an object in this group, given the
- // object's index.
- H5std_string getObjnameByIdx(hsize_t idx) const;
- ssize_t getObjnameByIdx(hsize_t idx, char* name, size_t size) const;
- ssize_t getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const;
-
- // Retrieves the type of an object in this file or group, given the
- // object's name
- H5O_type_t childObjType(const H5std_string& objname) const;
- H5O_type_t childObjType(const char* objname) const;
- H5O_type_t childObjType(hsize_t index, H5_index_t index_type=H5_INDEX_NAME, H5_iter_order_t order=H5_ITER_INC, const char* objname=".") const;
-
- // Returns the object header version of an object in this file or group,
- // given the object's name.
- unsigned childObjVersion(const char* objname) const;
- unsigned childObjVersion(const H5std_string& objname) const;
-
- // Retrieves information about an HDF5 object.
- void getObjinfo(H5O_info2_t& objinfo, unsigned fields = H5O_INFO_BASIC) const;
-
- // Retrieves information about an HDF5 object, given its name.
- void getObjinfo(const char* name, H5O_info2_t& objinfo,
- unsigned fields = H5O_INFO_BASIC,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void getObjinfo(const H5std_string& name, H5O_info2_t& objinfo,
- unsigned fields = H5O_INFO_BASIC,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Retrieves information about an HDF5 object, given its index.
- void getObjinfo(const char* grp_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, H5O_info2_t& objinfo,
- unsigned fields = H5O_INFO_BASIC,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void getObjinfo(const H5std_string& grp_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, H5O_info2_t& objinfo,
- unsigned fields = H5O_INFO_BASIC,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Retrieves native native information about an HDF5 object.
- void getNativeObjinfo(H5O_native_info_t& objinfo, unsigned fields = H5O_NATIVE_INFO_HDR) const;
-
- // Retrieves native information about an HDF5 object, given its name.
- void getNativeObjinfo(const char* name, H5O_native_info_t& objinfo,
- unsigned fields = H5O_NATIVE_INFO_HDR,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void getNativeObjinfo(const H5std_string& name, H5O_native_info_t& objinfo,
- unsigned fields = H5O_NATIVE_INFO_HDR,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Retrieves native information about an HDF5 object, given its index.
- void getNativeObjinfo(const char* grp_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, H5O_native_info_t& objinfo,
- unsigned fields = H5O_NATIVE_INFO_HDR,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void getNativeObjinfo(const H5std_string& grp_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, H5O_native_info_t& objinfo,
- unsigned fields = H5O_NATIVE_INFO_HDR,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ // Retrieves the type of object that an object reference points to.
+ H5O_type_t getRefObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
+ // Note: getRefObjType deprecates getObjType, but getObjType's name is
+ // misleading, so getRefObjType is used in the new function instead.
+
+ // Sets the comment for an HDF5 object specified by its name.
+ void setComment(const char *name, const char *comment) const;
+ void setComment(const H5std_string &name, const H5std_string &comment) const;
+ void setComment(const char *comment) const;
+ void setComment(const H5std_string &comment) const;
+
+ // Retrieves comment for the HDF5 object specified by its name.
+ ssize_t getComment(const char *name, size_t buf_size, char *comment) const;
+ H5std_string getComment(const char *name, size_t buf_size = 0) const;
+ H5std_string getComment(const H5std_string &name, size_t buf_size = 0) const;
+
+ // Removes the comment for the HDF5 object specified by its name.
+ void removeComment(const char *name) const;
+ void removeComment(const H5std_string &name) const;
+
+ // Creates a reference to a named object or to a dataset region
+ // in this object.
+ void reference(void *ref, const char *name, H5R_type_t ref_type = H5R_OBJECT) const;
+ void reference(void *ref, const H5std_string &name, H5R_type_t ref_type = H5R_OBJECT) const;
+ void reference(void *ref, const char *name, const DataSpace &dataspace,
+ H5R_type_t ref_type = H5R_DATASET_REGION) const;
+ void reference(void *ref, const H5std_string &name, const DataSpace &dataspace,
+ H5R_type_t ref_type = H5R_DATASET_REGION) const;
+
+ // Open a referenced object whose location is specified by either
+ // a file, an HDF5 object, or an attribute.
+ void dereference(const H5Location &loc, const void *ref, H5R_type_t ref_type = H5R_OBJECT,
+ const PropList &plist = PropList::DEFAULT);
+ // Removed in 1.10.1, because H5Location is baseclass
+ // void dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const
+ // PropList& plist = PropList::DEFAULT);
+
+ // Retrieves a dataspace with the region pointed to selected.
+ DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
+
+ // Create a new group with using link create property list.
+ Group createGroup(const char *name, const LinkCreatPropList &lcpl) const;
+ Group createGroup(const H5std_string &name, const LinkCreatPropList &lcpl) const;
+
+ // From CommonFG
+ // Creates a new group at this location which can be a file
+ // or another group.
+ Group createGroup(const char *name, size_t size_hint = 0) const;
+ Group createGroup(const H5std_string &name, size_t size_hint = 0) const;
+
+ // Opens an existing group in a location which can be a file
+ // or another group.
+ Group openGroup(const char *name) const;
+ Group openGroup(const H5std_string &name) const;
+
+ // Creates a new dataset in this location.
+ DataSet createDataSet(const char *name, const DataType &data_type, const DataSpace &data_space,
+ const DSetCreatPropList &create_plist = DSetCreatPropList::DEFAULT,
+ const DSetAccPropList & dapl = DSetAccPropList::DEFAULT,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT) const;
+ DataSet createDataSet(const H5std_string &name, const DataType &data_type, const DataSpace &data_space,
+ const DSetCreatPropList &create_plist = DSetCreatPropList::DEFAULT,
+ const DSetAccPropList & dapl = DSetAccPropList::DEFAULT,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT) const;
+
+ // Deprecated to add LinkCreatPropList and DSetAccPropList - 1.10.3
+ // DataSet createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const
+ // DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const; DataSet createDataSet(const
+ // H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList&
+ // create_plist = DSetCreatPropList::DEFAULT) const;
+
+ // Opens an existing dataset at this location.
+ // DSetAccPropList is added - 1.10.3
+ DataSet openDataSet(const char *name, const DSetAccPropList &dapl = DSetAccPropList::DEFAULT) const;
+ DataSet openDataSet(const H5std_string & name,
+ const DSetAccPropList &dapl = DSetAccPropList::DEFAULT) const;
+
+ H5L_info2_t getLinkInfo(const char * link_name,
+ const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+ H5L_info2_t getLinkInfo(const H5std_string & link_name,
+ const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+
+ // Returns the value of a symbolic link.
+ H5std_string getLinkval(const char *link_name, size_t size = 0) const;
+ H5std_string getLinkval(const H5std_string &link_name, size_t size = 0) const;
+
+ // Returns the number of objects in this group.
+ // Deprecated - moved to H5::Group in 1.10.2.
+ hsize_t getNumObjs() const;
+
+ // Retrieves the name of an object in this group, given the
+ // object's index.
+ H5std_string getObjnameByIdx(hsize_t idx) const;
+ ssize_t getObjnameByIdx(hsize_t idx, char *name, size_t size) const;
+ ssize_t getObjnameByIdx(hsize_t idx, H5std_string &name, size_t size) const;
+
+ // Retrieves the type of an object in this file or group, given the
+ // object's name
+ H5O_type_t childObjType(const H5std_string &objname) const;
+ H5O_type_t childObjType(const char *objname) const;
+ H5O_type_t childObjType(hsize_t index, H5_index_t index_type = H5_INDEX_NAME,
+ H5_iter_order_t order = H5_ITER_INC, const char *objname = ".") const;
+
+ // Returns the object header version of an object in this file or group,
+ // given the object's name.
+ unsigned childObjVersion(const char *objname) const;
+ unsigned childObjVersion(const H5std_string &objname) const;
+
+ // Retrieves information about an HDF5 object.
+ void getObjinfo(H5O_info2_t &objinfo, unsigned fields = H5O_INFO_BASIC) const;
+
+ // Retrieves information about an HDF5 object, given its name.
+ void getObjinfo(const char *name, H5O_info2_t &objinfo, unsigned fields = H5O_INFO_BASIC,
+ const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+ void getObjinfo(const H5std_string &name, H5O_info2_t &objinfo, unsigned fields = H5O_INFO_BASIC,
+ const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+
+ // Retrieves information about an HDF5 object, given its index.
+ void getObjinfo(const char *grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx,
+ H5O_info2_t &objinfo, unsigned fields = H5O_INFO_BASIC,
+ const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+ void getObjinfo(const H5std_string &grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx,
+ H5O_info2_t &objinfo, unsigned fields = H5O_INFO_BASIC,
+ const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+
+ // Retrieves native native information about an HDF5 object.
+ void getNativeObjinfo(H5O_native_info_t &objinfo, unsigned fields = H5O_NATIVE_INFO_HDR) const;
+
+ // Retrieves native information about an HDF5 object, given its name.
+ void getNativeObjinfo(const char *name, H5O_native_info_t &objinfo, unsigned fields = H5O_NATIVE_INFO_HDR,
+ const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+ void getNativeObjinfo(const H5std_string &name, H5O_native_info_t &objinfo,
+ unsigned fields = H5O_NATIVE_INFO_HDR,
+ const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+
+ // Retrieves native information about an HDF5 object, given its index.
+ void getNativeObjinfo(const char *grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx,
+ H5O_native_info_t &objinfo, unsigned fields = H5O_NATIVE_INFO_HDR,
+ const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+ void getNativeObjinfo(const H5std_string &grp_name, H5_index_t idx_type, H5_iter_order_t order,
+ hsize_t idx, H5O_native_info_t &objinfo, unsigned fields = H5O_NATIVE_INFO_HDR,
+ const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Returns the type of an object in this group, given the
- // object's index.
- H5G_obj_t getObjTypeByIdx(hsize_t idx) const;
- H5G_obj_t getObjTypeByIdx(hsize_t idx, char* type_name) const;
- H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const;
-
- // Returns information about an HDF5 object, given by its name,
- // at this location. - Deprecated
- void getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const;
- void getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf) const;
- void getObjinfo(const char* name, H5G_stat_t& statbuf) const;
- void getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const;
-
- // Iterates over the elements of this group - not implemented in
- // C++ style yet.
- int iterateElems(const char* name, int *idx, H5G_iterate_t op, void *op_data);
- int iterateElems(const H5std_string& name, int *idx, H5G_iterate_t op, void *op_data);
+ // Returns the type of an object in this group, given the
+ // object's index.
+ H5G_obj_t getObjTypeByIdx(hsize_t idx) const;
+ H5G_obj_t getObjTypeByIdx(hsize_t idx, char *type_name) const;
+ H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string &type_name) const;
+
+ // Returns information about an HDF5 object, given by its name,
+ // at this location. - Deprecated
+ void getObjinfo(const char *name, hbool_t follow_link, H5G_stat_t &statbuf) const;
+ void getObjinfo(const H5std_string &name, hbool_t follow_link, H5G_stat_t &statbuf) const;
+ void getObjinfo(const char *name, H5G_stat_t &statbuf) const;
+ void getObjinfo(const H5std_string &name, H5G_stat_t &statbuf) const;
+
+ // Iterates over the elements of this group - not implemented in
+ // C++ style yet.
+ int iterateElems(const char *name, int *idx, H5G_iterate_t op, void *op_data);
+ int iterateElems(const H5std_string &name, int *idx, H5G_iterate_t op, void *op_data);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- // Creates a soft link from link_name to target_name.
- void link(const char *target_name, const char *link_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void link(const H5std_string& target_name,
- const H5std_string& link_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Creates a hard link from new_name to curr_name.
- void link(const char *curr_name,
- const Group& new_loc, const char *new_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void link(const H5std_string& curr_name,
- const Group& new_loc, const H5std_string& new_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Creates a hard link from new_name to curr_name in same location.
- void link(const char *curr_name,
- const hid_t same_loc, const char *new_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void link(const H5std_string& curr_name,
- const hid_t same_loc, const H5std_string& new_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Creates a link of the specified type from new_name to current_name;
- // both names are interpreted relative to the specified location id.
- // Deprecated due to inadequate functionality.
- void link(H5L_type_t link_type, const char* curr_name, const char* new_name) const;
- void link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const;
-
- // Removes the specified link from this location.
- void unlink(const char *link_name,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void unlink(const H5std_string& link_name,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Mounts the file 'child' onto this location.
- void mount(const char* name, const H5File& child, const PropList& plist) const;
- void mount(const H5std_string& name, const H5File& child, const PropList& plist) const;
-
- // Unmounts the file named 'name' from this parent location.
- void unmount(const char* name) const;
- void unmount(const H5std_string& name) const;
-
- // Copies a link from a group to another.
- void copyLink(const char *src_name,
- const Group& dst, const char *dst_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void copyLink(const H5std_string& src_name,
- const Group& dst, const H5std_string& dst_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Makes a copy of a link in the same group.
- void copyLink(const char *src_name, const char *dst_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void copyLink(const H5std_string& src_name,
- const H5std_string& dst_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Renames a link in this group and moves to a new location.
- void moveLink(const char* src_name,
- const Group& dst, const char* dst_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void moveLink(const H5std_string& src_name,
- const Group& dst, const H5std_string& dst_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Renames a link in this group.
- void moveLink(const char* src_name, const char* dst_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- void moveLink(const H5std_string& src_name,
- const H5std_string& dst_name,
- const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
- const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
-
- // Renames an object at this location.
- // Deprecated due to inadequate functionality.
- void move(const char* src, const char* dst) const;
- void move(const H5std_string& src, const H5std_string& dst) const;
-
-// end From CommonFG
-
- /// For subclasses, H5File and Group, to throw appropriate exception.
- virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
-
- // Default constructor
- H5Location();
-
- protected:
+ // Creates a soft link from link_name to target_name.
+ void link(const char *target_name, const char *link_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+ void link(const H5std_string &target_name, const H5std_string &link_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+
+ // Creates a hard link from new_name to curr_name.
+ void link(const char *curr_name, const Group &new_loc, const char *new_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+ void link(const H5std_string &curr_name, const Group &new_loc, const H5std_string &new_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+
+ // Creates a hard link from new_name to curr_name in same location.
+ void link(const char *curr_name, const hid_t same_loc, const char *new_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+ void link(const H5std_string &curr_name, const hid_t same_loc, const H5std_string &new_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+
+ // Creates a link of the specified type from new_name to current_name;
+ // both names are interpreted relative to the specified location id.
+ // Deprecated due to inadequate functionality.
+ void link(H5L_type_t link_type, const char *curr_name, const char *new_name) const;
+ void link(H5L_type_t link_type, const H5std_string &curr_name, const H5std_string &new_name) const;
+
+ // Removes the specified link from this location.
+ void unlink(const char *link_name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+ void unlink(const H5std_string &link_name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const;
+
+ // Mounts the file 'child' onto this location.
+ void mount(const char *name, const H5File &child, const PropList &plist) const;
+ void mount(const H5std_string &name, const H5File &child, const PropList &plist) const;
+
+ // Unmounts the file named 'name' from this parent location.
+ void unmount(const char *name) const;
+ void unmount(const H5std_string &name) const;
+
+ // Copies a link from a group to another.
+ void copyLink(const char *src_name, const Group &dst, const char *dst_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+ void copyLink(const H5std_string &src_name, const Group &dst, const H5std_string &dst_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+
+ // Makes a copy of a link in the same group.
+ void copyLink(const char *src_name, const char *dst_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+ void copyLink(const H5std_string &src_name, const H5std_string &dst_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+
+ // Renames a link in this group and moves to a new location.
+ void moveLink(const char *src_name, const Group &dst, const char *dst_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+ void moveLink(const H5std_string &src_name, const Group &dst, const H5std_string &dst_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+
+ // Renames a link in this group.
+ void moveLink(const char *src_name, const char *dst_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+ void moveLink(const H5std_string &src_name, const H5std_string &dst_name,
+ const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList & lapl = LinkAccPropList::DEFAULT) const;
+
+ // Renames an object at this location.
+ // Deprecated due to inadequate functionality.
+ void move(const char *src, const char *dst) const;
+ void move(const H5std_string &src, const H5std_string &dst) const;
+
+ // end From CommonFG
+
+ /// For subclasses, H5File and Group, to throw appropriate exception.
+ virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const;
+
+ // Default constructor
+ H5Location();
+
+ protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // *** Deprecation warning ***
- // The following two constructors are no longer appropriate after the
- // data member "id" had been moved to the sub-classes.
- // The copy constructor is a noop and is removed in 1.8.15 and the
- // other will be removed from 1.10 release, and then from 1.8 if its
- // removal does not raise any problems in two 1.10 releases.
+ // *** Deprecation warning ***
+ // The following two constructors are no longer appropriate after the
+ // data member "id" had been moved to the sub-classes.
+ // The copy constructor is a noop and is removed in 1.8.15 and the
+ // other will be removed from 1.10 release, and then from 1.8 if its
+ // removal does not raise any problems in two 1.10 releases.
- // Creates a copy of an existing object giving the location id.
- // H5Location(const hid_t loc_id);
+ // Creates a copy of an existing object giving the location id.
+ // H5Location(const hid_t loc_id);
- // Creates a reference to an HDF5 object or a dataset region.
- void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const;
+ // Creates a reference to an HDF5 object or a dataset region.
+ void p_reference(void *ref, const char *name, hid_t space_id, H5R_type_t ref_type) const;
- // Dereferences a ref into an HDF5 id.
- hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist, const char* from_func);
+ // Dereferences a ref into an HDF5 id.
+ hid_t p_dereference(hid_t loc_id, const void *ref, H5R_type_t ref_type, const PropList &plist,
+ const char *from_func);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Retrieves the type of object that an object reference points to.
- H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const;
+ // Retrieves the type of object that an object reference points to.
+ H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- // Retrieves the type of object that an object reference points to.
- H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const;
+ // Retrieves the type of object that an object reference points to.
+ H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const;
- // Sets the identifier of this object to a new value. - this one
- // doesn't increment reference count
- //virtual void p_setId(const hid_t new_id);
+ // Sets the identifier of this object to a new value. - this one
+ // doesn't increment reference count
+ // virtual void p_setId(const hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
- // Noop destructor.
- virtual ~H5Location();
+ // Noop destructor.
+ virtual ~H5Location();
}; // end of H5Location
} // namespace H5
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index 081cab7..3feed51 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -13,7 +13,7 @@
#include <string>
-#include "H5private.h" // for HDmemset
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -42,23 +42,23 @@ namespace H5 {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// userAttrOpWrpr interfaces between the user's function and the
// C library function H5Aiterate2
-extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name,
- const H5A_info_t *ainfo, void *op_data)
+extern "C" herr_t
+userAttrOpWrpr(hid_t loc_id, const char *attr_name, const H5A_info_t *ainfo, void *op_data)
{
- H5std_string s_attr_name = H5std_string(attr_name);
- UserData4Aiterate* myData = reinterpret_cast<UserData4Aiterate *> (op_data);
+ H5std_string s_attr_name = H5std_string(attr_name);
+ UserData4Aiterate *myData = reinterpret_cast<UserData4Aiterate *>(op_data);
myData->op(*myData->location, s_attr_name, myData->opData);
return 0;
}
// userVisitOpWrpr interfaces between the user's function and the
// C library function H5Ovisit3
-extern "C" herr_t userVisitOpWrpr(hid_t obj_id, const char *attr_name,
- const H5O_info2_t *obj_info, void *op_data)
+extern "C" herr_t
+userVisitOpWrpr(hid_t obj_id, const char *attr_name, const H5O_info2_t *obj_info, void *op_data)
{
- H5std_string s_attr_name = H5std_string(attr_name);
- UserData4Visit* myData = reinterpret_cast<UserData4Visit *> (op_data);
- int status = myData->op(*myData->obj, s_attr_name, obj_info, myData->opData);
+ H5std_string s_attr_name = H5std_string(attr_name);
+ UserData4Visit *myData = reinterpret_cast<UserData4Visit *>(op_data);
+ int status = myData->op(*myData->obj, s_attr_name, obj_info, myData->opData);
return status;
}
@@ -78,7 +78,8 @@ H5Object::H5Object() : H5Location() {}
// param new_id - IN: New id to set
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void f_Attribute_setId(Attribute* attr, hid_t new_id)
+void
+f_Attribute_setId(Attribute *attr, hid_t new_id)
{
attr->p_setId(new_id);
}
@@ -105,19 +106,20 @@ void f_Attribute_setId(Attribute* attr, hid_t new_id)
/// recreate it with this function.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Attribute H5Object::createAttribute(const char* name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist) const
+Attribute
+H5Object::createAttribute(const char *name, const DataType &data_type, const DataSpace &data_space,
+ const PropList &create_plist) const
{
- hid_t type_id = data_type.getId();
+ hid_t type_id = data_type.getId();
hid_t space_id = data_space.getId();
hid_t plist_id = create_plist.getId();
- hid_t attr_id = H5Acreate2(getId(), name, type_id, space_id, plist_id, H5P_DEFAULT);
+ hid_t attr_id = H5Acreate2(getId(), name, type_id, space_id, plist_id, H5P_DEFAULT);
// If the attribute id is valid, create and return the Attribute object
- if (attr_id > 0)
- {
+ if (attr_id > 0) {
Attribute attr;
f_Attribute_setId(&attr, attr_id);
- return(attr);
+ return (attr);
}
else
throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate2 failed");
@@ -130,9 +132,11 @@ Attribute H5Object::createAttribute(const char* name, const DataType& data_type,
/// a reference to an \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Attribute H5Object::createAttribute(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist) const
+Attribute
+H5Object::createAttribute(const H5std_string &name, const DataType &data_type, const DataSpace &data_space,
+ const PropList &create_plist) const
{
- return(createAttribute(name.c_str(), data_type, data_space, create_plist));
+ return (createAttribute(name.c_str(), data_type, data_space, create_plist));
}
//--------------------------------------------------------------------------
@@ -143,17 +147,16 @@ Attribute H5Object::createAttribute(const H5std_string& name, const DataType& da
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Attribute H5Object::openAttribute(const char* name) const
+Attribute
+H5Object::openAttribute(const char *name) const
{
hid_t attr_id = H5Aopen(getId(), name, H5P_DEFAULT);
- if (attr_id > 0)
- {
+ if (attr_id > 0) {
Attribute attr;
f_Attribute_setId(&attr, attr_id);
- return(attr);
+ return (attr);
}
- else
- {
+ else {
throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen failed");
}
}
@@ -165,9 +168,10 @@ Attribute H5Object::openAttribute(const char* name) const
/// a reference to an \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Attribute H5Object::openAttribute(const H5std_string& name) const
+Attribute
+H5Object::openAttribute(const H5std_string &name) const
{
- return(openAttribute(name.c_str()));
+ return (openAttribute(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -178,18 +182,17 @@ Attribute H5Object::openAttribute(const H5std_string& name) const
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Attribute H5Object::openAttribute(const unsigned int idx) const
+Attribute
+H5Object::openAttribute(const unsigned int idx) const
{
- hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER,
- H5_ITER_INC, static_cast<hsize_t>(idx), H5P_DEFAULT, H5P_DEFAULT);
- if (attr_id > 0)
- {
+ hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, static_cast<hsize_t>(idx),
+ H5P_DEFAULT, H5P_DEFAULT);
+ if (attr_id > 0) {
Attribute attr;
f_Attribute_setId(&attr, attr_id);
- return(attr);
+ return (attr);
}
- else
- {
+ else {
throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_by_idx failed");
}
}
@@ -209,18 +212,19 @@ Attribute H5Object::openAttribute(const unsigned int idx) const
/// void (*)(H5::H5Location&, H5std_string, void*).
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_data)
+int
+H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_data)
{
// store the user's function and data
- UserData4Aiterate* userData = new UserData4Aiterate;
- userData->opData = op_data;
- userData->op = user_op;
- userData->location = this;
+ UserData4Aiterate *userData = new UserData4Aiterate;
+ userData->opData = op_data;
+ userData->op = user_op;
+ userData->location = this;
// call the C library routine H5Aiterate2 to iterate the attributes
hsize_t idx = _idx ? static_cast<hsize_t>(*_idx) : 0;
- int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx,
- userAttrOpWrpr, static_cast<void *>(userData));
+ int ret_value =
+ H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, userAttrOpWrpr, static_cast<void *>(userData));
// release memory
delete userData;
@@ -229,9 +233,9 @@ int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_dat
/* Pass back update index value to calling code */
if (_idx)
*_idx = static_cast<unsigned>(idx);
- return(ret_value);
+ return (ret_value);
}
- else // raise exception when H5Aiterate returns a negative value
+ else // raise exception when H5Aiterate returns a negative value
throw AttributeIException(inMemFunc("iterateAttrs"), "H5Aiterate2 failed");
}
@@ -268,16 +272,19 @@ int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_dat
/// C Reference Manual.
// Programmer Binh-Minh Ribler - Feb, 2019
//--------------------------------------------------------------------------
-void H5Object::visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_t user_op, void *op_data, unsigned int fields)
+void
+H5Object::visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_t user_op, void *op_data,
+ unsigned int fields)
{
// Store the user's function and data
- UserData4Visit* userData = new UserData4Visit;
- userData->opData = op_data;
- userData->op = user_op;
- userData->obj = this;
+ UserData4Visit *userData = new UserData4Visit;
+ userData->opData = op_data;
+ userData->op = user_op;
+ userData->obj = this;
// Call the C API passing in op wrapper and info
- herr_t ret_value = H5Ovisit3(getId(), idx_type, order, userVisitOpWrpr, static_cast<void *>(userData), fields);
+ herr_t ret_value =
+ H5Ovisit3(getId(), idx_type, order, userVisitOpWrpr, static_cast<void *>(userData), fields);
// Release memory
delete userData;
@@ -300,10 +307,11 @@ void H5Object::visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_
/// - version number is not one of the valid values above
// Programmer Binh-Minh Ribler - December, 2016
//--------------------------------------------------------------------------
-unsigned H5Object::objVersion() const
+unsigned
+H5Object::objVersion() const
{
H5O_native_info_t objinfo;
- unsigned version = 0;
+ unsigned version = 0;
// Use C API to get information of the object
herr_t ret_value = H5Oget_native_info(getId(), &objinfo, H5O_NATIVE_INFO_HDR);
@@ -312,13 +320,12 @@ unsigned H5Object::objVersion() const
if (ret_value < 0)
throw Exception(inMemFunc("objVersion"), "H5Oget_native_info failed");
// Return a valid version or throw an exception for invalid value
- else
- {
+ else {
version = objinfo.hdr.version;
if (version != H5O_VERSION_1 && version != H5O_VERSION_2)
throw ObjHeaderIException("objVersion", "Invalid version for object");
}
- return(version);
+ return (version);
}
//--------------------------------------------------------------------------
@@ -328,14 +335,15 @@ unsigned H5Object::objVersion() const
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int H5Object::getNumAttrs() const
+int
+H5Object::getNumAttrs() const
{
- H5O_info2_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
- if(H5Oget_info3(getId(), &oinfo, H5O_INFO_NUM_ATTRS) < 0)
+ if (H5Oget_info3(getId(), &oinfo, H5O_INFO_NUM_ATTRS) < 0)
throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed");
else
- return(static_cast<int>(oinfo.num_attrs));
+ return (static_cast<int>(oinfo.num_attrs));
}
//--------------------------------------------------------------------------
@@ -345,7 +353,8 @@ int H5Object::getNumAttrs() const
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2013
//--------------------------------------------------------------------------
-bool H5Object::attrExists(const char* name) const
+bool
+H5Object::attrExists(const char *name) const
{
// Call C routine H5Aexists to determine whether an attribute exists
// at this location, which could be specified by a file, group, dataset,
@@ -353,7 +362,7 @@ bool H5Object::attrExists(const char* name) const
herr_t ret_value = H5Aexists(getId(), name);
if (ret_value > 0)
return true;
- else if(ret_value == 0)
+ else if (ret_value == 0)
return false;
else // Raise exception when H5Aexists returns a negative value
throw AttributeIException(inMemFunc("attrExists"), "H5Aexists failed");
@@ -366,9 +375,10 @@ bool H5Object::attrExists(const char* name) const
/// a reference to an \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-bool H5Object::attrExists(const H5std_string& name) const
+bool
+H5Object::attrExists(const H5std_string &name) const
{
- return(attrExists(name.c_str()));
+ return (attrExists(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -378,7 +388,8 @@ bool H5Object::attrExists(const H5std_string& name) const
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Object::removeAttr(const char* name) const
+void
+H5Object::removeAttr(const char *name) const
{
herr_t ret_value = H5Adelete(getId(), name);
if (ret_value < 0)
@@ -392,7 +403,8 @@ void H5Object::removeAttr(const char* name) const
/// a reference to an \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Object::removeAttr(const H5std_string& name) const
+void
+H5Object::removeAttr(const H5std_string &name) const
{
removeAttr(name.c_str());
}
@@ -405,7 +417,8 @@ void H5Object::removeAttr(const H5std_string& name) const
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
-void H5Object::renameAttr(const char* oldname, const char* newname) const
+void
+H5Object::renameAttr(const char *oldname, const char *newname) const
{
herr_t ret_value = H5Arename(getId(), oldname, newname);
if (ret_value < 0)
@@ -419,9 +432,10 @@ void H5Object::renameAttr(const char* oldname, const char* newname) const
/// a reference to an \c H5std_string for the names.
// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
-void H5Object::renameAttr(const H5std_string& oldname, const H5std_string& newname) const
+void
+H5Object::renameAttr(const H5std_string &oldname, const H5std_string &newname) const
{
- renameAttr (oldname.c_str(), newname.c_str());
+ renameAttr(oldname.c_str(), newname.c_str());
}
//--------------------------------------------------------------------------
@@ -430,22 +444,21 @@ void H5Object::renameAttr(const H5std_string& oldname, const H5std_string& newna
///\return The name of the object
// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
-ssize_t H5Object::getObjName(char *obj_name, size_t buf_size) const
+ssize_t
+H5Object::getObjName(char *obj_name, size_t buf_size) const
{
// H5Iget_name will get buf_size-1 chars of the name to null terminate it
ssize_t name_size = H5Iget_name(getId(), obj_name, buf_size);
// If H5Iget_name returns a negative value, raise an exception
- if (name_size < 0)
- {
+ if (name_size < 0) {
throw Exception(inMemFunc("getObjName"), "H5Iget_name failed");
}
- else if (name_size == 0)
- {
+ else if (name_size == 0) {
throw Exception(inMemFunc("getObjName"), "Object must have a name, but name length is 0");
}
// Return length of the name
- return(name_size);
+ return (name_size);
}
//--------------------------------------------------------------------------
@@ -455,7 +468,8 @@ ssize_t H5Object::getObjName(char *obj_name, size_t buf_size) const
///\exception H5::Exception
// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
-H5std_string H5Object::getObjName() const
+H5std_string
+H5Object::getObjName() const
{
H5std_string obj_name(""); // object name to return
@@ -463,31 +477,28 @@ H5std_string H5Object::getObjName() const
ssize_t name_size = H5Iget_name(getId(), NULL, static_cast<size_t>(0));
// If H5Iget_name failed, throw exception
- if (name_size < 0)
- {
+ if (name_size < 0) {
throw Exception(inMemFunc("getObjName"), "H5Iget_name failed");
}
- else if (name_size == 0)
- {
+ else if (name_size == 0) {
throw Exception(inMemFunc("getObjName"), "Object must have a name, but name length is 0");
}
// Object's name exists, retrieve it
- else if (name_size > 0)
- {
- char* name_C = new char[name_size+1]; // temporary C-string
- HDmemset(name_C, 0, name_size+1); // clear buffer
+ else if (name_size > 0) {
+ char *name_C = new char[name_size + 1]; // temporary C-string
+ HDmemset(name_C, 0, name_size + 1); // clear buffer
// Use overloaded function
- name_size = getObjName(name_C, name_size+1);
+ name_size = getObjName(name_C, name_size + 1);
// Convert the C object name to return
obj_name = name_C;
// Clean up resource
- delete []name_C;
+ delete[] name_C;
}
// Return object's name
- return(obj_name);
+ return (obj_name);
}
//--------------------------------------------------------------------------
@@ -503,35 +514,34 @@ H5std_string H5Object::getObjName() const
/// which case the entire name will be retrieved.
// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
-ssize_t H5Object::getObjName(H5std_string& obj_name, size_t len) const
+ssize_t
+H5Object::getObjName(H5std_string &obj_name, size_t len) const
{
ssize_t name_size = 0;
// If no length is provided, get the entire object name
- if (len == 0)
- {
- obj_name = getObjName();
+ if (len == 0) {
+ obj_name = getObjName();
name_size = obj_name.length();
}
// If length is provided, get that number of characters in name
- else
- {
- char* name_C = new char[len+1]; // temporary C-string
- HDmemset(name_C, 0, len+1); // clear buffer
+ else {
+ char *name_C = new char[len + 1]; // temporary C-string
+ HDmemset(name_C, 0, len + 1); // clear buffer
// Use overloaded function
- name_size = getObjName(name_C, len+1);
+ name_size = getObjName(name_C, len + 1);
// Convert the C object name to return
obj_name = name_C;
// Clean up resource
- delete []name_C;
+ delete[] name_C;
}
// Otherwise, keep obj_name intact
// Return name size
- return(name_size);
+ return (name_size);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -543,4 +553,4 @@ ssize_t H5Object::getObjName(H5std_string& obj_name, size_t len) const
H5Object::~H5Object() {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h
index a63229c..104e2a5 100644
--- a/c++/src/H5Object.h
+++ b/c++/src/H5Object.h
@@ -40,94 +40,92 @@ namespace H5 {
// Inheritance: H5Location -> IdComponent
// Define the operator function pointer for H5Aiterate().
-typedef void (*attr_operator_t)(H5Object& loc,
- const H5std_string attr_name,
- void *operator_data);
+typedef void (*attr_operator_t)(H5Object &loc, const H5std_string attr_name, void *operator_data);
// Define the operator function pointer for H5Ovisit3().
-typedef int (*visit_operator_t)(H5Object& obj,
- const H5std_string attr_name,
- const H5O_info2_t *oinfo,
- void *operator_data);
+typedef int (*visit_operator_t)(H5Object &obj, const H5std_string attr_name, const H5O_info2_t *oinfo,
+ void *operator_data);
// User data for attribute iteration
class UserData4Aiterate {
- public:
- attr_operator_t op;
- void* opData;
- H5Object* location; // Consider changing to H5Location
+ public:
+ attr_operator_t op;
+ void * opData;
+ H5Object * location; // Consider changing to H5Location
};
// User data for visit iteration
class UserData4Visit {
- public:
- visit_operator_t op;
- void* opData;
- H5Object* obj;
+ public:
+ visit_operator_t op;
+ void * opData;
+ H5Object * obj;
};
class H5_DLLCPP H5Object : public H5Location {
- public:
- // Creates an attribute for the specified object
- // PropList is currently not used, so always be default.
- Attribute createAttribute(const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const;
- Attribute createAttribute(const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const;
+ public:
+ // Creates an attribute for the specified object
+ // PropList is currently not used, so always be default.
+ Attribute createAttribute(const char *name, const DataType &type, const DataSpace &space,
+ const PropList &create_plist = PropList::DEFAULT) const;
+ Attribute createAttribute(const H5std_string &name, const DataType &type, const DataSpace &space,
+ const PropList &create_plist = PropList::DEFAULT) const;
- // Given its name, opens the attribute that belongs to an object at
- // this location.
- Attribute openAttribute(const char* name) const;
- Attribute openAttribute(const H5std_string& name) const;
+ // Given its name, opens the attribute that belongs to an object at
+ // this location.
+ Attribute openAttribute(const char *name) const;
+ Attribute openAttribute(const H5std_string &name) const;
- // Given its index, opens the attribute that belongs to an object at
- // this location.
- Attribute openAttribute(const unsigned int idx) const;
+ // Given its index, opens the attribute that belongs to an object at
+ // this location.
+ Attribute openAttribute(const unsigned int idx) const;
- // Iterate user's function over the attributes of this object.
- int iterateAttrs(attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL);
+ // Iterate user's function over the attributes of this object.
+ int iterateAttrs(attr_operator_t user_op, unsigned *idx = NULL, void *op_data = NULL);
- // Recursively visit elements reachable from this object.
- void visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_t user_op, void *op_data, unsigned int fields);
+ // Recursively visit elements reachable from this object.
+ void visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_t user_op, void *op_data,
+ unsigned int fields);
- // Returns the object header version of an object
- unsigned objVersion() const;
+ // Returns the object header version of an object
+ unsigned objVersion() const;
- // Determines the number of attributes belong to this object.
- int getNumAttrs() const;
+ // Determines the number of attributes belong to this object.
+ int getNumAttrs() const;
- // Checks whether the named attribute exists for this object.
- bool attrExists(const char* name) const;
- bool attrExists(const H5std_string& name) const;
+ // Checks whether the named attribute exists for this object.
+ bool attrExists(const char *name) const;
+ bool attrExists(const H5std_string &name) const;
- // Renames the named attribute to a new name.
- void renameAttr(const char* oldname, const char* newname) const;
- void renameAttr(const H5std_string& oldname, const H5std_string& newname) const;
+ // Renames the named attribute to a new name.
+ void renameAttr(const char *oldname, const char *newname) const;
+ void renameAttr(const H5std_string &oldname, const H5std_string &newname) const;
- // Removes the named attribute from this object.
- void removeAttr(const char* name) const;
- void removeAttr(const H5std_string& name) const;
+ // Removes the named attribute from this object.
+ void removeAttr(const char *name) const;
+ void removeAttr(const H5std_string &name) const;
- // Returns an identifier.
- virtual hid_t getId() const = 0;
-
- // Gets the name of this HDF5 object, i.e., Group, DataSet, or
- // DataType.
- ssize_t getObjName(char *obj_name, size_t buf_size = 0) const;
- ssize_t getObjName(H5std_string& obj_name, size_t len = 0) const;
- H5std_string getObjName() const;
+ // Returns an identifier.
+ virtual hid_t getId() const = 0;
+ // Gets the name of this HDF5 object, i.e., Group, DataSet, or
+ // DataType.
+ ssize_t getObjName(char *obj_name, size_t buf_size = 0) const;
+ ssize_t getObjName(H5std_string &obj_name, size_t len = 0) const;
+ H5std_string getObjName() const;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- protected:
- // Default constructor
- H5Object();
+ protected:
+ // Default constructor
+ H5Object();
- // Sets the identifier of this object to a new value. - this one
- // doesn't increment reference count
- virtual void p_setId(const hid_t new_id) = 0;
+ // Sets the identifier of this object to a new value. - this one
+ // doesn't increment reference count
+ virtual void p_setId(const hid_t new_id) = 0;
- // Noop destructor.
- virtual ~H5Object();
+ // Noop destructor.
+ virtual ~H5Object();
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5OcreatProp.cpp b/c++/src/H5OcreatProp.cpp
index 0542d5e..a5af9df 100644
--- a/c++/src/H5OcreatProp.cpp
+++ b/c++/src/H5OcreatProp.cpp
@@ -27,7 +27,7 @@ namespace H5 {
// in "H5PredType.cpp" for information.
// Initialize a pointer for the constant
-ObjCreatPropList* ObjCreatPropList::DEFAULT_ = 0;
+ObjCreatPropList *ObjCreatPropList::DEFAULT_ = 0;
//--------------------------------------------------------------------------
// Function: ObjCreatPropList::getConstant
@@ -40,13 +40,13 @@ ObjCreatPropList* ObjCreatPropList::DEFAULT_ = 0;
// happen.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-ObjCreatPropList* ObjCreatPropList::getConstant()
+ObjCreatPropList *
+ObjCreatPropList::getConstant()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -55,8 +55,9 @@ ObjCreatPropList* ObjCreatPropList::getConstant()
if (DEFAULT_ == 0)
DEFAULT_ = new ObjCreatPropList(H5P_OBJECT_CREATE);
else
- throw PropListIException("ObjCreatPropList::getConstant", "ObjCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
- return(DEFAULT_);
+ throw PropListIException("ObjCreatPropList::getConstant",
+ "ObjCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return (DEFAULT_);
}
//--------------------------------------------------------------------------
@@ -66,7 +67,8 @@ ObjCreatPropList* ObjCreatPropList::getConstant()
// exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void ObjCreatPropList::deleteConstants()
+void
+ObjCreatPropList::deleteConstants()
{
if (DEFAULT_ != 0)
delete DEFAULT_;
@@ -75,7 +77,7 @@ void ObjCreatPropList::deleteConstants()
//--------------------------------------------------------------------------
// Purpose: Constant for default property
//--------------------------------------------------------------------------
-const ObjCreatPropList& ObjCreatPropList::DEFAULT = *getConstant();
+const ObjCreatPropList &ObjCreatPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -92,7 +94,7 @@ ObjCreatPropList::ObjCreatPropList() : PropList(H5P_OBJECT_CREATE) {}
///\param original - IN: ObjCreatPropList instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-ObjCreatPropList::ObjCreatPropList(const ObjCreatPropList& original) : PropList(original) {}
+ObjCreatPropList::ObjCreatPropList(const ObjCreatPropList &original) : PropList(original) {}
//--------------------------------------------------------------------------
// Function: ObjCreatPropList overloaded constructor
@@ -116,11 +118,11 @@ ObjCreatPropList::ObjCreatPropList(const hid_t plist_id) : PropList(plist_id) {}
/// H5Pset_attr_phase_change API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
-void ObjCreatPropList::setAttrPhaseChange(unsigned max_compact, unsigned min_dense) const
+void
+ObjCreatPropList::setAttrPhaseChange(unsigned max_compact, unsigned min_dense) const
{
herr_t ret_value = H5Pset_attr_phase_change(id, max_compact, min_dense);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("ObjCreatPropList::setAttrPhaseChange", "H5Pset_attr_phase_change failed");
}
}
@@ -139,12 +141,12 @@ void ObjCreatPropList::setAttrPhaseChange(unsigned max_compact, unsigned min_den
/// H5Pget_attr_phase_change API in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
-void ObjCreatPropList::getAttrPhaseChange(unsigned& max_compact, unsigned& min_dense) const
+void
+ObjCreatPropList::getAttrPhaseChange(unsigned &max_compact, unsigned &min_dense) const
{
herr_t ret_value;
ret_value = H5Pget_attr_phase_change(id, &max_compact, &min_dense);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("ObjCreatPropList::getAttrPhaseChange", "H5Pget_attr_phase_change failed");
}
}
@@ -168,11 +170,11 @@ void ObjCreatPropList::getAttrPhaseChange(unsigned& max_compact, unsigned& min_d
/// in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
-void ObjCreatPropList::setAttrCrtOrder(unsigned crt_order_flags) const
+void
+ObjCreatPropList::setAttrCrtOrder(unsigned crt_order_flags) const
{
herr_t ret_value = H5Pset_attr_creation_order(id, crt_order_flags);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException("ObjCreatPropList::setAttrCrtOrder", "H5Pset_attr_creation_order failed");
}
}
@@ -190,16 +192,16 @@ void ObjCreatPropList::setAttrCrtOrder(unsigned crt_order_flags) const
/// in the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
-unsigned ObjCreatPropList::getAttrCrtOrder() const
+unsigned
+ObjCreatPropList::getAttrCrtOrder() const
{
- herr_t ret_value;
+ herr_t ret_value;
unsigned crt_order_flags = 0;
- ret_value = H5Pget_attr_creation_order(id, &crt_order_flags);
- if (ret_value < 0)
- {
+ ret_value = H5Pget_attr_creation_order(id, &crt_order_flags);
+ if (ret_value < 0) {
throw PropListIException("ObjCreatPropList::getAttrCrtOrder", "H5Pget_attr_creation_order failed");
}
- return(crt_order_flags);
+ return (crt_order_flags);
}
//--------------------------------------------------------------------------
@@ -209,4 +211,4 @@ unsigned ObjCreatPropList::getAttrCrtOrder() const
//--------------------------------------------------------------------------
ObjCreatPropList::~ObjCreatPropList() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5OcreatProp.h b/c++/src/H5OcreatProp.h
index 1d5dd55..ffafd44 100644
--- a/c++/src/H5OcreatProp.h
+++ b/c++/src/H5OcreatProp.h
@@ -23,49 +23,52 @@ namespace H5 {
*/
// Inheritance: PropList -> IdComponent
class H5_DLLCPP ObjCreatPropList : public PropList {
- public:
- ///\brief Default object creation property list.
- static const ObjCreatPropList& DEFAULT;
+ public:
+ ///\brief Default object creation property list.
+ static const ObjCreatPropList &DEFAULT;
- // Creates a object creation property list.
- ObjCreatPropList();
+ // Creates a object creation property list.
+ ObjCreatPropList();
- // Sets attribute storage phase change thresholds.
- void setAttrPhaseChange(unsigned max_compact = 8, unsigned min_dense = 6) const;
+ // Sets attribute storage phase change thresholds.
+ void setAttrPhaseChange(unsigned max_compact = 8, unsigned min_dense = 6) const;
- // Gets attribute storage phase change thresholds.
- void getAttrPhaseChange(unsigned& max_compact, unsigned& min_dense) const;
+ // Gets attribute storage phase change thresholds.
+ void getAttrPhaseChange(unsigned &max_compact, unsigned &min_dense) const;
- // Sets tracking and indexing of attribute creation order.
- void setAttrCrtOrder(unsigned crt_order_flags) const;
+ // Sets tracking and indexing of attribute creation order.
+ void setAttrCrtOrder(unsigned crt_order_flags) const;
- // Gets tracking and indexing settings for attribute creation order.
- unsigned getAttrCrtOrder() const;
+ // Gets tracking and indexing settings for attribute creation order.
+ unsigned getAttrCrtOrder() const;
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("ObjCreatPropList");
+ }
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("ObjCreatPropList"); }
+ // Copy constructor: same as the original ObjCreatPropList.
+ ObjCreatPropList(const ObjCreatPropList &original);
- // Copy constructor: same as the original ObjCreatPropList.
- ObjCreatPropList(const ObjCreatPropList& original);
+ // Creates a copy of an existing object creation property list
+ // using the property list id.
+ ObjCreatPropList(const hid_t plist_id);
- // Creates a copy of an existing object creation property list
- // using the property list id.
- ObjCreatPropList (const hid_t plist_id);
-
- // Noop destructor
- virtual ~ObjCreatPropList();
+ // Noop destructor
+ virtual ~ObjCreatPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the global constant, should only be used by the library
- static void deleteConstants();
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
- private:
- static ObjCreatPropList* DEFAULT_;
+ private:
+ static ObjCreatPropList *DEFAULT_;
- // Creates the global constant, should only be used by the library
- static ObjCreatPropList* getConstant();
+ // Creates the global constant, should only be used by the library
+ static ObjCreatPropList *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp
index 57ba5e5..0339f4e 100644
--- a/c++/src/H5PredType.cpp
+++ b/c++/src/H5PredType.cpp
@@ -41,10 +41,7 @@ namespace H5 {
// the provided HDF5 predefined datatype.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-PredType::PredType(const hid_t predtype_id) : AtomType(predtype_id)
-{
- id = H5Tcopy(predtype_id);
-}
+PredType::PredType(const hid_t predtype_id) : AtomType(predtype_id) { id = H5Tcopy(predtype_id); }
//--------------------------------------------------------------------------
// Function: PredType default constructor
@@ -60,7 +57,7 @@ PredType::PredType() : AtomType() {}
///\param original - IN: PredType instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-PredType::PredType(const PredType& original) : AtomType(original) {}
+PredType::PredType(const PredType &original) : AtomType(original) {}
//--------------------------------------------------------------------------
// Function: PredType::operator=
@@ -73,29 +70,35 @@ PredType::PredType(const PredType& original) : AtomType(original) {}
// the new id in the left hand side object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-PredType& PredType::operator=(const PredType& rhs)
+PredType &
+PredType::operator=(const PredType &rhs)
{
if (this != &rhs)
copy(rhs);
- return(*this);
+ return (*this);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// These dummy functions do not inherit from DataType - they'll
// throw an DataTypeIException if invoked.
-void PredType::commit(H5Location& loc, const char* name)
+void
+PredType::commit(H5Location &loc, const char *name)
{
- throw DataTypeIException("PredType::commit", "Error: Attempted to commit a predefined datatype. Invalid operation!");
+ throw DataTypeIException("PredType::commit",
+ "Error: Attempted to commit a predefined datatype. Invalid operation!");
}
-void PredType::commit(H5Location& loc, const H5std_string& name)
+void
+PredType::commit(H5Location &loc, const H5std_string &name)
{
commit(loc, name.c_str());
}
-bool PredType::committed()
+bool
+PredType::committed()
{
- throw DataTypeIException("PredType::committed", "Error: Attempting to check for commit status on a predefined datatype.");
+ throw DataTypeIException("PredType::committed",
+ "Error: Attempting to check for commit status on a predefined datatype.");
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -115,180 +118,180 @@ PredType::~PredType() {}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// Definition pointers for the constants
-PredType* PredType::PREDTYPE_CONST_ = 0; //dummy
-PredType* PredType::STD_I8BE_;
-PredType* PredType::STD_I8LE_;
-PredType* PredType::STD_I16BE_;
-PredType* PredType::STD_I16LE_;
-PredType* PredType::STD_I32BE_;
-PredType* PredType::STD_I32LE_;
-PredType* PredType::STD_I64BE_;
-PredType* PredType::STD_I64LE_;
-PredType* PredType::STD_U8BE_;
-PredType* PredType::STD_U8LE_;
-PredType* PredType::STD_U16BE_;
-PredType* PredType::STD_U16LE_;
-PredType* PredType::STD_U32BE_;
-PredType* PredType::STD_U32LE_;
-PredType* PredType::STD_U64BE_;
-PredType* PredType::STD_U64LE_;
-PredType* PredType::STD_B8BE_;
-PredType* PredType::STD_B8LE_;
-PredType* PredType::STD_B16BE_;
-PredType* PredType::STD_B16LE_;
-PredType* PredType::STD_B32BE_;
-PredType* PredType::STD_B32LE_;
-PredType* PredType::STD_B64BE_;
-PredType* PredType::STD_B64LE_;
-PredType* PredType::STD_REF_OBJ_;
-PredType* PredType::STD_REF_DSETREG_;
-
-PredType* PredType::C_S1_;
-PredType* PredType::FORTRAN_S1_;
-
-PredType* PredType::IEEE_F32BE_;
-PredType* PredType::IEEE_F32LE_;
-PredType* PredType::IEEE_F64BE_;
-PredType* PredType::IEEE_F64LE_;
-
-PredType* PredType::UNIX_D32BE_;
-PredType* PredType::UNIX_D32LE_;
-PredType* PredType::UNIX_D64BE_;
-PredType* PredType::UNIX_D64LE_;
-
-PredType* PredType::INTEL_I8_;
-PredType* PredType::INTEL_I16_;
-PredType* PredType::INTEL_I32_;
-PredType* PredType::INTEL_I64_;
-PredType* PredType::INTEL_U8_;
-PredType* PredType::INTEL_U16_;
-PredType* PredType::INTEL_U32_;
-PredType* PredType::INTEL_U64_;
-PredType* PredType::INTEL_B8_;
-PredType* PredType::INTEL_B16_;
-PredType* PredType::INTEL_B32_;
-PredType* PredType::INTEL_B64_;
-PredType* PredType::INTEL_F32_;
-PredType* PredType::INTEL_F64_;
-
-PredType* PredType::ALPHA_I8_;
-PredType* PredType::ALPHA_I16_;
-PredType* PredType::ALPHA_I32_;
-PredType* PredType::ALPHA_I64_;
-PredType* PredType::ALPHA_U8_;
-PredType* PredType::ALPHA_U16_;
-PredType* PredType::ALPHA_U32_;
-PredType* PredType::ALPHA_U64_;
-PredType* PredType::ALPHA_B8_;
-PredType* PredType::ALPHA_B16_;
-PredType* PredType::ALPHA_B32_;
-PredType* PredType::ALPHA_B64_;
-PredType* PredType::ALPHA_F32_;
-PredType* PredType::ALPHA_F64_;
-
-PredType* PredType::MIPS_I8_;
-PredType* PredType::MIPS_I16_;
-PredType* PredType::MIPS_I32_;
-PredType* PredType::MIPS_I64_;
-PredType* PredType::MIPS_U8_;
-PredType* PredType::MIPS_U16_;
-PredType* PredType::MIPS_U32_;
-PredType* PredType::MIPS_U64_;
-PredType* PredType::MIPS_B8_;
-PredType* PredType::MIPS_B16_;
-PredType* PredType::MIPS_B32_;
-PredType* PredType::MIPS_B64_;
-PredType* PredType::MIPS_F32_;
-PredType* PredType::MIPS_F64_;
-
-PredType* PredType::NATIVE_CHAR_;
-PredType* PredType::NATIVE_SCHAR_;
-PredType* PredType::NATIVE_UCHAR_;
-PredType* PredType::NATIVE_SHORT_;
-PredType* PredType::NATIVE_USHORT_;
-PredType* PredType::NATIVE_INT_;
-PredType* PredType::NATIVE_UINT_;
-PredType* PredType::NATIVE_LONG_;
-PredType* PredType::NATIVE_ULONG_;
-PredType* PredType::NATIVE_LLONG_;
-PredType* PredType::NATIVE_ULLONG_;
-PredType* PredType::NATIVE_FLOAT_;
-PredType* PredType::NATIVE_DOUBLE_;
-PredType* PredType::NATIVE_LDOUBLE_;
-PredType* PredType::NATIVE_B8_;
-PredType* PredType::NATIVE_B16_;
-PredType* PredType::NATIVE_B32_;
-PredType* PredType::NATIVE_B64_;
-PredType* PredType::NATIVE_OPAQUE_;
-PredType* PredType::NATIVE_HSIZE_;
-PredType* PredType::NATIVE_HSSIZE_;
-PredType* PredType::NATIVE_HERR_;
-PredType* PredType::NATIVE_HBOOL_;
-
-PredType* PredType::NATIVE_INT8_;
-PredType* PredType::NATIVE_UINT8_;
-PredType* PredType::NATIVE_INT16_;
-PredType* PredType::NATIVE_UINT16_;
-PredType* PredType::NATIVE_INT32_;
-PredType* PredType::NATIVE_UINT32_;
-PredType* PredType::NATIVE_INT64_;
-PredType* PredType::NATIVE_UINT64_;
+PredType *PredType::PREDTYPE_CONST_ = 0; // dummy
+PredType *PredType::STD_I8BE_;
+PredType *PredType::STD_I8LE_;
+PredType *PredType::STD_I16BE_;
+PredType *PredType::STD_I16LE_;
+PredType *PredType::STD_I32BE_;
+PredType *PredType::STD_I32LE_;
+PredType *PredType::STD_I64BE_;
+PredType *PredType::STD_I64LE_;
+PredType *PredType::STD_U8BE_;
+PredType *PredType::STD_U8LE_;
+PredType *PredType::STD_U16BE_;
+PredType *PredType::STD_U16LE_;
+PredType *PredType::STD_U32BE_;
+PredType *PredType::STD_U32LE_;
+PredType *PredType::STD_U64BE_;
+PredType *PredType::STD_U64LE_;
+PredType *PredType::STD_B8BE_;
+PredType *PredType::STD_B8LE_;
+PredType *PredType::STD_B16BE_;
+PredType *PredType::STD_B16LE_;
+PredType *PredType::STD_B32BE_;
+PredType *PredType::STD_B32LE_;
+PredType *PredType::STD_B64BE_;
+PredType *PredType::STD_B64LE_;
+PredType *PredType::STD_REF_OBJ_;
+PredType *PredType::STD_REF_DSETREG_;
+
+PredType *PredType::C_S1_;
+PredType *PredType::FORTRAN_S1_;
+
+PredType *PredType::IEEE_F32BE_;
+PredType *PredType::IEEE_F32LE_;
+PredType *PredType::IEEE_F64BE_;
+PredType *PredType::IEEE_F64LE_;
+
+PredType *PredType::UNIX_D32BE_;
+PredType *PredType::UNIX_D32LE_;
+PredType *PredType::UNIX_D64BE_;
+PredType *PredType::UNIX_D64LE_;
+
+PredType *PredType::INTEL_I8_;
+PredType *PredType::INTEL_I16_;
+PredType *PredType::INTEL_I32_;
+PredType *PredType::INTEL_I64_;
+PredType *PredType::INTEL_U8_;
+PredType *PredType::INTEL_U16_;
+PredType *PredType::INTEL_U32_;
+PredType *PredType::INTEL_U64_;
+PredType *PredType::INTEL_B8_;
+PredType *PredType::INTEL_B16_;
+PredType *PredType::INTEL_B32_;
+PredType *PredType::INTEL_B64_;
+PredType *PredType::INTEL_F32_;
+PredType *PredType::INTEL_F64_;
+
+PredType *PredType::ALPHA_I8_;
+PredType *PredType::ALPHA_I16_;
+PredType *PredType::ALPHA_I32_;
+PredType *PredType::ALPHA_I64_;
+PredType *PredType::ALPHA_U8_;
+PredType *PredType::ALPHA_U16_;
+PredType *PredType::ALPHA_U32_;
+PredType *PredType::ALPHA_U64_;
+PredType *PredType::ALPHA_B8_;
+PredType *PredType::ALPHA_B16_;
+PredType *PredType::ALPHA_B32_;
+PredType *PredType::ALPHA_B64_;
+PredType *PredType::ALPHA_F32_;
+PredType *PredType::ALPHA_F64_;
+
+PredType *PredType::MIPS_I8_;
+PredType *PredType::MIPS_I16_;
+PredType *PredType::MIPS_I32_;
+PredType *PredType::MIPS_I64_;
+PredType *PredType::MIPS_U8_;
+PredType *PredType::MIPS_U16_;
+PredType *PredType::MIPS_U32_;
+PredType *PredType::MIPS_U64_;
+PredType *PredType::MIPS_B8_;
+PredType *PredType::MIPS_B16_;
+PredType *PredType::MIPS_B32_;
+PredType *PredType::MIPS_B64_;
+PredType *PredType::MIPS_F32_;
+PredType *PredType::MIPS_F64_;
+
+PredType *PredType::NATIVE_CHAR_;
+PredType *PredType::NATIVE_SCHAR_;
+PredType *PredType::NATIVE_UCHAR_;
+PredType *PredType::NATIVE_SHORT_;
+PredType *PredType::NATIVE_USHORT_;
+PredType *PredType::NATIVE_INT_;
+PredType *PredType::NATIVE_UINT_;
+PredType *PredType::NATIVE_LONG_;
+PredType *PredType::NATIVE_ULONG_;
+PredType *PredType::NATIVE_LLONG_;
+PredType *PredType::NATIVE_ULLONG_;
+PredType *PredType::NATIVE_FLOAT_;
+PredType *PredType::NATIVE_DOUBLE_;
+PredType *PredType::NATIVE_LDOUBLE_;
+PredType *PredType::NATIVE_B8_;
+PredType *PredType::NATIVE_B16_;
+PredType *PredType::NATIVE_B32_;
+PredType *PredType::NATIVE_B64_;
+PredType *PredType::NATIVE_OPAQUE_;
+PredType *PredType::NATIVE_HSIZE_;
+PredType *PredType::NATIVE_HSSIZE_;
+PredType *PredType::NATIVE_HERR_;
+PredType *PredType::NATIVE_HBOOL_;
+
+PredType *PredType::NATIVE_INT8_;
+PredType *PredType::NATIVE_UINT8_;
+PredType *PredType::NATIVE_INT16_;
+PredType *PredType::NATIVE_UINT16_;
+PredType *PredType::NATIVE_INT32_;
+PredType *PredType::NATIVE_UINT32_;
+PredType *PredType::NATIVE_INT64_;
+PredType *PredType::NATIVE_UINT64_;
// LEAST types
#if H5_SIZEOF_INT_LEAST8_T != 0
-PredType* PredType::NATIVE_INT_LEAST8_;
+PredType *PredType::NATIVE_INT_LEAST8_;
#endif /* H5_SIZEOF_INT_LEAST8_T */
#if H5_SIZEOF_UINT_LEAST8_T != 0
-PredType* PredType::NATIVE_UINT_LEAST8_;
+PredType *PredType::NATIVE_UINT_LEAST8_;
#endif /* H5_SIZEOF_UINT_LEAST8_T */
#if H5_SIZEOF_INT_LEAST16_T != 0
-PredType* PredType::NATIVE_INT_LEAST16_;
+PredType *PredType::NATIVE_INT_LEAST16_;
#endif /* H5_SIZEOF_INT_LEAST16_T */
#if H5_SIZEOF_UINT_LEAST16_T != 0
-PredType* PredType::NATIVE_UINT_LEAST16_;
+PredType *PredType::NATIVE_UINT_LEAST16_;
#endif /* H5_SIZEOF_UINT_LEAST16_T */
#if H5_SIZEOF_INT_LEAST32_T != 0
-PredType* PredType::NATIVE_INT_LEAST32_;
+PredType *PredType::NATIVE_INT_LEAST32_;
#endif /* H5_SIZEOF_INT_LEAST32_T */
#if H5_SIZEOF_UINT_LEAST32_T != 0
-PredType* PredType::NATIVE_UINT_LEAST32_;
+PredType *PredType::NATIVE_UINT_LEAST32_;
#endif /* H5_SIZEOF_UINT_LEAST32_T */
#if H5_SIZEOF_INT_LEAST64_T != 0
-PredType* PredType::NATIVE_INT_LEAST64_;
+PredType *PredType::NATIVE_INT_LEAST64_;
#endif /* H5_SIZEOF_INT_LEAST64_T */
#if H5_SIZEOF_UINT_LEAST64_T != 0
-PredType* PredType::NATIVE_UINT_LEAST64_;
+PredType *PredType::NATIVE_UINT_LEAST64_;
#endif /* H5_SIZEOF_UINT_LEAST64_T */
// FAST types
#if H5_SIZEOF_INT_FAST8_T != 0
-PredType* PredType::NATIVE_INT_FAST8_;
+PredType *PredType::NATIVE_INT_FAST8_;
#endif /* H5_SIZEOF_INT_FAST8_T */
#if H5_SIZEOF_UINT_FAST8_T != 0
-PredType* PredType::NATIVE_UINT_FAST8_;
+PredType *PredType::NATIVE_UINT_FAST8_;
#endif /* H5_SIZEOF_UINT_FAST8_T */
#if H5_SIZEOF_INT_FAST16_T != 0
-PredType* PredType::NATIVE_INT_FAST16_;
+PredType *PredType::NATIVE_INT_FAST16_;
#endif /* H5_SIZEOF_INT_FAST16_T */
#if H5_SIZEOF_UINT_FAST16_T != 0
-PredType* PredType::NATIVE_UINT_FAST16_;
+PredType *PredType::NATIVE_UINT_FAST16_;
#endif /* H5_SIZEOF_UINT_FAST16_T */
#if H5_SIZEOF_INT_FAST32_T != 0
-PredType* PredType::NATIVE_INT_FAST32_;
+PredType *PredType::NATIVE_INT_FAST32_;
#endif /* H5_SIZEOF_INT_FAST32_T */
#if H5_SIZEOF_UINT_FAST32_T != 0
-PredType* PredType::NATIVE_UINT_FAST32_;
+PredType *PredType::NATIVE_UINT_FAST32_;
#endif /* H5_SIZEOF_UINT_FAST32_T */
#if H5_SIZEOF_INT_FAST64_T != 0
-PredType* PredType::NATIVE_INT_FAST64_;
+PredType *PredType::NATIVE_INT_FAST64_;
#endif /* H5_SIZEOF_INT_FAST64_T */
#if H5_SIZEOF_UINT_FAST64_T != 0
-PredType* PredType::NATIVE_UINT_FAST64_;
+PredType *PredType::NATIVE_UINT_FAST64_;
#endif /* H5_SIZEOF_UINT_FAST64_T */
//--------------------------------------------------------------------------
@@ -305,13 +308,13 @@ PredType* PredType::NATIVE_UINT_FAST64_;
//
// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
-PredType* PredType::getPredTypes()
+PredType *
+PredType::getPredTypes()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -320,7 +323,9 @@ PredType* PredType::getPredTypes()
if (PREDTYPE_CONST_ == 0)
makePredTypes();
else
- throw H5::DataTypeIException("PredType::getPredTypes", "PredType::getPredTypes is being invoked on an allocated PREDTYPE_CONST_");
+ throw H5::DataTypeIException(
+ "PredType::getPredTypes",
+ "PredType::getPredTypes is being invoked on an allocated PREDTYPE_CONST_");
return PREDTYPE_CONST_;
}
@@ -329,38 +334,39 @@ PredType* PredType::getPredTypes()
// Purpose Allocate all PredType constants.
// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
-void PredType::makePredTypes()
+void
+PredType::makePredTypes()
{
PREDTYPE_CONST_ = new PredType;
- C_S1_ = new PredType(H5T_C_S1);
- FORTRAN_S1_ = new PredType(H5T_FORTRAN_S1);
+ C_S1_ = new PredType(H5T_C_S1);
+ FORTRAN_S1_ = new PredType(H5T_FORTRAN_S1);
- STD_I8BE_ = new PredType(H5T_STD_I8BE);
- STD_I8LE_ = new PredType(H5T_STD_I8LE);
+ STD_I8BE_ = new PredType(H5T_STD_I8BE);
+ STD_I8LE_ = new PredType(H5T_STD_I8LE);
STD_I16BE_ = new PredType(H5T_STD_I16BE);
STD_I16LE_ = new PredType(H5T_STD_I16LE);
STD_I32BE_ = new PredType(H5T_STD_I32BE);
STD_I32LE_ = new PredType(H5T_STD_I32LE);
STD_I64BE_ = new PredType(H5T_STD_I64BE);
STD_I64LE_ = new PredType(H5T_STD_I64LE);
- STD_U8BE_ = new PredType(H5T_STD_U8BE);
- STD_U8LE_ = new PredType(H5T_STD_U8LE);
+ STD_U8BE_ = new PredType(H5T_STD_U8BE);
+ STD_U8LE_ = new PredType(H5T_STD_U8LE);
STD_U16BE_ = new PredType(H5T_STD_U16BE);
STD_U16LE_ = new PredType(H5T_STD_U16LE);
STD_U32BE_ = new PredType(H5T_STD_U32BE);
STD_U32LE_ = new PredType(H5T_STD_U32LE);
STD_U64BE_ = new PredType(H5T_STD_U64BE);
STD_U64LE_ = new PredType(H5T_STD_U64LE);
- STD_B8BE_ = new PredType(H5T_STD_B8BE);
- STD_B8LE_ = new PredType(H5T_STD_B8LE);
-
- STD_B16BE_ = new PredType(H5T_STD_B16BE);
- STD_B16LE_ = new PredType(H5T_STD_B16LE);
- STD_B32BE_ = new PredType(H5T_STD_B32BE);
- STD_B32LE_ = new PredType(H5T_STD_B32LE);
- STD_B64BE_ = new PredType(H5T_STD_B64BE);
- STD_B64LE_ = new PredType(H5T_STD_B64LE);
- STD_REF_OBJ_ = new PredType(H5T_STD_REF_OBJ);
+ STD_B8BE_ = new PredType(H5T_STD_B8BE);
+ STD_B8LE_ = new PredType(H5T_STD_B8LE);
+
+ STD_B16BE_ = new PredType(H5T_STD_B16BE);
+ STD_B16LE_ = new PredType(H5T_STD_B16LE);
+ STD_B32BE_ = new PredType(H5T_STD_B32BE);
+ STD_B32LE_ = new PredType(H5T_STD_B32LE);
+ STD_B64BE_ = new PredType(H5T_STD_B64BE);
+ STD_B64LE_ = new PredType(H5T_STD_B64LE);
+ STD_REF_OBJ_ = new PredType(H5T_STD_REF_OBJ);
STD_REF_DSETREG_ = new PredType(H5T_STD_REF_DSETREG);
IEEE_F32BE_ = new PredType(H5T_IEEE_F32BE);
@@ -373,84 +379,84 @@ void PredType::makePredTypes()
UNIX_D64BE_ = new PredType(H5T_UNIX_D64BE);
UNIX_D64LE_ = new PredType(H5T_UNIX_D64LE);
- INTEL_I8_ = new PredType(H5T_INTEL_I8);
+ INTEL_I8_ = new PredType(H5T_INTEL_I8);
INTEL_I16_ = new PredType(H5T_INTEL_I16);
INTEL_I32_ = new PredType(H5T_INTEL_I32);
INTEL_I64_ = new PredType(H5T_INTEL_I64);
- INTEL_U8_ = new PredType(H5T_INTEL_U8);
+ INTEL_U8_ = new PredType(H5T_INTEL_U8);
INTEL_U16_ = new PredType(H5T_INTEL_U16);
INTEL_U32_ = new PredType(H5T_INTEL_U32);
INTEL_U64_ = new PredType(H5T_INTEL_U64);
- INTEL_B8_ = new PredType(H5T_INTEL_B8);
+ INTEL_B8_ = new PredType(H5T_INTEL_B8);
INTEL_B16_ = new PredType(H5T_INTEL_B16);
INTEL_B32_ = new PredType(H5T_INTEL_B32);
INTEL_B64_ = new PredType(H5T_INTEL_B64);
INTEL_F32_ = new PredType(H5T_INTEL_F32);
INTEL_F64_ = new PredType(H5T_INTEL_F64);
- ALPHA_I8_ = new PredType(H5T_ALPHA_I8);
+ ALPHA_I8_ = new PredType(H5T_ALPHA_I8);
ALPHA_I16_ = new PredType(H5T_ALPHA_I16);
ALPHA_I32_ = new PredType(H5T_ALPHA_I32);
ALPHA_I64_ = new PredType(H5T_ALPHA_I64);
- ALPHA_U8_ = new PredType(H5T_ALPHA_U8);
+ ALPHA_U8_ = new PredType(H5T_ALPHA_U8);
ALPHA_U16_ = new PredType(H5T_ALPHA_U16);
ALPHA_U32_ = new PredType(H5T_ALPHA_U32);
ALPHA_U64_ = new PredType(H5T_ALPHA_U64);
- ALPHA_B8_ = new PredType(H5T_ALPHA_B8);
+ ALPHA_B8_ = new PredType(H5T_ALPHA_B8);
ALPHA_B16_ = new PredType(H5T_ALPHA_B16);
ALPHA_B32_ = new PredType(H5T_ALPHA_B32);
ALPHA_B64_ = new PredType(H5T_ALPHA_B64);
ALPHA_F32_ = new PredType(H5T_ALPHA_F32);
ALPHA_F64_ = new PredType(H5T_ALPHA_F64);
- MIPS_I8_ = new PredType(H5T_MIPS_I8);
+ MIPS_I8_ = new PredType(H5T_MIPS_I8);
MIPS_I16_ = new PredType(H5T_MIPS_I16);
MIPS_I32_ = new PredType(H5T_MIPS_I32);
MIPS_I64_ = new PredType(H5T_MIPS_I64);
- MIPS_U8_ = new PredType(H5T_MIPS_U8);
+ MIPS_U8_ = new PredType(H5T_MIPS_U8);
MIPS_U16_ = new PredType(H5T_MIPS_U16);
MIPS_U32_ = new PredType(H5T_MIPS_U32);
MIPS_U64_ = new PredType(H5T_MIPS_U64);
- MIPS_B8_ = new PredType(H5T_MIPS_B8);
+ MIPS_B8_ = new PredType(H5T_MIPS_B8);
MIPS_B16_ = new PredType(H5T_MIPS_B16);
MIPS_B32_ = new PredType(H5T_MIPS_B32);
MIPS_B64_ = new PredType(H5T_MIPS_B64);
MIPS_F32_ = new PredType(H5T_MIPS_F32);
MIPS_F64_ = new PredType(H5T_MIPS_F64);
- NATIVE_CHAR_ = new PredType(H5T_NATIVE_CHAR);
- NATIVE_INT_ = new PredType(H5T_NATIVE_INT);
- NATIVE_FLOAT_ = new PredType(H5T_NATIVE_FLOAT);
- NATIVE_SCHAR_ = new PredType(H5T_NATIVE_SCHAR);
- NATIVE_UCHAR_ = new PredType(H5T_NATIVE_UCHAR);
- NATIVE_SHORT_ = new PredType(H5T_NATIVE_SHORT);
+ NATIVE_CHAR_ = new PredType(H5T_NATIVE_CHAR);
+ NATIVE_INT_ = new PredType(H5T_NATIVE_INT);
+ NATIVE_FLOAT_ = new PredType(H5T_NATIVE_FLOAT);
+ NATIVE_SCHAR_ = new PredType(H5T_NATIVE_SCHAR);
+ NATIVE_UCHAR_ = new PredType(H5T_NATIVE_UCHAR);
+ NATIVE_SHORT_ = new PredType(H5T_NATIVE_SHORT);
NATIVE_USHORT_ = new PredType(H5T_NATIVE_USHORT);
- NATIVE_UINT_ = new PredType(H5T_NATIVE_UINT);
- NATIVE_LONG_ = new PredType(H5T_NATIVE_LONG);
- NATIVE_ULONG_ = new PredType(H5T_NATIVE_ULONG);
- NATIVE_LLONG_ = new PredType(H5T_NATIVE_LLONG);
+ NATIVE_UINT_ = new PredType(H5T_NATIVE_UINT);
+ NATIVE_LONG_ = new PredType(H5T_NATIVE_LONG);
+ NATIVE_ULONG_ = new PredType(H5T_NATIVE_ULONG);
+ NATIVE_LLONG_ = new PredType(H5T_NATIVE_LLONG);
NATIVE_ULLONG_ = new PredType(H5T_NATIVE_ULLONG);
NATIVE_DOUBLE_ = new PredType(H5T_NATIVE_DOUBLE);
-#if H5_SIZEOF_LONG_DOUBLE !=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
NATIVE_LDOUBLE_ = new PredType(H5T_NATIVE_LDOUBLE);
#endif
- NATIVE_B8_ = new PredType(H5T_NATIVE_B8);
- NATIVE_B16_ = new PredType(H5T_NATIVE_B16);
- NATIVE_B32_ = new PredType(H5T_NATIVE_B32);
- NATIVE_B64_ = new PredType(H5T_NATIVE_B64);
+ NATIVE_B8_ = new PredType(H5T_NATIVE_B8);
+ NATIVE_B16_ = new PredType(H5T_NATIVE_B16);
+ NATIVE_B32_ = new PredType(H5T_NATIVE_B32);
+ NATIVE_B64_ = new PredType(H5T_NATIVE_B64);
NATIVE_OPAQUE_ = new PredType(H5T_NATIVE_OPAQUE);
- NATIVE_HSIZE_ = new PredType(H5T_NATIVE_HSIZE);
+ NATIVE_HSIZE_ = new PredType(H5T_NATIVE_HSIZE);
NATIVE_HSSIZE_ = new PredType(H5T_NATIVE_HSSIZE);
- NATIVE_HERR_ = new PredType(H5T_NATIVE_HERR);
- NATIVE_HBOOL_ = new PredType(H5T_NATIVE_HBOOL);
+ NATIVE_HERR_ = new PredType(H5T_NATIVE_HERR);
+ NATIVE_HBOOL_ = new PredType(H5T_NATIVE_HBOOL);
- NATIVE_INT8_ = new PredType(H5T_NATIVE_INT8);
- NATIVE_UINT8_ = new PredType(H5T_NATIVE_UINT8);
- NATIVE_INT16_ = new PredType(H5T_NATIVE_INT16);
+ NATIVE_INT8_ = new PredType(H5T_NATIVE_INT8);
+ NATIVE_UINT8_ = new PredType(H5T_NATIVE_UINT8);
+ NATIVE_INT16_ = new PredType(H5T_NATIVE_INT16);
NATIVE_UINT16_ = new PredType(H5T_NATIVE_UINT16);
- NATIVE_INT32_ = new PredType(H5T_NATIVE_INT32);
+ NATIVE_INT32_ = new PredType(H5T_NATIVE_INT32);
NATIVE_UINT32_ = new PredType(H5T_NATIVE_UINT32);
- NATIVE_INT64_ = new PredType(H5T_NATIVE_INT64);
+ NATIVE_INT64_ = new PredType(H5T_NATIVE_INT64);
NATIVE_UINT64_ = new PredType(H5T_NATIVE_UINT64);
// LEAST types
@@ -513,13 +519,13 @@ void PredType::makePredTypes()
} // makePredTypes
-
//--------------------------------------------------------------------------
// Function: PredType::deleteConstants
// Purpose Deletes all PredType constant pointers.
// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
-void PredType::deleteConstants()
+void
+PredType::deleteConstants()
{
delete STD_I8BE_;
delete STD_I8LE_;
@@ -709,186 +715,186 @@ void PredType::deleteConstants()
// PredType constants. Note that, there is a similar function to getPredTypes()
// in other classes, that have global constants, is called getConstant().
-const PredType& PredType::PREDTYPE_CONST = *PredType::getPredTypes();
-const PredType& PredType::STD_I8BE = *STD_I8BE_;
-const PredType& PredType::STD_I8LE = *STD_I8LE_;
-const PredType& PredType::STD_I16BE = *STD_I16BE_;
-const PredType& PredType::STD_I16LE = *STD_I16LE_;
-const PredType& PredType::STD_I32BE = *STD_I32BE_;
-const PredType& PredType::STD_I32LE = *STD_I32LE_;
-const PredType& PredType::STD_I64BE = *STD_I64BE_;
-const PredType& PredType::STD_I64LE = *STD_I64LE_;
-const PredType& PredType::STD_U8BE = *STD_U8BE_;
-const PredType& PredType::STD_U8LE = *STD_U8LE_;
-const PredType& PredType::STD_U16BE = *STD_U16BE_;
-const PredType& PredType::STD_U16LE = *STD_U16LE_;
-const PredType& PredType::STD_U32BE = *STD_U32BE_;
-const PredType& PredType::STD_U32LE = *STD_U32LE_;
-const PredType& PredType::STD_U64BE = *STD_U64BE_;
-const PredType& PredType::STD_U64LE = *STD_U64LE_;
-const PredType& PredType::STD_B8BE = *STD_B8BE_;
-const PredType& PredType::STD_B8LE = *STD_B8LE_;
-const PredType& PredType::STD_B16BE = *STD_B16BE_;
-const PredType& PredType::STD_B16LE = *STD_B16LE_;
-const PredType& PredType::STD_B32BE = *STD_B32BE_;
-const PredType& PredType::STD_B32LE = *STD_B32LE_;
-const PredType& PredType::STD_B64BE = *STD_B64BE_;
-const PredType& PredType::STD_B64LE = *STD_B64LE_;
-const PredType& PredType::STD_REF_OBJ = *STD_REF_OBJ_;
-const PredType& PredType::STD_REF_DSETREG = *STD_REF_DSETREG_;
-
-const PredType& PredType::C_S1 = *C_S1_;
-const PredType& PredType::FORTRAN_S1 = *FORTRAN_S1_;
-
-const PredType& PredType::IEEE_F32BE = *IEEE_F32BE_;
-const PredType& PredType::IEEE_F32LE = *IEEE_F32LE_;
-const PredType& PredType::IEEE_F64BE = *IEEE_F64BE_;
-const PredType& PredType::IEEE_F64LE = *IEEE_F64LE_;
-
-const PredType& PredType::UNIX_D32BE = *UNIX_D32BE_;
-const PredType& PredType::UNIX_D32LE = *UNIX_D32LE_;
-const PredType& PredType::UNIX_D64BE = *UNIX_D64BE_;
-const PredType& PredType::UNIX_D64LE = *UNIX_D64LE_;
-
-const PredType& PredType::INTEL_I8 = *INTEL_I8_;
-const PredType& PredType::INTEL_I16 = *INTEL_I16_;
-const PredType& PredType::INTEL_I32 = *INTEL_I32_;
-const PredType& PredType::INTEL_I64 = *INTEL_I64_;
-const PredType& PredType::INTEL_U8 = *INTEL_U8_;
-const PredType& PredType::INTEL_U16 = *INTEL_U16_;
-const PredType& PredType::INTEL_U32 = *INTEL_U32_;
-const PredType& PredType::INTEL_U64 = *INTEL_U64_;
-const PredType& PredType::INTEL_B8 = *INTEL_B8_;
-const PredType& PredType::INTEL_B16 = *INTEL_B16_;
-const PredType& PredType::INTEL_B32 = *INTEL_B32_;
-const PredType& PredType::INTEL_B64 = *INTEL_B64_;
-const PredType& PredType::INTEL_F32 = *INTEL_F32_;
-const PredType& PredType::INTEL_F64 = *INTEL_F64_;
-
-const PredType& PredType::ALPHA_I8 = *ALPHA_I8_;
-const PredType& PredType::ALPHA_I16 = *ALPHA_I16_;
-const PredType& PredType::ALPHA_I32 = *ALPHA_I32_;
-const PredType& PredType::ALPHA_I64 = *ALPHA_I64_;
-const PredType& PredType::ALPHA_U8 = *ALPHA_U8_;
-const PredType& PredType::ALPHA_U16 = *ALPHA_U16_;
-const PredType& PredType::ALPHA_U32 = *ALPHA_U32_;
-const PredType& PredType::ALPHA_U64 = *ALPHA_U64_;
-const PredType& PredType::ALPHA_B8 = *ALPHA_B8_;
-const PredType& PredType::ALPHA_B16 = *ALPHA_B16_;
-const PredType& PredType::ALPHA_B32 = *ALPHA_B32_;
-const PredType& PredType::ALPHA_B64 = *ALPHA_B64_;
-const PredType& PredType::ALPHA_F32 = *ALPHA_F32_;
-const PredType& PredType::ALPHA_F64 = *ALPHA_F64_;
-
-const PredType& PredType::MIPS_I8 = *MIPS_I8_;
-const PredType& PredType::MIPS_I16 = *MIPS_I16_;
-const PredType& PredType::MIPS_I32 = *MIPS_I32_;
-const PredType& PredType::MIPS_I64 = *MIPS_I64_;
-const PredType& PredType::MIPS_U8 = *MIPS_U8_;
-const PredType& PredType::MIPS_U16 = *MIPS_U16_;
-const PredType& PredType::MIPS_U32 = *MIPS_U32_;
-const PredType& PredType::MIPS_U64 = *MIPS_U64_;
-const PredType& PredType::MIPS_B8 = *MIPS_B8_;
-const PredType& PredType::MIPS_B16 = *MIPS_B16_;
-const PredType& PredType::MIPS_B32 = *MIPS_B32_;
-const PredType& PredType::MIPS_B64 = *MIPS_B64_;
-const PredType& PredType::MIPS_F32 = *MIPS_F32_;
-const PredType& PredType::MIPS_F64 = *MIPS_F64_;
-
-const PredType& PredType::NATIVE_CHAR = *NATIVE_CHAR_;
-const PredType& PredType::NATIVE_SCHAR = *NATIVE_SCHAR_;
-const PredType& PredType::NATIVE_UCHAR = *NATIVE_UCHAR_;
-const PredType& PredType::NATIVE_SHORT = *NATIVE_SHORT_;
-const PredType& PredType::NATIVE_USHORT = *NATIVE_USHORT_;
-const PredType& PredType::NATIVE_INT = *NATIVE_INT_;
-const PredType& PredType::NATIVE_UINT = *NATIVE_UINT_;
-const PredType& PredType::NATIVE_LONG = *NATIVE_LONG_;
-const PredType& PredType::NATIVE_ULONG = *NATIVE_ULONG_;
-const PredType& PredType::NATIVE_LLONG = *NATIVE_LLONG_;
-const PredType& PredType::NATIVE_ULLONG = *NATIVE_ULLONG_;
-const PredType& PredType::NATIVE_FLOAT = *NATIVE_FLOAT_;
-const PredType& PredType::NATIVE_DOUBLE = *NATIVE_DOUBLE_;
-const PredType& PredType::NATIVE_LDOUBLE = *NATIVE_LDOUBLE_;
-const PredType& PredType::NATIVE_B8 = *NATIVE_B8_;
-const PredType& PredType::NATIVE_B16 = *NATIVE_B16_;
-const PredType& PredType::NATIVE_B32 = *NATIVE_B32_;
-const PredType& PredType::NATIVE_B64 = *NATIVE_B64_;
-const PredType& PredType::NATIVE_OPAQUE = *NATIVE_OPAQUE_;
-const PredType& PredType::NATIVE_HSIZE = *NATIVE_HSIZE_;
-const PredType& PredType::NATIVE_HSSIZE = *NATIVE_HSSIZE_;
-const PredType& PredType::NATIVE_HERR = *NATIVE_HERR_;
-const PredType& PredType::NATIVE_HBOOL = *NATIVE_HBOOL_;
-
-const PredType& PredType::NATIVE_INT8 = *NATIVE_INT8_;
-const PredType& PredType::NATIVE_UINT8 = *NATIVE_UINT8_;
-const PredType& PredType::NATIVE_INT16 = *NATIVE_INT16_;
-const PredType& PredType::NATIVE_UINT16 = *NATIVE_UINT16_;
-const PredType& PredType::NATIVE_INT32 = *NATIVE_INT32_;
-const PredType& PredType::NATIVE_UINT32 = *NATIVE_UINT32_;
-const PredType& PredType::NATIVE_INT64 = *NATIVE_INT64_;
-const PredType& PredType::NATIVE_UINT64 = *NATIVE_UINT64_;
+const PredType &PredType::PREDTYPE_CONST = *PredType::getPredTypes();
+const PredType &PredType::STD_I8BE = *STD_I8BE_;
+const PredType &PredType::STD_I8LE = *STD_I8LE_;
+const PredType &PredType::STD_I16BE = *STD_I16BE_;
+const PredType &PredType::STD_I16LE = *STD_I16LE_;
+const PredType &PredType::STD_I32BE = *STD_I32BE_;
+const PredType &PredType::STD_I32LE = *STD_I32LE_;
+const PredType &PredType::STD_I64BE = *STD_I64BE_;
+const PredType &PredType::STD_I64LE = *STD_I64LE_;
+const PredType &PredType::STD_U8BE = *STD_U8BE_;
+const PredType &PredType::STD_U8LE = *STD_U8LE_;
+const PredType &PredType::STD_U16BE = *STD_U16BE_;
+const PredType &PredType::STD_U16LE = *STD_U16LE_;
+const PredType &PredType::STD_U32BE = *STD_U32BE_;
+const PredType &PredType::STD_U32LE = *STD_U32LE_;
+const PredType &PredType::STD_U64BE = *STD_U64BE_;
+const PredType &PredType::STD_U64LE = *STD_U64LE_;
+const PredType &PredType::STD_B8BE = *STD_B8BE_;
+const PredType &PredType::STD_B8LE = *STD_B8LE_;
+const PredType &PredType::STD_B16BE = *STD_B16BE_;
+const PredType &PredType::STD_B16LE = *STD_B16LE_;
+const PredType &PredType::STD_B32BE = *STD_B32BE_;
+const PredType &PredType::STD_B32LE = *STD_B32LE_;
+const PredType &PredType::STD_B64BE = *STD_B64BE_;
+const PredType &PredType::STD_B64LE = *STD_B64LE_;
+const PredType &PredType::STD_REF_OBJ = *STD_REF_OBJ_;
+const PredType &PredType::STD_REF_DSETREG = *STD_REF_DSETREG_;
+
+const PredType &PredType::C_S1 = *C_S1_;
+const PredType &PredType::FORTRAN_S1 = *FORTRAN_S1_;
+
+const PredType &PredType::IEEE_F32BE = *IEEE_F32BE_;
+const PredType &PredType::IEEE_F32LE = *IEEE_F32LE_;
+const PredType &PredType::IEEE_F64BE = *IEEE_F64BE_;
+const PredType &PredType::IEEE_F64LE = *IEEE_F64LE_;
+
+const PredType &PredType::UNIX_D32BE = *UNIX_D32BE_;
+const PredType &PredType::UNIX_D32LE = *UNIX_D32LE_;
+const PredType &PredType::UNIX_D64BE = *UNIX_D64BE_;
+const PredType &PredType::UNIX_D64LE = *UNIX_D64LE_;
+
+const PredType &PredType::INTEL_I8 = *INTEL_I8_;
+const PredType &PredType::INTEL_I16 = *INTEL_I16_;
+const PredType &PredType::INTEL_I32 = *INTEL_I32_;
+const PredType &PredType::INTEL_I64 = *INTEL_I64_;
+const PredType &PredType::INTEL_U8 = *INTEL_U8_;
+const PredType &PredType::INTEL_U16 = *INTEL_U16_;
+const PredType &PredType::INTEL_U32 = *INTEL_U32_;
+const PredType &PredType::INTEL_U64 = *INTEL_U64_;
+const PredType &PredType::INTEL_B8 = *INTEL_B8_;
+const PredType &PredType::INTEL_B16 = *INTEL_B16_;
+const PredType &PredType::INTEL_B32 = *INTEL_B32_;
+const PredType &PredType::INTEL_B64 = *INTEL_B64_;
+const PredType &PredType::INTEL_F32 = *INTEL_F32_;
+const PredType &PredType::INTEL_F64 = *INTEL_F64_;
+
+const PredType &PredType::ALPHA_I8 = *ALPHA_I8_;
+const PredType &PredType::ALPHA_I16 = *ALPHA_I16_;
+const PredType &PredType::ALPHA_I32 = *ALPHA_I32_;
+const PredType &PredType::ALPHA_I64 = *ALPHA_I64_;
+const PredType &PredType::ALPHA_U8 = *ALPHA_U8_;
+const PredType &PredType::ALPHA_U16 = *ALPHA_U16_;
+const PredType &PredType::ALPHA_U32 = *ALPHA_U32_;
+const PredType &PredType::ALPHA_U64 = *ALPHA_U64_;
+const PredType &PredType::ALPHA_B8 = *ALPHA_B8_;
+const PredType &PredType::ALPHA_B16 = *ALPHA_B16_;
+const PredType &PredType::ALPHA_B32 = *ALPHA_B32_;
+const PredType &PredType::ALPHA_B64 = *ALPHA_B64_;
+const PredType &PredType::ALPHA_F32 = *ALPHA_F32_;
+const PredType &PredType::ALPHA_F64 = *ALPHA_F64_;
+
+const PredType &PredType::MIPS_I8 = *MIPS_I8_;
+const PredType &PredType::MIPS_I16 = *MIPS_I16_;
+const PredType &PredType::MIPS_I32 = *MIPS_I32_;
+const PredType &PredType::MIPS_I64 = *MIPS_I64_;
+const PredType &PredType::MIPS_U8 = *MIPS_U8_;
+const PredType &PredType::MIPS_U16 = *MIPS_U16_;
+const PredType &PredType::MIPS_U32 = *MIPS_U32_;
+const PredType &PredType::MIPS_U64 = *MIPS_U64_;
+const PredType &PredType::MIPS_B8 = *MIPS_B8_;
+const PredType &PredType::MIPS_B16 = *MIPS_B16_;
+const PredType &PredType::MIPS_B32 = *MIPS_B32_;
+const PredType &PredType::MIPS_B64 = *MIPS_B64_;
+const PredType &PredType::MIPS_F32 = *MIPS_F32_;
+const PredType &PredType::MIPS_F64 = *MIPS_F64_;
+
+const PredType &PredType::NATIVE_CHAR = *NATIVE_CHAR_;
+const PredType &PredType::NATIVE_SCHAR = *NATIVE_SCHAR_;
+const PredType &PredType::NATIVE_UCHAR = *NATIVE_UCHAR_;
+const PredType &PredType::NATIVE_SHORT = *NATIVE_SHORT_;
+const PredType &PredType::NATIVE_USHORT = *NATIVE_USHORT_;
+const PredType &PredType::NATIVE_INT = *NATIVE_INT_;
+const PredType &PredType::NATIVE_UINT = *NATIVE_UINT_;
+const PredType &PredType::NATIVE_LONG = *NATIVE_LONG_;
+const PredType &PredType::NATIVE_ULONG = *NATIVE_ULONG_;
+const PredType &PredType::NATIVE_LLONG = *NATIVE_LLONG_;
+const PredType &PredType::NATIVE_ULLONG = *NATIVE_ULLONG_;
+const PredType &PredType::NATIVE_FLOAT = *NATIVE_FLOAT_;
+const PredType &PredType::NATIVE_DOUBLE = *NATIVE_DOUBLE_;
+const PredType &PredType::NATIVE_LDOUBLE = *NATIVE_LDOUBLE_;
+const PredType &PredType::NATIVE_B8 = *NATIVE_B8_;
+const PredType &PredType::NATIVE_B16 = *NATIVE_B16_;
+const PredType &PredType::NATIVE_B32 = *NATIVE_B32_;
+const PredType &PredType::NATIVE_B64 = *NATIVE_B64_;
+const PredType &PredType::NATIVE_OPAQUE = *NATIVE_OPAQUE_;
+const PredType &PredType::NATIVE_HSIZE = *NATIVE_HSIZE_;
+const PredType &PredType::NATIVE_HSSIZE = *NATIVE_HSSIZE_;
+const PredType &PredType::NATIVE_HERR = *NATIVE_HERR_;
+const PredType &PredType::NATIVE_HBOOL = *NATIVE_HBOOL_;
+
+const PredType &PredType::NATIVE_INT8 = *NATIVE_INT8_;
+const PredType &PredType::NATIVE_UINT8 = *NATIVE_UINT8_;
+const PredType &PredType::NATIVE_INT16 = *NATIVE_INT16_;
+const PredType &PredType::NATIVE_UINT16 = *NATIVE_UINT16_;
+const PredType &PredType::NATIVE_INT32 = *NATIVE_INT32_;
+const PredType &PredType::NATIVE_UINT32 = *NATIVE_UINT32_;
+const PredType &PredType::NATIVE_INT64 = *NATIVE_INT64_;
+const PredType &PredType::NATIVE_UINT64 = *NATIVE_UINT64_;
// LEAST types
#if H5_SIZEOF_INT_LEAST8_T != 0
-const PredType& PredType::NATIVE_INT_LEAST8 = *NATIVE_INT_LEAST8_;
+const PredType &PredType::NATIVE_INT_LEAST8 = *NATIVE_INT_LEAST8_;
#endif /* H5_SIZEOF_INT_LEAST8_T */
#if H5_SIZEOF_UINT_LEAST8_T != 0
-const PredType& PredType::NATIVE_UINT_LEAST8 = *NATIVE_UINT_LEAST8_;
+const PredType &PredType::NATIVE_UINT_LEAST8 = *NATIVE_UINT_LEAST8_;
#endif /* H5_SIZEOF_UINT_LEAST8_T */
#if H5_SIZEOF_INT_LEAST16_T != 0
-const PredType& PredType::NATIVE_INT_LEAST16 = *NATIVE_INT_LEAST16_;
+const PredType &PredType::NATIVE_INT_LEAST16 = *NATIVE_INT_LEAST16_;
#endif /* H5_SIZEOF_INT_LEAST16_T */
#if H5_SIZEOF_UINT_LEAST16_T != 0
-const PredType& PredType::NATIVE_UINT_LEAST16 = *NATIVE_UINT_LEAST16_;
+const PredType &PredType::NATIVE_UINT_LEAST16 = *NATIVE_UINT_LEAST16_;
#endif /* H5_SIZEOF_UINT_LEAST16_T */
#if H5_SIZEOF_INT_LEAST32_T != 0
-const PredType& PredType::NATIVE_INT_LEAST32 = *NATIVE_INT_LEAST32_;
+const PredType &PredType::NATIVE_INT_LEAST32 = *NATIVE_INT_LEAST32_;
#endif /* H5_SIZEOF_INT_LEAST32_T */
#if H5_SIZEOF_UINT_LEAST32_T != 0
-const PredType& PredType::NATIVE_UINT_LEAST32 = *NATIVE_UINT_LEAST32_;
+const PredType &PredType::NATIVE_UINT_LEAST32 = *NATIVE_UINT_LEAST32_;
#endif /* H5_SIZEOF_UINT_LEAST32_T */
#if H5_SIZEOF_INT_LEAST64_T != 0
-const PredType& PredType::NATIVE_INT_LEAST64 = *NATIVE_INT_LEAST64_;
+const PredType &PredType::NATIVE_INT_LEAST64 = *NATIVE_INT_LEAST64_;
#endif /* H5_SIZEOF_INT_LEAST64_T */
#if H5_SIZEOF_UINT_LEAST64_T != 0
-const PredType& PredType::NATIVE_UINT_LEAST64 = *NATIVE_UINT_LEAST64_;
+const PredType &PredType::NATIVE_UINT_LEAST64 = *NATIVE_UINT_LEAST64_;
#endif /* H5_SIZEOF_UINT_LEAST64_T */
// FAST types
#if H5_SIZEOF_INT_FAST8_T != 0
-const PredType& PredType::NATIVE_INT_FAST8 = *NATIVE_INT_FAST8_;
+const PredType &PredType::NATIVE_INT_FAST8 = *NATIVE_INT_FAST8_;
#endif /* H5_SIZEOF_INT_FAST8_T */
#if H5_SIZEOF_UINT_FAST8_T != 0
-const PredType& PredType::NATIVE_UINT_FAST8 = *NATIVE_UINT_FAST8_;
+const PredType &PredType::NATIVE_UINT_FAST8 = *NATIVE_UINT_FAST8_;
#endif /* H5_SIZEOF_UINT_FAST8_T */
#if H5_SIZEOF_INT_FAST16_T != 0
-const PredType& PredType::NATIVE_INT_FAST16 = *NATIVE_INT_FAST16_;
+const PredType &PredType::NATIVE_INT_FAST16 = *NATIVE_INT_FAST16_;
#endif /* H5_SIZEOF_INT_FAST16_T */
#if H5_SIZEOF_UINT_FAST16_T != 0
-const PredType& PredType::NATIVE_UINT_FAST16 = *NATIVE_UINT_FAST16_;
+const PredType &PredType::NATIVE_UINT_FAST16 = *NATIVE_UINT_FAST16_;
#endif /* H5_SIZEOF_UINT_FAST16_T */
#if H5_SIZEOF_INT_FAST32_T != 0
-const PredType& PredType::NATIVE_INT_FAST32 = *NATIVE_INT_FAST32_;
+const PredType &PredType::NATIVE_INT_FAST32 = *NATIVE_INT_FAST32_;
#endif /* H5_SIZEOF_INT_FAST32_T */
#if H5_SIZEOF_UINT_FAST32_T != 0
-const PredType& PredType::NATIVE_UINT_FAST32 = *NATIVE_UINT_FAST32_;
+const PredType &PredType::NATIVE_UINT_FAST32 = *NATIVE_UINT_FAST32_;
#endif /* H5_SIZEOF_UINT_FAST32_T */
#if H5_SIZEOF_INT_FAST64_T != 0
-const PredType& PredType::NATIVE_INT_FAST64 = *NATIVE_INT_FAST64_;
+const PredType &PredType::NATIVE_INT_FAST64 = *NATIVE_INT_FAST64_;
#endif /* H5_SIZEOF_INT_FAST64_T */
#if H5_SIZEOF_UINT_FAST64_T != 0
-const PredType& PredType::NATIVE_UINT_FAST64 = *NATIVE_UINT_FAST64_;
+const PredType &PredType::NATIVE_UINT_FAST64 = *NATIVE_UINT_FAST64_;
#endif /* H5_SIZEOF_UINT_FAST64_T */
#endif // DOXYGEN_SHOULD_SKIP_THIS
-} // end namespace
+} // namespace H5
/***************************************************************************
Design Note
@@ -1102,4 +1108,3 @@ September 2015:
using PropList's because of the class types and in favor of clarity.
****************************************************************************/
-
diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h
index 0978384..2d1185b 100644
--- a/c++/src/H5PredType.h
+++ b/c++/src/H5PredType.h
@@ -26,412 +26,416 @@ namespace H5 {
*/
// Inheritance: AtomType -> DataType -> H5Object -> H5Location -> IdComponent
class H5_DLLCPP PredType : public AtomType {
- public:
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("PredType"); }
-
- // Makes a copy of the predefined type and stores the new
- // id in the left hand side object.
- PredType& operator=(const PredType& rhs);
-
- // Copy constructor: same as the original PredType.
- PredType(const PredType& original);
-
- // Noop destructor
- virtual ~PredType();
-
- /*! \brief This dummy function do not inherit from DataType - it will
- throw a DataTypeIException if invoked.
- */
- void commit(H5Location& loc, const H5std_string& name);
- /*! \brief This dummy function do not inherit from DataType - it will
- throw a DataTypeIException if invoked.
- */
- void commit(H5Location& loc, const char* name);
- /*! \brief This dummy function do not inherit from DataType - it will
- throw a DataTypeIException if invoked.
- */
- bool committed();
-
- ///\brief PredType constants
- static const PredType& STD_I8BE;
- static const PredType& STD_I8LE;
- static const PredType& STD_I16BE;
- static const PredType& STD_I16LE;
- static const PredType& STD_I32BE;
- static const PredType& STD_I32LE;
- static const PredType& STD_I64BE;
- static const PredType& STD_I64LE;
- static const PredType& STD_U8BE;
- static const PredType& STD_U8LE;
- static const PredType& STD_U16BE;
- static const PredType& STD_U16LE;
- static const PredType& STD_U32BE;
- static const PredType& STD_U32LE;
- static const PredType& STD_U64BE;
- static const PredType& STD_U64LE;
- static const PredType& STD_B8BE;
- static const PredType& STD_B8LE;
- static const PredType& STD_B16BE;
- static const PredType& STD_B16LE;
- static const PredType& STD_B32BE;
- static const PredType& STD_B32LE;
- static const PredType& STD_B64BE;
- static const PredType& STD_B64LE;
- static const PredType& STD_REF_OBJ;
- static const PredType& STD_REF_DSETREG;
-
- static const PredType& C_S1;
- static const PredType& FORTRAN_S1;
-
- static const PredType& IEEE_F32BE;
- static const PredType& IEEE_F32LE;
- static const PredType& IEEE_F64BE;
- static const PredType& IEEE_F64LE;
-
- static const PredType& UNIX_D32BE;
- static const PredType& UNIX_D32LE;
- static const PredType& UNIX_D64BE;
- static const PredType& UNIX_D64LE;
-
- static const PredType& INTEL_I8;
- static const PredType& INTEL_I16;
- static const PredType& INTEL_I32;
- static const PredType& INTEL_I64;
- static const PredType& INTEL_U8;
- static const PredType& INTEL_U16;
- static const PredType& INTEL_U32;
- static const PredType& INTEL_U64;
- static const PredType& INTEL_B8;
- static const PredType& INTEL_B16;
- static const PredType& INTEL_B32;
- static const PredType& INTEL_B64;
- static const PredType& INTEL_F32;
- static const PredType& INTEL_F64;
-
- static const PredType& ALPHA_I8;
- static const PredType& ALPHA_I16;
- static const PredType& ALPHA_I32;
- static const PredType& ALPHA_I64;
- static const PredType& ALPHA_U8;
- static const PredType& ALPHA_U16;
- static const PredType& ALPHA_U32;
- static const PredType& ALPHA_U64;
- static const PredType& ALPHA_B8;
- static const PredType& ALPHA_B16;
- static const PredType& ALPHA_B32;
- static const PredType& ALPHA_B64;
- static const PredType& ALPHA_F32;
- static const PredType& ALPHA_F64;
-
- static const PredType& MIPS_I8;
- static const PredType& MIPS_I16;
- static const PredType& MIPS_I32;
- static const PredType& MIPS_I64;
- static const PredType& MIPS_U8;
- static const PredType& MIPS_U16;
- static const PredType& MIPS_U32;
- static const PredType& MIPS_U64;
- static const PredType& MIPS_B8;
- static const PredType& MIPS_B16;
- static const PredType& MIPS_B32;
- static const PredType& MIPS_B64;
- static const PredType& MIPS_F32;
- static const PredType& MIPS_F64;
-
- static const PredType& NATIVE_CHAR;
- static const PredType& NATIVE_SCHAR;
- static const PredType& NATIVE_UCHAR;
- static const PredType& NATIVE_SHORT;
- static const PredType& NATIVE_USHORT;
- static const PredType& NATIVE_INT;
- static const PredType& NATIVE_UINT;
- static const PredType& NATIVE_LONG;
- static const PredType& NATIVE_ULONG;
- static const PredType& NATIVE_LLONG;
- static const PredType& NATIVE_ULLONG;
- static const PredType& NATIVE_FLOAT;
- static const PredType& NATIVE_DOUBLE;
- static const PredType& NATIVE_LDOUBLE;
- static const PredType& NATIVE_B8;
- static const PredType& NATIVE_B16;
- static const PredType& NATIVE_B32;
- static const PredType& NATIVE_B64;
- static const PredType& NATIVE_OPAQUE;
- static const PredType& NATIVE_HSIZE;
- static const PredType& NATIVE_HSSIZE;
- static const PredType& NATIVE_HERR;
- static const PredType& NATIVE_HBOOL;
-
- static const PredType& NATIVE_INT8;
- static const PredType& NATIVE_UINT8;
- static const PredType& NATIVE_INT16;
- static const PredType& NATIVE_UINT16;
- static const PredType& NATIVE_INT32;
- static const PredType& NATIVE_UINT32;
- static const PredType& NATIVE_INT64;
- static const PredType& NATIVE_UINT64;
+ public:
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("PredType");
+ }
+
+ // Makes a copy of the predefined type and stores the new
+ // id in the left hand side object.
+ PredType &operator=(const PredType &rhs);
+
+ // Copy constructor: same as the original PredType.
+ PredType(const PredType &original);
+
+ // Noop destructor
+ virtual ~PredType();
+
+ /*! \brief This dummy function do not inherit from DataType - it will
+ throw a DataTypeIException if invoked.
+ */
+ void commit(H5Location &loc, const H5std_string &name);
+ /*! \brief This dummy function do not inherit from DataType - it will
+ throw a DataTypeIException if invoked.
+ */
+ void commit(H5Location &loc, const char *name);
+ /*! \brief This dummy function do not inherit from DataType - it will
+ throw a DataTypeIException if invoked.
+ */
+ bool committed();
+
+ ///\brief PredType constants
+ static const PredType &STD_I8BE;
+ static const PredType &STD_I8LE;
+ static const PredType &STD_I16BE;
+ static const PredType &STD_I16LE;
+ static const PredType &STD_I32BE;
+ static const PredType &STD_I32LE;
+ static const PredType &STD_I64BE;
+ static const PredType &STD_I64LE;
+ static const PredType &STD_U8BE;
+ static const PredType &STD_U8LE;
+ static const PredType &STD_U16BE;
+ static const PredType &STD_U16LE;
+ static const PredType &STD_U32BE;
+ static const PredType &STD_U32LE;
+ static const PredType &STD_U64BE;
+ static const PredType &STD_U64LE;
+ static const PredType &STD_B8BE;
+ static const PredType &STD_B8LE;
+ static const PredType &STD_B16BE;
+ static const PredType &STD_B16LE;
+ static const PredType &STD_B32BE;
+ static const PredType &STD_B32LE;
+ static const PredType &STD_B64BE;
+ static const PredType &STD_B64LE;
+ static const PredType &STD_REF_OBJ;
+ static const PredType &STD_REF_DSETREG;
+
+ static const PredType &C_S1;
+ static const PredType &FORTRAN_S1;
+
+ static const PredType &IEEE_F32BE;
+ static const PredType &IEEE_F32LE;
+ static const PredType &IEEE_F64BE;
+ static const PredType &IEEE_F64LE;
+
+ static const PredType &UNIX_D32BE;
+ static const PredType &UNIX_D32LE;
+ static const PredType &UNIX_D64BE;
+ static const PredType &UNIX_D64LE;
+
+ static const PredType &INTEL_I8;
+ static const PredType &INTEL_I16;
+ static const PredType &INTEL_I32;
+ static const PredType &INTEL_I64;
+ static const PredType &INTEL_U8;
+ static const PredType &INTEL_U16;
+ static const PredType &INTEL_U32;
+ static const PredType &INTEL_U64;
+ static const PredType &INTEL_B8;
+ static const PredType &INTEL_B16;
+ static const PredType &INTEL_B32;
+ static const PredType &INTEL_B64;
+ static const PredType &INTEL_F32;
+ static const PredType &INTEL_F64;
+
+ static const PredType &ALPHA_I8;
+ static const PredType &ALPHA_I16;
+ static const PredType &ALPHA_I32;
+ static const PredType &ALPHA_I64;
+ static const PredType &ALPHA_U8;
+ static const PredType &ALPHA_U16;
+ static const PredType &ALPHA_U32;
+ static const PredType &ALPHA_U64;
+ static const PredType &ALPHA_B8;
+ static const PredType &ALPHA_B16;
+ static const PredType &ALPHA_B32;
+ static const PredType &ALPHA_B64;
+ static const PredType &ALPHA_F32;
+ static const PredType &ALPHA_F64;
+
+ static const PredType &MIPS_I8;
+ static const PredType &MIPS_I16;
+ static const PredType &MIPS_I32;
+ static const PredType &MIPS_I64;
+ static const PredType &MIPS_U8;
+ static const PredType &MIPS_U16;
+ static const PredType &MIPS_U32;
+ static const PredType &MIPS_U64;
+ static const PredType &MIPS_B8;
+ static const PredType &MIPS_B16;
+ static const PredType &MIPS_B32;
+ static const PredType &MIPS_B64;
+ static const PredType &MIPS_F32;
+ static const PredType &MIPS_F64;
+
+ static const PredType &NATIVE_CHAR;
+ static const PredType &NATIVE_SCHAR;
+ static const PredType &NATIVE_UCHAR;
+ static const PredType &NATIVE_SHORT;
+ static const PredType &NATIVE_USHORT;
+ static const PredType &NATIVE_INT;
+ static const PredType &NATIVE_UINT;
+ static const PredType &NATIVE_LONG;
+ static const PredType &NATIVE_ULONG;
+ static const PredType &NATIVE_LLONG;
+ static const PredType &NATIVE_ULLONG;
+ static const PredType &NATIVE_FLOAT;
+ static const PredType &NATIVE_DOUBLE;
+ static const PredType &NATIVE_LDOUBLE;
+ static const PredType &NATIVE_B8;
+ static const PredType &NATIVE_B16;
+ static const PredType &NATIVE_B32;
+ static const PredType &NATIVE_B64;
+ static const PredType &NATIVE_OPAQUE;
+ static const PredType &NATIVE_HSIZE;
+ static const PredType &NATIVE_HSSIZE;
+ static const PredType &NATIVE_HERR;
+ static const PredType &NATIVE_HBOOL;
+
+ static const PredType &NATIVE_INT8;
+ static const PredType &NATIVE_UINT8;
+ static const PredType &NATIVE_INT16;
+ static const PredType &NATIVE_UINT16;
+ static const PredType &NATIVE_INT32;
+ static const PredType &NATIVE_UINT32;
+ static const PredType &NATIVE_INT64;
+ static const PredType &NATIVE_UINT64;
// LEAST types
#if H5_SIZEOF_INT_LEAST8_T != 0
- static const PredType& NATIVE_INT_LEAST8;
+ static const PredType &NATIVE_INT_LEAST8;
#endif /* H5_SIZEOF_INT_LEAST8_T */
#if H5_SIZEOF_UINT_LEAST8_T != 0
- static const PredType& NATIVE_UINT_LEAST8;
+ static const PredType &NATIVE_UINT_LEAST8;
#endif /* H5_SIZEOF_UINT_LEAST8_T */
#if H5_SIZEOF_INT_LEAST16_T != 0
- static const PredType& NATIVE_INT_LEAST16;
+ static const PredType &NATIVE_INT_LEAST16;
#endif /* H5_SIZEOF_INT_LEAST16_T */
#if H5_SIZEOF_UINT_LEAST16_T != 0
- static const PredType& NATIVE_UINT_LEAST16;
+ static const PredType &NATIVE_UINT_LEAST16;
#endif /* H5_SIZEOF_UINT_LEAST16_T */
#if H5_SIZEOF_INT_LEAST32_T != 0
- static const PredType& NATIVE_INT_LEAST32;
+ static const PredType &NATIVE_INT_LEAST32;
#endif /* H5_SIZEOF_INT_LEAST32_T */
#if H5_SIZEOF_UINT_LEAST32_T != 0
- static const PredType& NATIVE_UINT_LEAST32;
+ static const PredType &NATIVE_UINT_LEAST32;
#endif /* H5_SIZEOF_UINT_LEAST32_T */
#if H5_SIZEOF_INT_LEAST64_T != 0
- static const PredType& NATIVE_INT_LEAST64;
+ static const PredType &NATIVE_INT_LEAST64;
#endif /* H5_SIZEOF_INT_LEAST64_T */
#if H5_SIZEOF_UINT_LEAST64_T != 0
- static const PredType& NATIVE_UINT_LEAST64;
+ static const PredType &NATIVE_UINT_LEAST64;
#endif /* H5_SIZEOF_UINT_LEAST64_T */
// FAST types
#if H5_SIZEOF_INT_FAST8_T != 0
- static const PredType& NATIVE_INT_FAST8;
+ static const PredType &NATIVE_INT_FAST8;
#endif /* H5_SIZEOF_INT_FAST8_T */
#if H5_SIZEOF_UINT_FAST8_T != 0
- static const PredType& NATIVE_UINT_FAST8;
+ static const PredType &NATIVE_UINT_FAST8;
#endif /* H5_SIZEOF_UINT_FAST8_T */
#if H5_SIZEOF_INT_FAST16_T != 0
- static const PredType& NATIVE_INT_FAST16;
+ static const PredType &NATIVE_INT_FAST16;
#endif /* H5_SIZEOF_INT_FAST16_T */
#if H5_SIZEOF_UINT_FAST16_T != 0
- static const PredType& NATIVE_UINT_FAST16;
+ static const PredType &NATIVE_UINT_FAST16;
#endif /* H5_SIZEOF_UINT_FAST16_T */
#if H5_SIZEOF_INT_FAST32_T != 0
- static const PredType& NATIVE_INT_FAST32;
+ static const PredType &NATIVE_INT_FAST32;
#endif /* H5_SIZEOF_INT_FAST32_T */
#if H5_SIZEOF_UINT_FAST32_T != 0
- static const PredType& NATIVE_UINT_FAST32;
+ static const PredType &NATIVE_UINT_FAST32;
#endif /* H5_SIZEOF_UINT_FAST32_T */
#if H5_SIZEOF_INT_FAST64_T != 0
- static const PredType& NATIVE_INT_FAST64;
+ static const PredType &NATIVE_INT_FAST64;
#endif /* H5_SIZEOF_INT_FAST64_T */
#if H5_SIZEOF_UINT_FAST64_T != 0
- static const PredType& NATIVE_UINT_FAST64;
+ static const PredType &NATIVE_UINT_FAST64;
#endif /* H5_SIZEOF_UINT_FAST64_T */
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the PredType global constants
- static void deleteConstants();
-
- // Dummy constant
- static const PredType& PREDTYPE_CONST; // dummy constant
-
- protected:
- // Default constructor
- PredType();
-
- // Creates a pre-defined type using an HDF5 pre-defined constant
- PredType(const hid_t predtype_id); // used by the library only
-
- private:
- // Activates the creation of the PredType global constants
- static PredType* getPredTypes();
-
- // Dynamically allocates PredType global constants
- static void makePredTypes();
-
- // Dummy constant
- static PredType* PREDTYPE_CONST_;
-
- // Declaration of pointers to constants
- static PredType* STD_I8BE_;
- static PredType* STD_I8LE_;
- static PredType* STD_I16BE_;
- static PredType* STD_I16LE_;
- static PredType* STD_I32BE_;
- static PredType* STD_I32LE_;
- static PredType* STD_I64BE_;
- static PredType* STD_I64LE_;
- static PredType* STD_U8BE_;
- static PredType* STD_U8LE_;
- static PredType* STD_U16BE_;
- static PredType* STD_U16LE_;
- static PredType* STD_U32BE_;
- static PredType* STD_U32LE_;
- static PredType* STD_U64BE_;
- static PredType* STD_U64LE_;
- static PredType* STD_B8BE_;
- static PredType* STD_B8LE_;
- static PredType* STD_B16BE_;
- static PredType* STD_B16LE_;
- static PredType* STD_B32BE_;
- static PredType* STD_B32LE_;
- static PredType* STD_B64BE_;
- static PredType* STD_B64LE_;
- static PredType* STD_REF_OBJ_;
- static PredType* STD_REF_DSETREG_;
-
- static PredType* C_S1_;
- static PredType* FORTRAN_S1_;
-
- static PredType* IEEE_F32BE_;
- static PredType* IEEE_F32LE_;
- static PredType* IEEE_F64BE_;
- static PredType* IEEE_F64LE_;
-
- static PredType* UNIX_D32BE_;
- static PredType* UNIX_D32LE_;
- static PredType* UNIX_D64BE_;
- static PredType* UNIX_D64LE_;
-
- static PredType* INTEL_I8_;
- static PredType* INTEL_I16_;
- static PredType* INTEL_I32_;
- static PredType* INTEL_I64_;
- static PredType* INTEL_U8_;
- static PredType* INTEL_U16_;
- static PredType* INTEL_U32_;
- static PredType* INTEL_U64_;
- static PredType* INTEL_B8_;
- static PredType* INTEL_B16_;
- static PredType* INTEL_B32_;
- static PredType* INTEL_B64_;
- static PredType* INTEL_F32_;
- static PredType* INTEL_F64_;
-
- static PredType* ALPHA_I8_;
- static PredType* ALPHA_I16_;
- static PredType* ALPHA_I32_;
- static PredType* ALPHA_I64_;
- static PredType* ALPHA_U8_;
- static PredType* ALPHA_U16_;
- static PredType* ALPHA_U32_;
- static PredType* ALPHA_U64_;
- static PredType* ALPHA_B8_;
- static PredType* ALPHA_B16_;
- static PredType* ALPHA_B32_;
- static PredType* ALPHA_B64_;
- static PredType* ALPHA_F32_;
- static PredType* ALPHA_F64_;
-
- static PredType* MIPS_I8_;
- static PredType* MIPS_I16_;
- static PredType* MIPS_I32_;
- static PredType* MIPS_I64_;
- static PredType* MIPS_U8_;
- static PredType* MIPS_U16_;
- static PredType* MIPS_U32_;
- static PredType* MIPS_U64_;
- static PredType* MIPS_B8_;
- static PredType* MIPS_B16_;
- static PredType* MIPS_B32_;
- static PredType* MIPS_B64_;
- static PredType* MIPS_F32_;
- static PredType* MIPS_F64_;
-
- static PredType* NATIVE_CHAR_;
- static PredType* NATIVE_SCHAR_;
- static PredType* NATIVE_UCHAR_;
- static PredType* NATIVE_SHORT_;
- static PredType* NATIVE_USHORT_;
- static PredType* NATIVE_INT_;
- static PredType* NATIVE_UINT_;
- static PredType* NATIVE_LONG_;
- static PredType* NATIVE_ULONG_;
- static PredType* NATIVE_LLONG_;
- static PredType* NATIVE_ULLONG_;
- static PredType* NATIVE_FLOAT_;
- static PredType* NATIVE_DOUBLE_;
- static PredType* NATIVE_LDOUBLE_;
- static PredType* NATIVE_B8_;
- static PredType* NATIVE_B16_;
- static PredType* NATIVE_B32_;
- static PredType* NATIVE_B64_;
- static PredType* NATIVE_OPAQUE_;
- static PredType* NATIVE_HSIZE_;
- static PredType* NATIVE_HSSIZE_;
- static PredType* NATIVE_HERR_;
- static PredType* NATIVE_HBOOL_;
-
- static PredType* NATIVE_INT8_;
- static PredType* NATIVE_UINT8_;
- static PredType* NATIVE_INT16_;
- static PredType* NATIVE_UINT16_;
- static PredType* NATIVE_INT32_;
- static PredType* NATIVE_UINT32_;
- static PredType* NATIVE_INT64_;
- static PredType* NATIVE_UINT64_;
+ // Deletes the PredType global constants
+ static void deleteConstants();
+
+ // Dummy constant
+ static const PredType &PREDTYPE_CONST; // dummy constant
+
+ protected:
+ // Default constructor
+ PredType();
+
+ // Creates a pre-defined type using an HDF5 pre-defined constant
+ PredType(const hid_t predtype_id); // used by the library only
+
+ private:
+ // Activates the creation of the PredType global constants
+ static PredType *getPredTypes();
+
+ // Dynamically allocates PredType global constants
+ static void makePredTypes();
+
+ // Dummy constant
+ static PredType *PREDTYPE_CONST_;
+
+ // Declaration of pointers to constants
+ static PredType *STD_I8BE_;
+ static PredType *STD_I8LE_;
+ static PredType *STD_I16BE_;
+ static PredType *STD_I16LE_;
+ static PredType *STD_I32BE_;
+ static PredType *STD_I32LE_;
+ static PredType *STD_I64BE_;
+ static PredType *STD_I64LE_;
+ static PredType *STD_U8BE_;
+ static PredType *STD_U8LE_;
+ static PredType *STD_U16BE_;
+ static PredType *STD_U16LE_;
+ static PredType *STD_U32BE_;
+ static PredType *STD_U32LE_;
+ static PredType *STD_U64BE_;
+ static PredType *STD_U64LE_;
+ static PredType *STD_B8BE_;
+ static PredType *STD_B8LE_;
+ static PredType *STD_B16BE_;
+ static PredType *STD_B16LE_;
+ static PredType *STD_B32BE_;
+ static PredType *STD_B32LE_;
+ static PredType *STD_B64BE_;
+ static PredType *STD_B64LE_;
+ static PredType *STD_REF_OBJ_;
+ static PredType *STD_REF_DSETREG_;
+
+ static PredType *C_S1_;
+ static PredType *FORTRAN_S1_;
+
+ static PredType *IEEE_F32BE_;
+ static PredType *IEEE_F32LE_;
+ static PredType *IEEE_F64BE_;
+ static PredType *IEEE_F64LE_;
+
+ static PredType *UNIX_D32BE_;
+ static PredType *UNIX_D32LE_;
+ static PredType *UNIX_D64BE_;
+ static PredType *UNIX_D64LE_;
+
+ static PredType *INTEL_I8_;
+ static PredType *INTEL_I16_;
+ static PredType *INTEL_I32_;
+ static PredType *INTEL_I64_;
+ static PredType *INTEL_U8_;
+ static PredType *INTEL_U16_;
+ static PredType *INTEL_U32_;
+ static PredType *INTEL_U64_;
+ static PredType *INTEL_B8_;
+ static PredType *INTEL_B16_;
+ static PredType *INTEL_B32_;
+ static PredType *INTEL_B64_;
+ static PredType *INTEL_F32_;
+ static PredType *INTEL_F64_;
+
+ static PredType *ALPHA_I8_;
+ static PredType *ALPHA_I16_;
+ static PredType *ALPHA_I32_;
+ static PredType *ALPHA_I64_;
+ static PredType *ALPHA_U8_;
+ static PredType *ALPHA_U16_;
+ static PredType *ALPHA_U32_;
+ static PredType *ALPHA_U64_;
+ static PredType *ALPHA_B8_;
+ static PredType *ALPHA_B16_;
+ static PredType *ALPHA_B32_;
+ static PredType *ALPHA_B64_;
+ static PredType *ALPHA_F32_;
+ static PredType *ALPHA_F64_;
+
+ static PredType *MIPS_I8_;
+ static PredType *MIPS_I16_;
+ static PredType *MIPS_I32_;
+ static PredType *MIPS_I64_;
+ static PredType *MIPS_U8_;
+ static PredType *MIPS_U16_;
+ static PredType *MIPS_U32_;
+ static PredType *MIPS_U64_;
+ static PredType *MIPS_B8_;
+ static PredType *MIPS_B16_;
+ static PredType *MIPS_B32_;
+ static PredType *MIPS_B64_;
+ static PredType *MIPS_F32_;
+ static PredType *MIPS_F64_;
+
+ static PredType *NATIVE_CHAR_;
+ static PredType *NATIVE_SCHAR_;
+ static PredType *NATIVE_UCHAR_;
+ static PredType *NATIVE_SHORT_;
+ static PredType *NATIVE_USHORT_;
+ static PredType *NATIVE_INT_;
+ static PredType *NATIVE_UINT_;
+ static PredType *NATIVE_LONG_;
+ static PredType *NATIVE_ULONG_;
+ static PredType *NATIVE_LLONG_;
+ static PredType *NATIVE_ULLONG_;
+ static PredType *NATIVE_FLOAT_;
+ static PredType *NATIVE_DOUBLE_;
+ static PredType *NATIVE_LDOUBLE_;
+ static PredType *NATIVE_B8_;
+ static PredType *NATIVE_B16_;
+ static PredType *NATIVE_B32_;
+ static PredType *NATIVE_B64_;
+ static PredType *NATIVE_OPAQUE_;
+ static PredType *NATIVE_HSIZE_;
+ static PredType *NATIVE_HSSIZE_;
+ static PredType *NATIVE_HERR_;
+ static PredType *NATIVE_HBOOL_;
+
+ static PredType *NATIVE_INT8_;
+ static PredType *NATIVE_UINT8_;
+ static PredType *NATIVE_INT16_;
+ static PredType *NATIVE_UINT16_;
+ static PredType *NATIVE_INT32_;
+ static PredType *NATIVE_UINT32_;
+ static PredType *NATIVE_INT64_;
+ static PredType *NATIVE_UINT64_;
// LEAST types
#if H5_SIZEOF_INT_LEAST8_T != 0
- static PredType* NATIVE_INT_LEAST8_;
+ static PredType *NATIVE_INT_LEAST8_;
#endif /* H5_SIZEOF_INT_LEAST8_T */
#if H5_SIZEOF_UINT_LEAST8_T != 0
- static PredType* NATIVE_UINT_LEAST8_;
+ static PredType *NATIVE_UINT_LEAST8_;
#endif /* H5_SIZEOF_UINT_LEAST8_T */
#if H5_SIZEOF_INT_LEAST16_T != 0
- static PredType* NATIVE_INT_LEAST16_;
+ static PredType *NATIVE_INT_LEAST16_;
#endif /* H5_SIZEOF_INT_LEAST16_T */
#if H5_SIZEOF_UINT_LEAST16_T != 0
- static PredType* NATIVE_UINT_LEAST16_;
+ static PredType *NATIVE_UINT_LEAST16_;
#endif /* H5_SIZEOF_UINT_LEAST16_T */
#if H5_SIZEOF_INT_LEAST32_T != 0
- static PredType* NATIVE_INT_LEAST32_;
+ static PredType *NATIVE_INT_LEAST32_;
#endif /* H5_SIZEOF_INT_LEAST32_T */
#if H5_SIZEOF_UINT_LEAST32_T != 0
- static PredType* NATIVE_UINT_LEAST32_;
+ static PredType *NATIVE_UINT_LEAST32_;
#endif /* H5_SIZEOF_UINT_LEAST32_T */
#if H5_SIZEOF_INT_LEAST64_T != 0
- static PredType* NATIVE_INT_LEAST64_;
+ static PredType *NATIVE_INT_LEAST64_;
#endif /* H5_SIZEOF_INT_LEAST64_T */
#if H5_SIZEOF_UINT_LEAST64_T != 0
- static PredType* NATIVE_UINT_LEAST64_;
+ static PredType *NATIVE_UINT_LEAST64_;
#endif /* H5_SIZEOF_UINT_LEAST64_T */
// FAST types
#if H5_SIZEOF_INT_FAST8_T != 0
- static PredType* NATIVE_INT_FAST8_;
+ static PredType *NATIVE_INT_FAST8_;
#endif /* H5_SIZEOF_INT_FAST8_T */
#if H5_SIZEOF_UINT_FAST8_T != 0
- static PredType* NATIVE_UINT_FAST8_;
+ static PredType *NATIVE_UINT_FAST8_;
#endif /* H5_SIZEOF_UINT_FAST8_T */
#if H5_SIZEOF_INT_FAST16_T != 0
- static PredType* NATIVE_INT_FAST16_;
+ static PredType *NATIVE_INT_FAST16_;
#endif /* H5_SIZEOF_INT_FAST16_T */
#if H5_SIZEOF_UINT_FAST16_T != 0
- static PredType* NATIVE_UINT_FAST16_;
+ static PredType *NATIVE_UINT_FAST16_;
#endif /* H5_SIZEOF_UINT_FAST16_T */
#if H5_SIZEOF_INT_FAST32_T != 0
- static PredType* NATIVE_INT_FAST32_;
+ static PredType *NATIVE_INT_FAST32_;
#endif /* H5_SIZEOF_INT_FAST32_T */
#if H5_SIZEOF_UINT_FAST32_T != 0
- static PredType* NATIVE_UINT_FAST32_;
+ static PredType *NATIVE_UINT_FAST32_;
#endif /* H5_SIZEOF_UINT_FAST32_T */
#if H5_SIZEOF_INT_FAST64_T != 0
- static PredType* NATIVE_INT_FAST64_;
+ static PredType *NATIVE_INT_FAST64_;
#endif /* H5_SIZEOF_INT_FAST64_T */
#if H5_SIZEOF_UINT_FAST64_T != 0
- static PredType* NATIVE_UINT_FAST64_;
+ static PredType *NATIVE_UINT_FAST64_;
#endif /* H5_SIZEOF_UINT_FAST64_T */
- // End of Declaration of pointers
+ // End of Declaration of pointers
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp
index a01878c..c64ecf8 100644
--- a/c++/src/H5PropList.cpp
+++ b/c++/src/H5PropList.cpp
@@ -19,16 +19,15 @@
#include <string>
-#include "H5private.h" // for HDmemset
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
-
namespace H5 {
- using std::cerr;
- using std::endl;
+using std::cerr;
+using std::endl;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// This DOXYGEN_SHOULD_SKIP_THIS block is a work-around approach to control
@@ -36,7 +35,7 @@ namespace H5 {
// in "H5PredType.cpp" for information.
// Initialize a pointer for the constant
-PropList* PropList::DEFAULT_ = 0;
+PropList *PropList::DEFAULT_ = 0;
//--------------------------------------------------------------------------
// Function: PropList::getConstant
@@ -48,13 +47,13 @@ PropList* PropList::DEFAULT_ = 0;
// throw a PropListIException. This scenario should not happen.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-PropList* PropList::getConstant()
+PropList *
+PropList::getConstant()
{
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
- if (!IdComponent::H5dontAtexit_called)
- {
- (void) H5dont_atexit();
+ if (!IdComponent::H5dontAtexit_called) {
+ (void)H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -63,8 +62,9 @@ PropList* PropList::getConstant()
if (DEFAULT_ == 0)
DEFAULT_ = new PropList(H5P_DEFAULT);
else
- throw PropListIException("PropList::getConstant", "PropList::getConstant is being invoked on an allocated DEFAULT_");
- return(DEFAULT_);
+ throw PropListIException("PropList::getConstant",
+ "PropList::getConstant is being invoked on an allocated DEFAULT_");
+ return (DEFAULT_);
}
//--------------------------------------------------------------------------
@@ -72,7 +72,8 @@ PropList* PropList::getConstant()
// Purpose Deletes the constant object that PropList::DEFAULT_ points to.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-void PropList::deleteConstants()
+void
+PropList::deleteConstants()
{
if (DEFAULT_ != 0)
delete DEFAULT_;
@@ -81,7 +82,7 @@ void PropList::deleteConstants()
//--------------------------------------------------------------------------
// Purpose Constant for default property.
//--------------------------------------------------------------------------
-const PropList& PropList::DEFAULT = *getConstant();
+const PropList &PropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -98,7 +99,7 @@ PropList::PropList() : IdComponent(), id(H5P_DEFAULT) {}
///\param original - IN: The original property list to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-PropList::PropList(const PropList& original) : IdComponent(), id(original.id)
+PropList::PropList(const PropList &original) : IdComponent(), id(original.id)
{
incRefCount(); // increment number of references to this id
}
@@ -123,21 +124,19 @@ PropList::PropList(const hid_t plist_id) : IdComponent()
H5I_type_t id_type = H5Iget_type(plist_id);
switch (id_type) {
case H5I_GENPROP_CLS:
- // call C routine to create a new property from the given prop class
- id = H5Pcreate(plist_id);
- if (id < 0)
- {
- throw PropListIException("PropList constructor", "H5Pcreate failed");
- }
- break;
+ // call C routine to create a new property from the given prop class
+ id = H5Pcreate(plist_id);
+ if (id < 0) {
+ throw PropListIException("PropList constructor", "H5Pcreate failed");
+ }
+ break;
case H5I_GENPROP_LST:
- // call C routine to make a copy of the given property list
- id = H5Pcopy(plist_id);
- if (id < 0)
- {
- throw PropListIException("PropList constructor", "H5Pcopy failed");
- }
- break;
+ // call C routine to make a copy of the given property list
+ id = H5Pcopy(plist_id);
+ if (id < 0) {
+ throw PropListIException("PropList constructor", "H5Pcopy failed");
+ }
+ break;
/* These should really be error cases, but changing that breaks
* the stated behavior and causes test failures.
* (DER, July 2017)
@@ -157,8 +156,8 @@ PropList::PropList(const hid_t plist_id) : IdComponent()
case H5I_NTYPES:
case H5I_UNINIT:
default:
- id = H5P_DEFAULT;
- break;
+ id = H5P_DEFAULT;
+ break;
}
}
@@ -174,14 +173,15 @@ PropList::PropList(const hid_t plist_id) : IdComponent()
// - Replaced decRefCount with close() to let the C library
// handle the reference counting - BMR, Jun 1, 2006
//--------------------------------------------------------------------------
-void PropList::copy(const PropList& like_plist)
+void
+PropList::copy(const PropList &like_plist)
{
// If this object is representing an hdf5 object, close it before
// copying like_plist to it
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw PropListIException(inMemFunc("copy"), close_error.getDetailMsg());
}
@@ -202,11 +202,12 @@ void PropList::copy(const PropList& like_plist)
// and stores the new id in the left hand side object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-PropList& PropList::operator=(const PropList& rhs)
+PropList &
+PropList::operator=(const PropList &rhs)
{
if (this != &rhs)
copy(rhs);
- return(*this);
+ return (*this);
}
//--------------------------------------------------------------------------
@@ -217,12 +218,12 @@ PropList& PropList::operator=(const PropList& rhs)
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-void PropList::copyProp(PropList& dest, const char *name) const
+void
+PropList::copyProp(PropList &dest, const char *name) const
{
- hid_t dst_id = dest.getId();
+ hid_t dst_id = dest.getId();
herr_t ret_value = H5Pcopy_prop(dst_id, id, name);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("copyProp"), "H5Pcopy_prop failed");
}
}
@@ -236,7 +237,8 @@ void PropList::copyProp(PropList& dest, const char *name) const
///\param name - IN: Name of the property to copy - \c H5std_string
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-void PropList::copyProp(PropList& dest, const H5std_string& name) const
+void
+PropList::copyProp(PropList &dest, const H5std_string &name) const
{
copyProp(dest, name.c_str());
}
@@ -251,16 +253,15 @@ void PropList::copyProp(PropList& dest, const H5std_string& name) const
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void PropList::copyProp(PropList& dest, PropList& src, const char *name) const
+void
+PropList::copyProp(PropList &dest, PropList &src, const char *name) const
{
- hid_t dst_id = dest.getId();
- hid_t src_id = src.getId();
+ hid_t dst_id = dest.getId();
+ hid_t src_id = src.getId();
herr_t ret_value = H5Pcopy_prop(dst_id, src_id, name);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("copyProp"), "H5Pcopy_prop failed");
}
-
}
//--------------------------------------------------------------------------
@@ -273,7 +274,8 @@ void PropList::copyProp(PropList& dest, PropList& src, const char *name) const
///\param name - IN: Name of the property to copy - \c H5std_string
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void PropList::copyProp(PropList& dest, PropList& src, const H5std_string& name) const
+void
+PropList::copyProp(PropList &dest, PropList &src, const H5std_string &name) const
{
copyProp(dest, src, name.c_str());
}
@@ -289,9 +291,10 @@ void PropList::copyProp(PropList& dest, PropList& src, const H5std_string& name)
// IdComponent::getId now becomes pure virtual function.
// Programmer Binh-Minh Ribler - May, 2008
//--------------------------------------------------------------------------
-hid_t PropList::getId() const
+hid_t
+PropList::getId() const
{
- return(id);
+ return (id);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -307,17 +310,18 @@ hid_t PropList::getId() const
// Then the object's id is reset to the new id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void PropList::p_setId(const hid_t new_id)
+void
+PropList::p_setId(const hid_t new_id)
{
// handling references to this old id
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
throw PropListIException(inMemFunc("p_setId"), close_error.getDetailMsg());
}
- // reset object's id to the given id
- id = new_id;
+ // reset object's id to the given id
+ id = new_id;
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -329,13 +333,12 @@ void PropList::p_setId(const hid_t new_id)
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
-void PropList::close()
+void
+PropList::close()
{
- if (p_valid_id(id))
- {
+ if (p_valid_id(id)) {
herr_t ret_value = H5Pclose(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("close"), "H5Pclose failed");
}
// reset the id
@@ -350,15 +353,14 @@ void PropList::close()
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-hid_t PropList::getClass() const
+hid_t
+PropList::getClass() const
{
hid_t plist_class = H5Pget_class(id);
- if (plist_class == H5P_ROOT)
- {
- throw PropListIException(inMemFunc("getClass"),
- "H5Pget_class failed - returned H5P_ROOT");
+ if (plist_class == H5P_ROOT) {
+ throw PropListIException(inMemFunc("getClass"), "H5Pget_class failed - returned H5P_ROOT");
}
- return(plist_class);
+ return (plist_class);
}
//--------------------------------------------------------------------------
@@ -373,7 +375,8 @@ hid_t PropList::getClass() const
/// list or class.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-bool PropList::propExist(const char* name) const
+bool
+PropList::propExist(const char *name) const
{
// Calls C routine H5Pexist to determine whether a property exists
// within a property list or class. It returns a positive value, 0,
@@ -396,9 +399,10 @@ bool PropList::propExist(const char* name) const
///\param name - IN: Name of property to check for - \c H5std_string
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-bool PropList::propExist(const H5std_string& name) const
+bool
+PropList::propExist(const H5std_string &name) const
{
- return(propExist( name.c_str()));
+ return (propExist(name.c_str()));
}
//--------------------------------------------------------------------------
@@ -411,11 +415,11 @@ bool PropList::propExist(const H5std_string& name) const
/// list class hierarchy.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void PropList::closeClass() const
+void
+PropList::closeClass() const
{
herr_t ret_value = H5Pclose_class(id);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("closeClass"), "H5Pclose_class failed");
}
}
@@ -432,11 +436,11 @@ void PropList::closeClass() const
/// throw an exception.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void PropList::getProperty(const char* name, void* value) const
+void
+PropList::getProperty(const char *name, void *value) const
{
herr_t ret_value = H5Pget(id, name, value);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("getProperty"), "H5Pget failed");
}
}
@@ -450,27 +454,27 @@ void PropList::getProperty(const char* name, void* value) const
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-H5std_string PropList::getProperty(const char* name) const
+H5std_string
+PropList::getProperty(const char *name) const
{
// Get property size first
size_t size = getPropSize(name);
// Allocate buffer then get the property
- char* prop_strg_C = new char[size+1]; // temporary C-string for C API
- HDmemset(prop_strg_C, 0, size+1); // clear buffer
+ char *prop_strg_C = new char[size + 1]; // temporary C-string for C API
+ HDmemset(prop_strg_C, 0, size + 1); // clear buffer
herr_t ret_value = H5Pget(id, name, prop_strg_C); // call C API
// Throw exception if H5Pget returns failure
- if (ret_value < 0)
- {
- delete []prop_strg_C;
+ if (ret_value < 0) {
+ delete[] prop_strg_C;
throw PropListIException(inMemFunc("getProperty"), "H5Pget failed");
}
// Return property value as a string after deleting temp C-string
H5std_string prop_strg(prop_strg_C);
- delete []prop_strg_C;
+ delete[] prop_strg_C;
return (prop_strg);
}
//--------------------------------------------------------------------------
@@ -482,7 +486,8 @@ H5std_string PropList::getProperty(const char* name) const
///\param value - OUT: Pointer to the buffer for the property value
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void PropList::getProperty(const H5std_string& name, void* value) const
+void
+PropList::getProperty(const H5std_string &name, void *value) const
{
getProperty(name.c_str(), value);
}
@@ -495,7 +500,8 @@ void PropList::getProperty(const H5std_string& name, void* value) const
///\return The property that is a \c H5std_string.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-H5std_string PropList::getProperty(const H5std_string& name) const
+H5std_string
+PropList::getProperty(const H5std_string &name) const
{
return (getProperty(name.c_str()));
}
@@ -513,15 +519,15 @@ H5std_string PropList::getProperty(const H5std_string& name) const
/// lists and classes.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-size_t PropList::getPropSize(const char *name) const
+size_t
+PropList::getPropSize(const char *name) const
{
size_t prop_size;
herr_t ret_value = H5Pget_size(id, name, &prop_size);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("getPropSize"), "H5Pget_size failed");
}
- return(prop_size);
+ return (prop_size);
}
//--------------------------------------------------------------------------
// Function: PropList::getPropSize
@@ -532,7 +538,8 @@ size_t PropList::getPropSize(const char *name) const
///
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-size_t PropList::getPropSize(const H5std_string& name) const
+size_t
+PropList::getPropSize(const H5std_string &name) const
{
return (getPropSize(name.c_str()));
}
@@ -544,15 +551,15 @@ size_t PropList::getPropSize(const H5std_string& name) const
/// a NULL string.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-H5std_string PropList::getClassName() const
+H5std_string
+PropList::getClassName() const
{
- char* temp_str;
+ char *temp_str;
temp_str = H5Pget_class_name(id);
- if (temp_str != NULL)
- {
+ if (temp_str != NULL) {
H5std_string class_name(temp_str);
H5free_memory(temp_str);
- return(class_name);
+ return (class_name);
}
else
return 0;
@@ -564,12 +571,12 @@ H5std_string PropList::getClassName() const
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-size_t PropList::getNumProps() const
+size_t
+PropList::getNumProps() const
{
size_t nprops;
- herr_t ret_value = H5Pget_nprops (id, &nprops);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Pget_nprops(id, &nprops);
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("getNumProps"), "H5Pget_nprops failed");
}
return (nprops);
@@ -586,11 +593,11 @@ size_t PropList::getNumProps() const
// the non-const setProperty.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void PropList::setProperty(const char* name, const void* value) const
+void
+PropList::setProperty(const char *name, const void *value) const
{
herr_t ret_value = H5Pset(id, name, value);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("setProperty"), "H5Pset failed");
}
}
@@ -602,11 +609,11 @@ void PropList::setProperty(const char* name, const void* value) const
// Modification
// Planned for removal. -BMR, 2017/03/17 1.10.1
//--------------------------------------------------------------------------
-void PropList::setProperty(const char* name, void* value) const
+void
+PropList::setProperty(const char *name, void *value) const
{
herr_t ret_value = H5Pset(id, name, value);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("setProperty"), "H5Pset failed");
}
}
@@ -623,11 +630,11 @@ void PropList::setProperty(const char* name, void* value) const
// the non-const setProperty.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void PropList::setProperty(const char* name, const char* charptr) const
+void
+PropList::setProperty(const char *name, const char *charptr) const
{
- herr_t ret_value = H5Pset(id, name, (const void*)charptr);
- if (ret_value < 0)
- {
+ herr_t ret_value = H5Pset(id, name, (const void *)charptr);
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("setProperty"), "H5Pset failed");
}
}
@@ -640,7 +647,8 @@ void PropList::setProperty(const char* name, const char* charptr) const
///\param strg - IN: Value for the property is a \c H5std_string
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void PropList::setProperty(const char* name, const H5std_string& strg) const
+void
+PropList::setProperty(const char *name, const H5std_string &strg) const
{
setProperty(name, strg.c_str());
}
@@ -652,7 +660,8 @@ void PropList::setProperty(const char* name, const H5std_string& strg) const
// Modification
// Planned for removal. -BMR, 2017/03/17 1.10.1
//--------------------------------------------------------------------------
-void PropList::setProperty(const char* name, H5std_string& strg) const
+void
+PropList::setProperty(const char *name, H5std_string &strg) const
{
setProperty(name, strg.c_str());
}
@@ -666,7 +675,8 @@ void PropList::setProperty(const char* name, H5std_string& strg) const
///\param value - IN: Void pointer to the value for the property
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void PropList::setProperty(const H5std_string& name, const void* value) const
+void
+PropList::setProperty(const H5std_string &name, const void *value) const
{
setProperty(name.c_str(), value);
}
@@ -678,7 +688,8 @@ void PropList::setProperty(const H5std_string& name, const void* value) const
// Modification
// Planned for removal. -BMR, 2017/03/17 1.10.1
//--------------------------------------------------------------------------
-void PropList::setProperty(const H5std_string& name, void* value) const
+void
+PropList::setProperty(const H5std_string &name, void *value) const
{
setProperty(name.c_str(), value);
}
@@ -692,7 +703,8 @@ void PropList::setProperty(const H5std_string& name, void* value) const
///\param strg - IN: Value for the property is a \c H5std_string
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void PropList::setProperty(const H5std_string& name, const H5std_string& strg) const
+void
+PropList::setProperty(const H5std_string &name, const H5std_string &strg) const
{
setProperty(name.c_str(), strg.c_str());
}
@@ -704,7 +716,8 @@ void PropList::setProperty(const H5std_string& name, const H5std_string& strg) c
// Modification
// Planned for removal. -BMR, 2017/03/17 1.10.1
//--------------------------------------------------------------------------
-void PropList::setProperty(const H5std_string& name, H5std_string& strg) const
+void
+PropList::setProperty(const H5std_string &name, H5std_string &strg) const
{
setProperty(name.c_str(), strg.c_str());
}
@@ -718,7 +731,8 @@ void PropList::setProperty(const H5std_string& name, H5std_string& strg) const
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-bool PropList::isAClass(const PropList& prop_class) const
+bool
+PropList::isAClass(const PropList &prop_class) const
{
htri_t ret_value = H5Pisa_class(id, prop_class.getId());
if (ret_value > 0)
@@ -738,11 +752,11 @@ bool PropList::isAClass(const PropList& prop_class) const
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void PropList::removeProp(const char *name) const
+void
+PropList::removeProp(const char *name) const
{
herr_t ret_value = H5Premove(id, name);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw PropListIException(inMemFunc("removeProp"), "H5Premove failed");
}
}
@@ -755,7 +769,8 @@ void PropList::removeProp(const char *name) const
///\param name - IN: Name of property to remove - \c H5std_string
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void PropList::removeProp(const H5std_string& name) const
+void
+PropList::removeProp(const H5std_string &name) const
{
removeProp(name.c_str());
}
@@ -769,7 +784,8 @@ void PropList::removeProp(const H5std_string& name) const
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-bool PropList::operator==(const PropList& rhs) const
+bool
+PropList::operator==(const PropList &rhs) const
{
htri_t ret_value = H5Pequal(id, rhs.getId());
if (ret_value > 0)
@@ -789,15 +805,15 @@ bool PropList::operator==(const PropList& rhs) const
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-PropList PropList::getClassParent() const
+PropList
+PropList::getClassParent() const
{
hid_t class_id = H5Pget_class_parent(id);
- if (class_id < 0)
- {
+ if (class_id < 0) {
throw PropListIException(inMemFunc("getClassParent"), "H5Pget_class_parent failed");
}
PropList pclass(class_id);
- return(pclass);
+ return (pclass);
}
//--------------------------------------------------------------------------
@@ -815,9 +831,9 @@ PropList::~PropList()
try {
close();
}
- catch (Exception& close_error) {
+ catch (Exception &close_error) {
cerr << "PropList::~PropList - " << close_error.getDetailMsg() << endl;
}
}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h
index d704775..805f6da 100644
--- a/c++/src/H5PropList.h
+++ b/c++/src/H5PropList.h
@@ -23,121 +23,125 @@ namespace H5 {
*/
// Inheritance: IdComponent
class H5_DLLCPP PropList : public IdComponent {
- public:
- ///\brief Default property list
- static const PropList& DEFAULT;
+ public:
+ ///\brief Default property list
+ static const PropList &DEFAULT;
- // Creates a property list of a given type or creates a copy of an
- // existing property list giving the property list id.
- PropList(const hid_t plist_id);
+ // Creates a property list of a given type or creates a copy of an
+ // existing property list giving the property list id.
+ PropList(const hid_t plist_id);
- // Make a copy of the given property list using assignment statement
- PropList& operator=(const PropList& rhs);
+ // Make a copy of the given property list using assignment statement
+ PropList &operator=(const PropList &rhs);
- // Compares this property list or class against the given list or class.
- bool operator==(const PropList& rhs) const;
+ // Compares this property list or class against the given list or class.
+ bool operator==(const PropList &rhs) const;
- // Close this property list.
- virtual void close();
+ // Close this property list.
+ virtual void close();
- // Close a property list class.
- void closeClass() const;
+ // Close a property list class.
+ void closeClass() const;
- // Makes a copy of the given property list.
- void copy(const PropList& like_plist);
+ // Makes a copy of the given property list.
+ void copy(const PropList &like_plist);
- // Copies a property from this property list or class to another
- void copyProp(PropList& dest, const char* name) const;
- void copyProp(PropList& dest, const H5std_string& name) const;
+ // Copies a property from this property list or class to another
+ void copyProp(PropList &dest, const char *name) const;
+ void copyProp(PropList &dest, const H5std_string &name) const;
- // Copies a property from one property list or property class to another
- void copyProp(PropList& dest, PropList& src, const char* name) const;
- void copyProp(PropList& dest, PropList& src, const H5std_string& name) const;
+ // Copies a property from one property list or property class to another
+ void copyProp(PropList &dest, PropList &src, const char *name) const;
+ void copyProp(PropList &dest, PropList &src, const H5std_string &name) const;
- // Gets the class of this property list, i.e. H5P_FILE_CREATE,
- // H5P_FILE_ACCESS, ...
- hid_t getClass() const;
+ // Gets the class of this property list, i.e. H5P_FILE_CREATE,
+ // H5P_FILE_ACCESS, ...
+ hid_t getClass() const;
- // Return the name of a generic property list class.
- H5std_string getClassName() const;
+ // Return the name of a generic property list class.
+ H5std_string getClassName() const;
- // Returns the parent class of a generic property class.
- PropList getClassParent() const;
+ // Returns the parent class of a generic property class.
+ PropList getClassParent() const;
- // Returns the number of properties in this property list or class.
- size_t getNumProps() const;
+ // Returns the number of properties in this property list or class.
+ size_t getNumProps() const;
- // Query the value of a property in a property list.
- void getProperty(const char* name, void* value) const;
- void getProperty(const H5std_string& name, void* value) const;
- H5std_string getProperty(const char* name) const;
- H5std_string getProperty(const H5std_string& name) const;
+ // Query the value of a property in a property list.
+ void getProperty(const char *name, void *value) const;
+ void getProperty(const H5std_string &name, void *value) const;
+ H5std_string getProperty(const char *name) const;
+ H5std_string getProperty(const H5std_string &name) const;
- // Set a property's value in a property list.
- void setProperty(const char* name, const char* charptr) const;
- void setProperty(const char* name, const void* value) const;
- void setProperty(const char* name, const H5std_string& strg) const;
- void setProperty(const H5std_string& name, const void* value) const;
- void setProperty(const H5std_string& name, const H5std_string& strg) const;
- // Deprecated after 1.10.1, missing const
- void setProperty(const char* name, void* value) const;
- void setProperty(const char* name, H5std_string& strg) const;
- void setProperty(const H5std_string& name, void* value) const;
- void setProperty(const H5std_string& name, H5std_string& strg) const;
+ // Set a property's value in a property list.
+ void setProperty(const char *name, const char *charptr) const;
+ void setProperty(const char *name, const void *value) const;
+ void setProperty(const char *name, const H5std_string &strg) const;
+ void setProperty(const H5std_string &name, const void *value) const;
+ void setProperty(const H5std_string &name, const H5std_string &strg) const;
+ // Deprecated after 1.10.1, missing const
+ void setProperty(const char *name, void *value) const;
+ void setProperty(const char *name, H5std_string &strg) const;
+ void setProperty(const H5std_string &name, void *value) const;
+ void setProperty(const H5std_string &name, H5std_string &strg) const;
- // Query the size of a property in a property list or class.
- size_t getPropSize(const char *name) const;
- size_t getPropSize(const H5std_string& name) const;
+ // Query the size of a property in a property list or class.
+ size_t getPropSize(const char *name) const;
+ size_t getPropSize(const H5std_string &name) const;
- // Determines whether a property list is a certain class.
- bool isAClass(const PropList& prop_class) const;
+ // Determines whether a property list is a certain class.
+ bool isAClass(const PropList &prop_class) const;
- /// Query the existence of a property in a property object.
- bool propExist(const char* name) const;
- bool propExist(const H5std_string& name) const;
+ /// Query the existence of a property in a property object.
+ bool propExist(const char *name) const;
+ bool propExist(const H5std_string &name) const;
- // Removes a property from a property list.
- void removeProp(const char *name) const;
- void removeProp(const H5std_string& name) const;
+ // Removes a property from a property list.
+ void removeProp(const char *name) const;
+ void removeProp(const H5std_string &name) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("PropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("PropList");
+ }
- // Default constructor: creates a stub PropList object.
- PropList();
+ // Default constructor: creates a stub PropList object.
+ PropList();
- // Copy constructor: same as the original PropList.
- PropList(const PropList& original);
+ // Copy constructor: same as the original PropList.
+ PropList(const PropList &original);
- // Gets the property list id.
- virtual hid_t getId() const;
+ // Gets the property list id.
+ virtual hid_t getId() const;
- // Destructor: properly terminates access to this property list.
- virtual ~PropList();
+ // Destructor: properly terminates access to this property list.
+ virtual ~PropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the PropList global constant
- static void deleteConstants();
+ // Deletes the PropList global constant
+ static void deleteConstants();
- protected:
- hid_t id; // HDF5 property list id
+ protected:
+ hid_t id; // HDF5 property list id
- // Sets the property list id.
- virtual void p_setId(const hid_t new_id);
+ // Sets the property list id.
+ virtual void p_setId(const hid_t new_id);
- private:
- static PropList* DEFAULT_;
+ private:
+ static PropList *DEFAULT_;
- // Dynamically allocates the PropList global constant
- static PropList* getConstant();
+ // Dynamically allocates the PropList global constant
+ static PropList *getConstant();
- // Friend function to set PropList id. For library use only.
- friend void f_PropList_setId(PropList* plist, hid_t new_id);
+ // Friend function to set PropList id. For library use only.
+ friend void f_PropList_setId(PropList *plist, hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
}; // end of PropList
} // namespace H5
-#endif // __H5PropList_H
+#endif // __H5PropList_H
diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp
index f5b65e4..c246933 100644
--- a/c++/src/H5StrType.cpp
+++ b/c++/src/H5StrType.cpp
@@ -49,7 +49,7 @@ StrType::StrType() : AtomType() {}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType::StrType(const PredType& pred_type) : AtomType()
+StrType::StrType(const PredType &pred_type) : AtomType()
{
// use DataType::copy to make a copy of this predefined type
copy(pred_type);
@@ -78,7 +78,7 @@ StrType::StrType(const PredType& pred_type) : AtomType()
// Planned for removal. -BMR, 2005/12/02
// Removed from documentation. -BMR, 2016/03/07
//--------------------------------------------------------------------------
-StrType::StrType(const PredType& pred_type, const size_t& size) : AtomType()
+StrType::StrType(const PredType &pred_type, const size_t &size) : AtomType()
{
// use DataType::copy to make a copy of the string predefined type
// then set its length
@@ -102,7 +102,7 @@ StrType::StrType(const PredType& pred_type, const size_t& size) : AtomType()
// This constructor replaced the previous one.
// Programmer Binh-Minh Ribler - Nov 28, 2005
//--------------------------------------------------------------------------
-StrType::StrType(const int dummy, const size_t& size) : AtomType()
+StrType::StrType(const int dummy, const size_t &size) : AtomType()
{
// use DataType::copy to make a copy of the string predefined type
// then set its length
@@ -117,14 +117,14 @@ StrType::StrType(const int dummy, const size_t& size) : AtomType()
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType::StrType(const hid_t existing_id) : AtomType( existing_id ) {}
+StrType::StrType(const hid_t existing_id) : AtomType(existing_id) {}
//--------------------------------------------------------------------------
// Function: StrType copy constructor
///\brief Copy constructor: same HDF5 object as \a original
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType::StrType(const StrType& original) : AtomType ( original ) {}
+StrType::StrType(const StrType &original) : AtomType(original) {}
//--------------------------------------------------------------------------
// Function: StrType overloaded constructor
@@ -133,13 +133,12 @@ StrType::StrType(const StrType& original) : AtomType ( original ) {}
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType::StrType(const DataSet& dataset) : AtomType ()
+StrType::StrType(const DataSet &dataset) : AtomType()
{
// Calls C function H5Dget_type to get the id of the datatype
id = H5Dget_type(dataset.getId());
- if (id < 0)
- {
+ if (id < 0) {
throw DataSetIException("StrType constructor", "H5Dget_type failed");
}
}
@@ -158,7 +157,7 @@ StrType::StrType(const DataSet& dataset) : AtomType ()
// improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-StrType::StrType(const H5Location& loc, const char *dtype_name) : AtomType()
+StrType::StrType(const H5Location &loc, const char *dtype_name) : AtomType()
{
id = p_opentype(loc, dtype_name);
}
@@ -177,7 +176,7 @@ StrType::StrType(const H5Location& loc, const char *dtype_name) : AtomType()
// to improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-StrType::StrType(const H5Location& loc, const H5std_string& dtype_name) : AtomType()
+StrType::StrType(const H5Location &loc, const H5std_string &dtype_name) : AtomType()
{
id = p_opentype(loc, dtype_name.c_str());
}
@@ -190,7 +189,8 @@ StrType::StrType(const H5Location& loc, const H5std_string& dtype_name) : AtomTy
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-DataType* StrType::decode() const
+DataType *
+StrType::decode() const
{
hid_t encoded_strtype_id = H5I_INVALID_HID;
try {
@@ -201,7 +201,7 @@ DataType* StrType::decode() const
}
StrType *encoded_strtype = new StrType;
encoded_strtype->p_setId(encoded_strtype_id);
- return(encoded_strtype);
+ return (encoded_strtype);
}
//--------------------------------------------------------------------------
@@ -219,16 +219,16 @@ DataType* StrType::decode() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5T_cset_t StrType::getCset() const
+H5T_cset_t
+StrType::getCset() const
{
H5T_cset_t cset = H5Tget_cset(id);
// Returns a valid character set type if successful
- if (cset == H5T_CSET_ERROR)
- {
+ if (cset == H5T_CSET_ERROR) {
throw DataTypeIException("StrType::getCset", "H5Tget_cset failed");
}
- return(cset);
+ return (cset);
}
//--------------------------------------------------------------------------
@@ -246,11 +246,11 @@ H5T_cset_t StrType::getCset() const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void StrType::setCset(H5T_cset_t cset) const
+void
+StrType::setCset(H5T_cset_t cset) const
{
herr_t ret_value = H5Tset_cset(id, cset);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("StrType::setCset", "H5Tset_cset failed");
}
}
@@ -265,17 +265,16 @@ void StrType::setCset(H5T_cset_t cset) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5T_str_t StrType::getStrpad() const
+H5T_str_t
+StrType::getStrpad() const
{
H5T_str_t strpad = H5Tget_strpad(id);
// Returns a valid string padding type if successful
- if (strpad == H5T_STR_ERROR)
- {
- throw DataTypeIException("StrType::getStrpad",
- "H5Tget_strpad failed - returned H5T_STR_ERROR");
+ if (strpad == H5T_STR_ERROR) {
+ throw DataTypeIException("StrType::getStrpad", "H5Tget_strpad failed - returned H5T_STR_ERROR");
}
- return(strpad);
+ return (strpad);
}
//--------------------------------------------------------------------------
@@ -288,11 +287,11 @@ H5T_str_t StrType::getStrpad() const
/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void StrType::setStrpad(H5T_str_t strpad) const
+void
+StrType::setStrpad(H5T_str_t strpad) const
{
herr_t ret_value = H5Tset_strpad(id, strpad);
- if (ret_value < 0)
- {
+ if (ret_value < 0) {
throw DataTypeIException("StrType::setStrpad", "H5Tset_strpad failed");
}
}
@@ -304,4 +303,4 @@ void StrType::setStrpad(H5T_str_t strpad) const
//--------------------------------------------------------------------------
StrType::~StrType() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h
index 38974da..d442bc4 100644
--- a/c++/src/H5StrType.h
+++ b/c++/src/H5StrType.h
@@ -23,53 +23,57 @@ namespace H5 {
*/
// Inheritance: AtomType -> DataType -> H5Object -> H5Location -> IdComponent
class H5_DLLCPP StrType : public AtomType {
- public:
- // Creates a string type using a predefined type
- StrType(const PredType& pred_type);
+ public:
+ // Creates a string type using a predefined type
+ StrType(const PredType &pred_type);
- // Creates a string type with specified length - may be obsolete
- StrType(const PredType& pred_type, const size_t& size);
+ // Creates a string type with specified length - may be obsolete
+ StrType(const PredType &pred_type, const size_t &size);
- // Creates a string type with specified length
- StrType(const int dummy, const size_t& size);
+ // Creates a string type with specified length
+ StrType(const int dummy, const size_t &size);
- // Gets the string datatype of the specified dataset
- StrType(const DataSet& dataset);
+ // Gets the string datatype of the specified dataset
+ StrType(const DataSet &dataset);
- // Constructors that open an HDF5 string datatype, given a location.
- StrType(const H5Location& loc, const char* name);
- StrType(const H5Location& loc, const H5std_string& name);
+ // Constructors that open an HDF5 string datatype, given a location.
+ StrType(const H5Location &loc, const char *name);
+ StrType(const H5Location &loc, const H5std_string &name);
- // Returns an StrType object via DataType* by decoding the
- // binary object description of this type.
- virtual DataType* decode() const;
+ // Returns an StrType object via DataType* by decoding the
+ // binary object description of this type.
+ virtual DataType *decode() const;
- // Retrieves the character set type of this string datatype.
- H5T_cset_t getCset() const;
+ // Retrieves the character set type of this string datatype.
+ H5T_cset_t getCset() const;
- // Sets character set to be used.
- void setCset(H5T_cset_t cset) const;
+ // Sets character set to be used.
+ void setCset(H5T_cset_t cset) const;
- // Retrieves the string padding method for this string datatype.
- H5T_str_t getStrpad() const;
+ // Retrieves the string padding method for this string datatype.
+ H5T_str_t getStrpad() const;
- // Defines the storage mechanism for character strings.
- void setStrpad(H5T_str_t strpad) const;
+ // Defines the storage mechanism for character strings.
+ void setStrpad(H5T_str_t strpad) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("StrType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("StrType");
+ }
- // default constructor
- StrType();
+ // default constructor
+ StrType();
- // Creates a string datatype using an existing id
- StrType(const hid_t existing_id);
+ // Creates a string datatype using an existing id
+ StrType(const hid_t existing_id);
- // Copy constructor: same as the original StrType.
- StrType(const StrType& original);
+ // Copy constructor: same as the original StrType.
+ StrType(const StrType &original);
- // Noop destructor.
- virtual ~StrType();
+ // Noop destructor.
+ virtual ~StrType();
}; // end of StrType
} // namespace H5
diff --git a/c++/src/H5VarLenType.cpp b/c++/src/H5VarLenType.cpp
index 094af61..cb2478e 100644
--- a/c++/src/H5VarLenType.cpp
+++ b/c++/src/H5VarLenType.cpp
@@ -49,7 +49,7 @@ VarLenType::VarLenType(const hid_t existing_id) : DataType(existing_id) {}
///\brief Copy constructor: same HDF5 object as \a original
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-VarLenType::VarLenType(const VarLenType& original) : DataType(original) {}
+VarLenType::VarLenType(const VarLenType &original) : DataType(original) {}
//--------------------------------------------------------------------------
// Function: VarLenType overloaded constructor
@@ -63,13 +63,11 @@ VarLenType::VarLenType(const VarLenType& original) : DataType(original) {}
// -BMR, Sep, 2017
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-VarLenType::VarLenType(const DataType* base_type) : DataType()
+VarLenType::VarLenType(const DataType *base_type) : DataType()
{
id = H5Tvlen_create(base_type->getId());
- if (id < 0)
- {
- throw DataTypeIException("VarLenType constructor",
- "H5Tvlen_create returns negative value");
+ if (id < 0) {
+ throw DataTypeIException("VarLenType constructor", "H5Tvlen_create returns negative value");
}
}
@@ -81,13 +79,11 @@ VarLenType::VarLenType(const DataType* base_type) : DataType()
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
-VarLenType::VarLenType(const DataType& base_type) : DataType()
+VarLenType::VarLenType(const DataType &base_type) : DataType()
{
id = H5Tvlen_create(base_type.getId());
- if (id < 0)
- {
- throw DataTypeIException("VarLenType constructor",
- "H5Tvlen_create returns negative value");
+ if (id < 0) {
+ throw DataTypeIException("VarLenType constructor", "H5Tvlen_create returns negative value");
}
}
@@ -105,7 +101,7 @@ VarLenType::VarLenType(const DataType& base_type) : DataType()
// improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-VarLenType::VarLenType(const H5Location& loc, const char *dtype_name) : DataType()
+VarLenType::VarLenType(const H5Location &loc, const char *dtype_name) : DataType()
{
id = p_opentype(loc, dtype_name);
}
@@ -124,7 +120,7 @@ VarLenType::VarLenType(const H5Location& loc, const char *dtype_name) : DataType
// to improve usability.
// -BMR, Dec 2016
//--------------------------------------------------------------------------
-VarLenType::VarLenType(const H5Location& loc, const H5std_string& dtype_name) : DataType()
+VarLenType::VarLenType(const H5Location &loc, const H5std_string &dtype_name) : DataType()
{
id = p_opentype(loc, dtype_name.c_str());
}
@@ -137,7 +133,8 @@ VarLenType::VarLenType(const H5Location& loc, const H5std_string& dtype_name) :
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Aug 2017
//--------------------------------------------------------------------------
-DataType* VarLenType::decode() const
+DataType *
+VarLenType::decode() const
{
hid_t encoded_vltype_id = H5I_INVALID_HID;
try {
@@ -148,7 +145,7 @@ DataType* VarLenType::decode() const
}
VarLenType *encoded_vltype = new VarLenType;
encoded_vltype->p_setId(encoded_vltype_id);
- return(encoded_vltype);
+ return (encoded_vltype);
}
//--------------------------------------------------------------------------
@@ -158,4 +155,4 @@ DataType* VarLenType::decode() const
//--------------------------------------------------------------------------
VarLenType::~VarLenType() {}
-} // end namespace
+} // namespace H5
diff --git a/c++/src/H5VarLenType.h b/c++/src/H5VarLenType.h
index ab3c14c..56c699b 100644
--- a/c++/src/H5VarLenType.h
+++ b/c++/src/H5VarLenType.h
@@ -23,36 +23,40 @@ namespace H5 {
*/
// Inheritance: DataType -> H5Object -> H5Location -> IdComponent
class H5_DLLCPP VarLenType : public DataType {
- public:
- // Constructor that creates a variable-length datatype based
- // on the specified base type.
- VarLenType(const DataType& base_type);
+ public:
+ // Constructor that creates a variable-length datatype based
+ // on the specified base type.
+ VarLenType(const DataType &base_type);
- // Deprecated - will be removed after 1.10.2
- VarLenType(const DataType* base_type);
+ // Deprecated - will be removed after 1.10.2
+ VarLenType(const DataType *base_type);
- // Returns an VarLenType object via DataType* by decoding the
- // binary object description of this type.
- virtual DataType* decode() const;
+ // Returns an VarLenType object via DataType* by decoding the
+ // binary object description of this type.
+ virtual DataType *decode() const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("VarLenType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string
+ fromClass() const
+ {
+ return ("VarLenType");
+ }
- // Copy constructor: same as the original VarLenType.
- VarLenType(const VarLenType& original);
+ // Copy constructor: same as the original VarLenType.
+ VarLenType(const VarLenType &original);
- // Constructor that takes an existing id
- VarLenType(const hid_t existing_id);
+ // Constructor that takes an existing id
+ VarLenType(const hid_t existing_id);
- // Constructors that open a variable-length datatype, given a location.
- VarLenType(const H5Location& loc, const char* name);
- VarLenType(const H5Location& loc, const H5std_string& name);
+ // Constructors that open a variable-length datatype, given a location.
+ VarLenType(const H5Location &loc, const char *name);
+ VarLenType(const H5Location &loc, const H5std_string &name);
- // Noop destructor
- virtual ~VarLenType();
+ // Noop destructor
+ virtual ~VarLenType();
- // Default constructor
- VarLenType();
+ // Default constructor
+ VarLenType();
}; // end of VarLenType
} // namespace H5
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp
index 76e4424..0116d6c 100644
--- a/c++/test/dsets.cpp
+++ b/c++/test/dsets.cpp
@@ -32,29 +32,28 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
-const H5std_string FILE1("dataset.h5");
-const H5std_string DSET_DEFAULT_NAME("default");
-const H5std_string DSET_DEFAULT_NAME_PATH("/default");
-const H5std_string DSET_CHUNKED_NAME("chunked");
-const H5std_string DSET_SIMPLE_IO_NAME("simple_io");
-const H5std_string DSET_TCONV_NAME("tconv");
-const H5std_string DSET_COMPRESS_NAME("compressed");
-const H5std_string DSET_BOGUS_NAME("bogus");
+const H5std_string FILE1("dataset.h5");
+const H5std_string DSET_DEFAULT_NAME("default");
+const H5std_string DSET_DEFAULT_NAME_PATH("/default");
+const H5std_string DSET_CHUNKED_NAME("chunked");
+const H5std_string DSET_SIMPLE_IO_NAME("simple_io");
+const H5std_string DSET_TCONV_NAME("tconv");
+const H5std_string DSET_COMPRESS_NAME("compressed");
+const H5std_string DSET_BOGUS_NAME("bogus");
/* Temporary filter IDs used for testing */
const int H5Z_FILTER_BOGUS = 305;
-static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf);
// H5_ATTR_UNUSED variables caused warning, but taking them out caused failure.
-
/*-------------------------------------------------------------------------
* Function: test_create
*
@@ -68,7 +67,8 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
* Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
-static herr_t test_create( H5File& file)
+static herr_t
+test_create(H5File &file)
{
SUBTEST("Create, open, close");
@@ -76,19 +76,17 @@ static herr_t test_create( H5File& file)
DataSet *dataset = NULL;
try {
// Create a data space
- hsize_t dims[2];
+ hsize_t dims[2];
dims[0] = 256;
dims[1] = 512;
- DataSpace space (2, dims, NULL);
+ DataSpace space(2, dims, NULL);
// Create a dataset using the default dataset creation properties.
// We're not sure what they are, so we won't check.
- dataset = new DataSet (file.createDataSet
- (DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space));
-
+ dataset = new DataSet(file.createDataSet(DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space));
// Add a comment to the dataset
- file.setComment (DSET_DEFAULT_NAME, "This is a dataset");
+ file.setComment(DSET_DEFAULT_NAME, "This is a dataset");
// Close the dataset
delete dataset;
@@ -98,18 +96,19 @@ static herr_t test_create( H5File& file)
// dataset can only be created once. If an exception is not thrown for
// this action by createDataSet, then throw an invalid action exception.
try {
- dataset = new DataSet (file.createDataSet
- (DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space));
+ dataset = new DataSet(file.createDataSet(DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space));
// continuation here, that means no exception has been thrown
- throw InvalidActionException("H5File::createDataSet", "Library allowed overwrite of existing dataset");
+ throw InvalidActionException("H5File::createDataSet",
+ "Library allowed overwrite of existing dataset");
}
- catch (FileIException& E) // catching invalid creating dataset
- {} // do nothing, exception expected
+ catch (FileIException &E) // catching invalid creating dataset
+ {
+ } // do nothing, exception expected
// Open the dataset we created above and then close it. This is one
// way to open an existing dataset for accessing.
- dataset = new DataSet (file.openDataSet (DSET_DEFAULT_NAME));
+ dataset = new DataSet(file.openDataSet(DSET_DEFAULT_NAME));
// Get and verify the name of this dataset, using
// H5std_string getObjName()
@@ -125,30 +124,31 @@ static herr_t test_create( H5File& file)
delete dataset;
// This is another way to open an existing dataset for accessing.
- DataSet another_dataset(file.openDataSet (DSET_DEFAULT_NAME));
+ DataSet another_dataset(file.openDataSet(DSET_DEFAULT_NAME));
// Try opening a non-existent dataset. This should fail so if an
// exception is not thrown for this action by openDataSet, then
// display failure information and throw an exception.
try {
- dataset = new DataSet (file.openDataSet( "does_not_exist" ));
+ dataset = new DataSet(file.openDataSet("does_not_exist"));
// continuation here, that means no exception has been thrown
throw InvalidActionException("H5File::openDataSet", "Attempted to open a non-existent dataset");
}
- catch (FileIException& E ) // catching creating non-existent dataset
- {} // do nothing, exception expected
+ catch (FileIException &E) // catching creating non-existent dataset
+ {
+ } // do nothing, exception expected
// Create a new dataset that uses chunked storage instead of the default
// layout.
DSetCreatPropList create_parms;
- hsize_t csize[2];
+ hsize_t csize[2];
csize[0] = 5;
csize[1] = 100;
- create_parms.setChunk( 2, csize );
+ create_parms.setChunk(2, csize);
- dataset = new DataSet (file.createDataSet(DSET_CHUNKED_NAME,
- PredType::NATIVE_DOUBLE, space, create_parms));
+ dataset =
+ new DataSet(file.createDataSet(DSET_CHUNKED_NAME, PredType::NATIVE_DOUBLE, space, create_parms));
// Note: this one has no error message in C when failure occurs?
// clean up and return with success
@@ -156,10 +156,9 @@ static herr_t test_create( H5File& file)
PASSED();
return 0;
- } // outer most try block
+ } // outer most try block
- catch (InvalidActionException& E)
- {
+ catch (InvalidActionException &E) {
cerr << " FAILED" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
@@ -169,8 +168,7 @@ static herr_t test_create( H5File& file)
return -1;
}
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_create", __LINE__, __FILE__);
// clean up and return with failure
@@ -178,9 +176,8 @@ static herr_t test_create( H5File& file)
delete dataset;
return -1;
}
-} // test_create
+} // test_create
-
/*-------------------------------------------------------------------------
* Function: test_simple_io
*
@@ -196,75 +193,72 @@ static herr_t test_create( H5File& file)
* Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
-static herr_t test_simple_io( H5File& file)
+static herr_t
+test_simple_io(H5File &file)
{
SUBTEST("Simple I/O");
- int points[100][200];
- int check[100][200];
+ int points[100][200];
+ int check[100][200];
int i, j, n;
// Initialize the dataset
- for (i = n = 0; i < 100; i++)
- {
+ for (i = n = 0; i < 100; i++) {
for (j = 0; j < 200; j++) {
points[i][j] = n++;
}
}
- char* tconv_buf = new char [1000];
- try
- {
+ char *tconv_buf = new char[1000];
+ try {
// Create the data space
hsize_t dims[2];
dims[0] = 100;
dims[1] = 200;
- DataSpace space (2, dims, NULL);
+ DataSpace space(2, dims, NULL);
// Create a small conversion buffer to test strip mining
DSetMemXferPropList xfer;
- xfer.setBuffer (1000, tconv_buf, NULL);
+ xfer.setBuffer(1000, tconv_buf, NULL);
// Create the dataset
- DataSet dataset (file.createDataSet (DSET_SIMPLE_IO_NAME, PredType::NATIVE_INT, space));
+ DataSet dataset(file.createDataSet(DSET_SIMPLE_IO_NAME, PredType::NATIVE_INT, space));
// Write the data to the dataset
- dataset.write(static_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset.write(static_cast<void *>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL,
+ xfer);
// Read the dataset back
- dataset.read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset.read(static_cast<void *>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
// Check that the values read are the same as the values written
for (i = 0; i < 100; i++)
- for (j = 0; j < 200; j++)
- {
- int status = check_values (i, j, points[i][j], check[i][j]);
+ for (j = 0; j < 200; j++) {
+ int status = check_values(i, j, points[i][j], check[i][j]);
if (status == -1)
throw Exception("DataSet::read");
}
// clean up and return with success
- delete [] tconv_buf;
+ delete[] tconv_buf;
PASSED();
return 0;
- } // end try
+ } // end try
// catch all dataset, space, plist exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " FAILED" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
// clean up and return with failure
if (tconv_buf)
- delete [] tconv_buf;
+ delete[] tconv_buf;
return -1;
}
-} // test_simple_io
+} // test_simple_io
-
/*-------------------------------------------------------------------------
* Function: test_datasize
*
@@ -278,25 +272,24 @@ static herr_t test_simple_io( H5File& file)
* Thursday, March 22, 2012
*-------------------------------------------------------------------------
*/
-static herr_t test_datasize(FileAccPropList &fapl)
+static herr_t
+test_datasize(FileAccPropList &fapl)
{
SUBTEST("DataSet::getInMemDataSize()");
- try
- {
+ try {
// Open FILE1.
H5File file(FILE1, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl);
// Open dataset DSET_SIMPLE_IO_NAME.
- DataSet dset = file.openDataSet (DSET_SIMPLE_IO_NAME);
+ DataSet dset = file.openDataSet(DSET_SIMPLE_IO_NAME);
// Get the dataset's dataspace to calculate the size for verification.
DataSpace space(dset.getSpace());
// Get the dimension sizes.
hsize_t dims[2];
- int n_dims = space.getSimpleExtentDims(dims);
- if (n_dims < 0)
- {
+ int n_dims = space.getSimpleExtentDims(dims);
+ if (n_dims < 0) {
throw Exception("test_compression", "DataSpace::getSimpleExtentDims() failed");
}
@@ -308,8 +301,7 @@ static herr_t test_datasize(FileAccPropList &fapl)
size_t ds_size = dset.getInMemDataSize();
// Verify the data size.
- if (ds_size != expected_size)
- {
+ if (ds_size != expected_size) {
H5_FAILED();
cerr << " Expected data size = " << expected_size;
cerr << " but dset.getInMemDataSize() returned " << ds_size << endl;
@@ -318,19 +310,17 @@ static herr_t test_datasize(FileAccPropList &fapl)
PASSED();
return 0;
- } // end try
+ } // end try
// catch all dataset, space, plist exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " FAILED" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
return -1;
}
-} // test_datasize
+} // test_datasize
-
/*-------------------------------------------------------------------------
* Function: test_tconv
*
@@ -344,84 +334,79 @@ static herr_t test_datasize(FileAccPropList &fapl)
* Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
-static herr_t test_tconv(H5File& file)
+static herr_t
+test_tconv(H5File &file)
{
// Prepare buffers for input/output
- char *out=NULL, *in=NULL;
- out = new char [4*1000000];
+ char *out = NULL, *in = NULL;
+ out = new char[4 * 1000000];
// assert (out); - should use exception handler for new - BMR
- in = new char [4*1000000];
- //assert (in);
+ in = new char[4 * 1000000];
+ // assert (in);
SUBTEST("Data type conversion");
// Initialize the dataset
for (int i = 0; i < 1000000; i++) {
- out[i*4+0] = 0x11;
- out[i*4+1] = 0x22;
- out[i*4+2] = 0x33;
- out[i*4+3] = 0x44;
+ out[i * 4 + 0] = 0x11;
+ out[i * 4 + 1] = 0x22;
+ out[i * 4 + 2] = 0x33;
+ out[i * 4 + 3] = 0x44;
}
- try
- {
+ try {
// Create the data space
hsize_t dims[1];
dims[0] = 1000000;
- DataSpace space (1, dims, NULL);
+ DataSpace space(1, dims, NULL);
// Create the data set
- DataSet dataset (file.createDataSet (DSET_TCONV_NAME, PredType::STD_I32LE, space));
+ DataSet dataset(file.createDataSet(DSET_TCONV_NAME, PredType::STD_I32LE, space));
// Write the data to the dataset
- dataset.write (static_cast<void*>(out), PredType::STD_I32LE);
+ dataset.write(static_cast<void *>(out), PredType::STD_I32LE);
// Read data with byte order conversion
- dataset.read (static_cast<void*>(in), PredType::STD_I32BE);
+ dataset.read(static_cast<void *>(in), PredType::STD_I32BE);
// Check
for (int i = 0; i < 1000000; i++) {
- if (in[4*i+0]!=out[4*i+3] ||
- in[4*i+1]!=out[4*i+2] ||
- in[4*i+2]!=out[4*i+1] ||
- in[4*i+3]!=out[4*i+0])
- {
+ if (in[4 * i + 0] != out[4 * i + 3] || in[4 * i + 1] != out[4 * i + 2] ||
+ in[4 * i + 2] != out[4 * i + 1] || in[4 * i + 3] != out[4 * i + 0]) {
throw Exception("DataSet::read", "Read with byte order conversion failed");
}
}
// clean up and return with success
- delete [] out;
- delete [] in;
+ delete[] out;
+ delete[] in;
PASSED();
return 0;
- } // end try
+ } // end try
// catch all dataset and space exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " FAILED" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
// clean up and return with failure
- delete [] out;
- delete [] in;
+ delete[] out;
+ delete[] in;
return -1;
}
-} // test_tconv
+} // test_tconv
/* This message derives from H5Z */
const H5Z_class2_t H5Z_BOGUS[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version number */
- H5Z_FILTER_BOGUS, /* Filter id number */
- 1, 1, /* Encode and decode enabled */
- "bogus", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)filter_bogus, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version number */
+ H5Z_FILTER_BOGUS, /* Filter id number */
+ 1, 1, /* Encode and decode enabled */
+ "bogus", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ (H5Z_func_t)filter_bogus, /* The actual filter function */
}};
-
/*-------------------------------------------------------------------------
* Function: bogus
*
@@ -435,15 +420,14 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{
* Tuesday, April 21, 1998
*-------------------------------------------------------------------------
*/
-static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
- const unsigned int cd_values[], size_t nbytes,
- size_t *buf_size, void **buf)
+static size_t
+filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[], size_t nbytes,
+ size_t *buf_size, void **buf)
// H5_ATTR_UNUSED variables caused warning, but taking them out caused failure.
{
return nbytes;
}
-
/*-------------------------------------------------------------------------
* Function: test_compression
*
@@ -460,28 +444,27 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
* Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
-static herr_t test_compression(H5File& file)
+static herr_t
+test_compression(H5File &file)
{
#ifndef H5_HAVE_FILTER_DEFLATE
const char *not_supported;
not_supported = " Deflate compression is not enabled.";
#endif /* H5_HAVE_FILTER_DEFLATE */
- int points[100][200];
- int check[100][200];
- hsize_t i, j, n;
+ int points[100][200];
+ int check[100][200];
+ hsize_t i, j, n;
// Initialize the dataset
- for (i = n = 0; i < 100; i++)
- {
+ for (i = n = 0; i < 100; i++) {
for (j = 0; j < 200; j++) {
points[i][j] = static_cast<int>(n++);
}
}
- char* tconv_buf = new char [1000];
- DataSet* dataset = NULL;
- try
- {
+ char * tconv_buf = new char[1000];
+ DataSet *dataset = NULL;
+ try {
const hsize_t size[2] = {100, 200};
// Create the data space
DataSpace space1(2, size, NULL);
@@ -489,39 +472,39 @@ static herr_t test_compression(H5File& file)
// Create a small conversion buffer to test strip mining
DSetMemXferPropList xfer;
- xfer.setBuffer (1000, tconv_buf, NULL);
+ xfer.setBuffer(1000, tconv_buf, NULL);
// Use chunked storage with compression
DSetCreatPropList dscreatplist;
const hsize_t chunk_size[2] = {2, 25};
- dscreatplist.setChunk (2, chunk_size);
- dscreatplist.setDeflate (6);
+ dscreatplist.setChunk(2, chunk_size);
+ dscreatplist.setDeflate(6);
#ifdef H5_HAVE_FILTER_DEFLATE
SUBTEST("Compression (setup)");
// Create the dataset
- dataset = new DataSet (file.createDataSet
- (DSET_COMPRESS_NAME, PredType::NATIVE_INT, space1, dscreatplist));
+ dataset =
+ new DataSet(file.createDataSet(DSET_COMPRESS_NAME, PredType::NATIVE_INT, space1, dscreatplist));
PASSED();
/*----------------------------------------------------------------------
- * STEP 1: Read uninitialized data. It should be zero.
- *----------------------------------------------------------------------
- */
+ * STEP 1: Read uninitialized data. It should be zero.
+ *----------------------------------------------------------------------
+ */
SUBTEST("Compression (uninitialized read)");
- dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset->read(static_cast<void *>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
- for (i=0; i<size[0]; i++) {
- for (j=0; j<size[1]; j++) {
- if (0!=check[i][j]) {
+ for (i = 0; i < size[0]; i++) {
+ for (j = 0; j < size[1]; j++) {
+ if (0 != check[i][j]) {
H5_FAILED();
cerr << " Read a non-zero value." << endl;
- cerr << " At index " << static_cast<unsigned long>(i)
- << "," << static_cast<unsigned long>(j) << endl;
+ cerr << " At index " << static_cast<unsigned long>(i) << ","
+ << static_cast<unsigned long>(j) << endl;
throw Exception("test_compression", "Failed in uninitialized read");
}
}
@@ -529,38 +512,36 @@ static herr_t test_compression(H5File& file)
PASSED();
/*----------------------------------------------------------------------
- * STEP 2: Test compression by setting up a chunked dataset and writing
- * to it.
- *----------------------------------------------------------------------
- */
+ * STEP 2: Test compression by setting up a chunked dataset and writing
+ * to it.
+ *----------------------------------------------------------------------
+ */
SUBTEST("Compression (write)");
- for (i=n=0; i<size[0]; i++)
- {
- for (j=0; j<size[1]; j++)
- {
+ for (i = n = 0; i < size[0]; i++) {
+ for (j = 0; j < size[1]; j++) {
points[i][j] = static_cast<int>(n++);
}
}
- dataset->write (static_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset->write(static_cast<void *>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL,
+ xfer);
PASSED();
/*----------------------------------------------------------------------
- * STEP 3: Try to read the data we just wrote.
- *----------------------------------------------------------------------
- */
+ * STEP 3: Try to read the data we just wrote.
+ *----------------------------------------------------------------------
+ */
SUBTEST("Compression (read)");
// Read the dataset back
- dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset->read(static_cast<void *>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
// Check that the values read are the same as the values written
for (i = 0; i < size[0]; i++)
- for (j = 0; j < size[1]; j++)
- {
- int status = check_values (i, j, points[i][j], check[i][j]);
+ for (j = 0; j < size[1]; j++) {
+ int status = check_values(i, j, points[i][j], check[i][j]);
if (status == -1)
throw Exception("test_compression", "Failed in read");
}
@@ -568,31 +549,29 @@ static herr_t test_compression(H5File& file)
PASSED();
/*----------------------------------------------------------------------
- * STEP 4: Write new data over the top of the old data. The new data is
- * random thus not very compressible, and will cause the chunks to move
- * around as they grow. We only change values for the left half of the
- * dataset although we rewrite the whole thing.
- *----------------------------------------------------------------------
- */
+ * STEP 4: Write new data over the top of the old data. The new data is
+ * random thus not very compressible, and will cause the chunks to move
+ * around as they grow. We only change values for the left half of the
+ * dataset although we rewrite the whole thing.
+ *----------------------------------------------------------------------
+ */
SUBTEST("Compression (modify)");
- for (i=0; i<size[0]; i++)
- {
- for (j=0; j<size[1]/2; j++)
- {
- points[i][j] = rand ();
+ for (i = 0; i < size[0]; i++) {
+ for (j = 0; j < size[1] / 2; j++) {
+ points[i][j] = rand();
}
}
- dataset->write (static_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset->write(static_cast<void *>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL,
+ xfer);
// Read the dataset back and check it
- dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset->read(static_cast<void *>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
// Check that the values read are the same as the values written
for (i = 0; i < size[0]; i++)
- for (j = 0; j < size[1]; j++)
- {
- int status = check_values (i, j, points[i][j], check[i][j]);
+ for (j = 0; j < size[1]; j++) {
+ int status = check_values(i, j, points[i][j], check[i][j]);
if (status == -1)
throw Exception("test_compression", "Failed in modify");
}
@@ -600,66 +579,65 @@ static herr_t test_compression(H5File& file)
PASSED();
/*----------------------------------------------------------------------
- * STEP 5: Close the dataset and then open it and read it again. This
- * insures that the compression message is picked up properly from the
- * object header.
- *----------------------------------------------------------------------
- */
+ * STEP 5: Close the dataset and then open it and read it again. This
+ * insures that the compression message is picked up properly from the
+ * object header.
+ *----------------------------------------------------------------------
+ */
SUBTEST("Compression (re-open)");
// close this dataset to reuse the var
delete dataset;
- dataset = new DataSet (file.openDataSet (DSET_COMPRESS_NAME));
- dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset = new DataSet(file.openDataSet(DSET_COMPRESS_NAME));
+ dataset->read(static_cast<void *>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
// Check that the values read are the same as the values written
for (i = 0; i < size[0]; i++)
- for (j = 0; j < size[1]; j++)
- {
- int status = check_values (i, j, points[i][j], check[i][j]);
+ for (j = 0; j < size[1]; j++) {
+ int status = check_values(i, j, points[i][j], check[i][j]);
if (status == -1)
throw Exception("test_compression", "Failed in re-open");
}
PASSED();
-
/*----------------------------------------------------------------------
- * STEP 6: Test partial I/O by writing to and then reading from a
- * hyperslab of the dataset. The hyperslab does not line up on chunk
- * boundaries (we know that case already works from above tests).
- *----------------------------------------------------------------------
- */
+ * STEP 6: Test partial I/O by writing to and then reading from a
+ * hyperslab of the dataset. The hyperslab does not line up on chunk
+ * boundaries (we know that case already works from above tests).
+ *----------------------------------------------------------------------
+ */
SUBTEST("Compression (partial I/O)");
- const hsize_t hs_size[2] = {4, 50};
+ const hsize_t hs_size[2] = {4, 50};
const hsize_t hs_offset[2] = {7, 30};
for (i = 0; i < hs_size[0]; i++) {
for (j = 0; j < hs_size[1]; j++) {
- points[hs_offset[0]+i][hs_offset[1]+j] = rand ();
+ points[hs_offset[0] + i][hs_offset[1] + j] = rand();
}
}
- space1.selectHyperslab( H5S_SELECT_SET, hs_size, hs_offset );
- dataset->write (static_cast<void*>(points), PredType::NATIVE_INT, space1, space1, xfer);
- dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, space1, space1, xfer);
+ space1.selectHyperslab(H5S_SELECT_SET, hs_size, hs_offset);
+ dataset->write(static_cast<void *>(points), PredType::NATIVE_INT, space1, space1, xfer);
+ dataset->read(static_cast<void *>(check), PredType::NATIVE_INT, space1, space1, xfer);
// Check that the values read are the same as the values written
- for (i=0; i<hs_size[0]; i++) {
- for (j=0; j<hs_size[1]; j++) {
- if (points[hs_offset[0]+i][hs_offset[1]+j] !=
- check[hs_offset[0]+i][hs_offset[1]+j]) {
- H5_FAILED();
- cerr << " Read different values than written.\n" << endl;
- cerr << " At index " << static_cast<unsigned long>((hs_offset[0]+i)) <<
- "," << static_cast<unsigned long>((hs_offset[1]+j)) << endl;
-
- cerr << " At original: " << static_cast<int>(points[hs_offset[0]+i][hs_offset[1]+j]) << endl;
- cerr << " At returned: " << static_cast<int>(check[hs_offset[0]+i][hs_offset[1]+j]) << endl;
- throw Exception("test_compression", "Failed in partial I/O");
- }
- } // for j
- } // for i
+ for (i = 0; i < hs_size[0]; i++) {
+ for (j = 0; j < hs_size[1]; j++) {
+ if (points[hs_offset[0] + i][hs_offset[1] + j] != check[hs_offset[0] + i][hs_offset[1] + j]) {
+ H5_FAILED();
+ cerr << " Read different values than written.\n" << endl;
+ cerr << " At index " << static_cast<unsigned long>((hs_offset[0] + i)) << ","
+ << static_cast<unsigned long>((hs_offset[1] + j)) << endl;
+
+ cerr << " At original: "
+ << static_cast<int>(points[hs_offset[0] + i][hs_offset[1] + j]) << endl;
+ cerr << " At returned: " << static_cast<int>(check[hs_offset[0] + i][hs_offset[1] + j])
+ << endl;
+ throw Exception("test_compression", "Failed in partial I/O");
+ }
+ } // for j
+ } // for i
delete dataset;
dataset = NULL;
@@ -673,29 +651,30 @@ static herr_t test_compression(H5File& file)
#endif
/*----------------------------------------------------------------------
- * STEP 7: Register an application-defined compression method and use it
- * to write and then read the dataset.
- *----------------------------------------------------------------------
- */
+ * STEP 7: Register an application-defined compression method and use it
+ * to write and then read the dataset.
+ *----------------------------------------------------------------------
+ */
SUBTEST("Compression (app-defined method)");
- if (H5Zregister (H5Z_BOGUS)<0)
- throw Exception("test_compression", "Failed in app-defined method");
- if (H5Pset_filter (dscreatplist.getId(), H5Z_FILTER_BOGUS, 0, 0, NULL)<0)
+ if (H5Zregister(H5Z_BOGUS) < 0)
+ throw Exception("test_compression", "Failed in app-defined method");
+ if (H5Pset_filter(dscreatplist.getId(), H5Z_FILTER_BOGUS, 0, 0, NULL) < 0)
throw Exception("test_compression", "Failed in app-defined method");
- dscreatplist.setFilter (H5Z_FILTER_BOGUS, 0, 0, NULL);
+ dscreatplist.setFilter(H5Z_FILTER_BOGUS, 0, 0, NULL);
- DataSpace space2 (2, size, NULL);
- dataset = new DataSet (file.createDataSet (DSET_BOGUS_NAME, PredType::NATIVE_INT, space2, dscreatplist));
+ DataSpace space2(2, size, NULL);
+ dataset =
+ new DataSet(file.createDataSet(DSET_BOGUS_NAME, PredType::NATIVE_INT, space2, dscreatplist));
- dataset->write (static_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
- dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset->write(static_cast<void *>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL,
+ xfer);
+ dataset->read(static_cast<void *>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
// Check that the values read are the same as the values written
for (i = 0; i < size[0]; i++)
- for (j = 0; j < size[1]; j++)
- {
- int status = check_values (i, j, points[i][j], check[i][j]);
+ for (j = 0; j < size[1]; j++) {
+ int status = check_values(i, j, points[i][j], check[i][j]);
if (status == -1)
throw Exception("test_compression", "Failed in app-defined method");
}
@@ -703,17 +682,16 @@ static herr_t test_compression(H5File& file)
PASSED();
/*----------------------------------------------------------------------
- * Cleanup
- *----------------------------------------------------------------------
- */
+ * Cleanup
+ *----------------------------------------------------------------------
+ */
delete dataset;
- delete [] tconv_buf;
+ delete[] tconv_buf;
return 0;
} // end try
// catch all dataset, file, space, and plist exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " FAILED" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
@@ -721,12 +699,11 @@ static herr_t test_compression(H5File& file)
if (dataset != NULL)
delete dataset;
if (tconv_buf)
- delete [] tconv_buf;
+ delete[] tconv_buf;
return -1;
}
-} // test_compression
+} // test_compression
-
/*-------------------------------------------------------------------------
* Function: test_nbit_methods
*
@@ -742,18 +719,19 @@ static herr_t test_compression(H5File& file)
*-------------------------------------------------------------------------
*/
const H5std_string DSET_NBIT_NAME("nbit_dataset");
-const hsize_t DIM1 = 2;
-const hsize_t DIM2 = 5;
+const hsize_t DIM1 = 2;
+const hsize_t DIM2 = 5;
-static herr_t test_nbit_compression(H5File& file)
+static herr_t
+test_nbit_compression(H5File &file)
{
typedef struct {
- int i;
- char c;
+ int i;
+ char c;
short s;
} s1_t;
- const hsize_t size[2] = {DIM1, DIM2};
+ const hsize_t size[2] = {DIM1, DIM2};
const hsize_t chunk_size[2] = {DIM1, DIM2};
s1_t orig_data[DIM1][DIM2];
s1_t new_data[DIM1][DIM2];
@@ -761,8 +739,7 @@ static herr_t test_nbit_compression(H5File& file)
SUBTEST("N-bit compression (setup)");
- try
- {
+ try {
// Define datatypes of members of compound datatype
IntType i_type(PredType::NATIVE_INT);
IntType c_type(PredType::NATIVE_CHAR);
@@ -781,7 +758,7 @@ static herr_t test_nbit_compression(H5File& file)
mem_cmpd.insertMember("s", HOFFSET(s1_t, s), s_type);
// Set order of dataset compound datatype
- //cmpd.setOrder(H5T_ORDER_BE); only for atomic type?
+ // cmpd.setOrder(H5T_ORDER_BE); only for atomic type?
// Create the data space
DataSpace space(2, size);
@@ -796,36 +773,33 @@ static herr_t test_nbit_compression(H5File& file)
// Initialize data, assuming size of long long >= size of member datatypes
for (i = 0; i < size[0]; i++)
- for (j = 0; j < size[1]; j++)
- {
+ for (j = 0; j < size[1]; j++) {
orig_data[i][j].i = static_cast<int>(i * j);
orig_data[i][j].c = static_cast<char>('a' + i);
orig_data[i][j].s = static_cast<short>(i + j);
// Some even-numbered integer values are negative
- if ((i*size[1]+j+1)%2 == 0) {
+ if ((i * size[1] + j + 1) % 2 == 0) {
orig_data[i][j].i = -orig_data[i][j].i;
orig_data[i][j].s = static_cast<short>(-orig_data[i][j].s);
}
}
// Write to the dataset
- dataset.write(static_cast<void*>(orig_data), mem_cmpd);
+ dataset.write(static_cast<void *>(orig_data), mem_cmpd);
// Read the dataset back */
- dataset.read(static_cast<void*>(new_data), mem_cmpd);
+ dataset.read(static_cast<void *>(new_data), mem_cmpd);
// Check that the values read are the same as the values written.
for (i = 0; i < size[0]; i++)
- for (j = 0; j < size[1]; j++)
- {
- if((new_data[i][j].i != orig_data[i][j].i) ||
- (new_data[i][j].c != orig_data[i][j].c) ||
- (new_data[i][j].s != orig_data[i][j].s))
- {
+ for (j = 0; j < size[1]; j++) {
+ if ((new_data[i][j].i != orig_data[i][j].i) || (new_data[i][j].c != orig_data[i][j].c) ||
+ (new_data[i][j].s != orig_data[i][j].s)) {
H5_FAILED();
printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", static_cast<unsigned long>(i), static_cast<unsigned long>(j));
+ printf(" At index %lu,%lu\n", static_cast<unsigned long>(i),
+ static_cast<unsigned long>(j));
}
}
@@ -834,8 +808,7 @@ static herr_t test_nbit_compression(H5File& file)
} // end try block
// catch all dataset, file, space, and plist exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " FAILED" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
@@ -843,7 +816,6 @@ static herr_t test_nbit_compression(H5File& file)
}
} // test_nbit_compression
-
/*-------------------------------------------------------------------------
* Function: test_multiopen
*
@@ -860,12 +832,13 @@ static herr_t test_nbit_compression(H5File& file)
* Saturday, February 17, 2001
*-------------------------------------------------------------------------
*/
-static herr_t test_multiopen (H5File& file)
+static herr_t
+test_multiopen(H5File &file)
{
SUBTEST("Multi-open with extending");
- DataSpace* space = NULL;
+ DataSpace *space = NULL;
try {
// Create a dataset creation property list
@@ -873,17 +846,17 @@ static herr_t test_multiopen (H5File& file)
// Set chunk size to given size
hsize_t cur_size[1] = {10};
- dcpl.setChunk (1, cur_size);
+ dcpl.setChunk(1, cur_size);
// Create a simple data space with unlimited size
hsize_t max_size[1] = {H5S_UNLIMITED};
- space = new DataSpace (1, cur_size, max_size);
+ space = new DataSpace(1, cur_size, max_size);
// Create first dataset
- DataSet dset1 = file.createDataSet ("multiopen", PredType::NATIVE_INT, *space, dcpl);
+ DataSet dset1 = file.createDataSet("multiopen", PredType::NATIVE_INT, *space, dcpl);
// Open again the first dataset from the file to another DataSet object.
- DataSet dset2 = file.openDataSet ("multiopen");
+ DataSet dset2 = file.openDataSet("multiopen");
// Relieve the dataspace
delete space;
@@ -891,18 +864,16 @@ static herr_t test_multiopen (H5File& file)
// Extend the dimensionality of the first dataset
cur_size[0] = 20;
- dset1.extend (cur_size);
+ dset1.extend(cur_size);
// Get the size from the second handle
- space = new DataSpace (dset2.getSpace());
+ space = new DataSpace(dset2.getSpace());
hsize_t tmp_size[1];
- space->getSimpleExtentDims (tmp_size);
- if (cur_size[0]!=tmp_size[0])
- {
- cerr << " Got " << static_cast<int>(tmp_size[0])
- << " instead of " << static_cast<int>(cur_size[0])
- << "!" << endl;
+ space->getSimpleExtentDims(tmp_size);
+ if (cur_size[0] != tmp_size[0]) {
+ cerr << " Got " << static_cast<int>(tmp_size[0]) << " instead of "
+ << static_cast<int>(cur_size[0]) << "!" << endl;
throw Exception("test_multiopen", "Failed in multi-open with extending");
}
@@ -913,8 +884,7 @@ static herr_t test_multiopen (H5File& file)
} // end try block
// catch all dataset, file, space, and plist exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " FAILED" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
@@ -923,9 +893,8 @@ static herr_t test_multiopen (H5File& file)
delete space;
return -1;
}
-} // test_multiopen
+} // test_multiopen
-
/*-------------------------------------------------------------------------
* Function: test_types
*
@@ -939,24 +908,25 @@ static herr_t test_multiopen (H5File& file)
* February 17, 2001
*-------------------------------------------------------------------------
*/
-static herr_t test_types(H5File& file)
+static herr_t
+test_types(H5File &file)
{
SUBTEST("Various datatypes");
- size_t i;
- DataSet* dset = NULL;
+ size_t i;
+ DataSet *dset = NULL;
try {
// Create a group in the file that was passed in from the caller
- Group grp = file.createGroup ("typetests");
+ Group grp = file.createGroup("typetests");
/* bitfield_1 */
unsigned char buf[32];
- hsize_t nelmts = sizeof(buf);
- DataType type;
+ hsize_t nelmts = sizeof(buf);
+ DataType type;
try { // block of bitfield_1
// test copying a predefined type
- type.copy (PredType::STD_B8LE);
+ type.copy(PredType::STD_B8LE);
// Test copying a user-defined type using DataType::copy
DataType copied_type;
@@ -967,7 +937,7 @@ static herr_t test_types(H5File& file)
another_copied_type = type;
// Test copying a user-defined int type using DataType::operator=
- IntType orig_int(PredType::STD_B8LE);
+ IntType orig_int(PredType::STD_B8LE);
DataType generic_type;
generic_type = orig_int;
@@ -978,45 +948,45 @@ static herr_t test_types(H5File& file)
IntType another_int_type;
another_int_type = new_int_type;
- DataSpace space (1, &nelmts);
+ DataSpace space(1, &nelmts);
dset = new DataSet(grp.createDataSet("bitfield_1", type, space));
// Fill buffer
- for (i=0; i<sizeof buf; i++)
- buf[i] = static_cast<unsigned char>(0xff) ^ static_cast<unsigned char>(i);
+ for (i = 0; i < sizeof buf; i++)
+ buf[i] = static_cast<unsigned char>(0xff) ^ static_cast<unsigned char>(i);
// Write data from buf using all default dataspaces and property list
- dset->write (buf, type);
+ dset->write(buf, type);
// no failure in bitfield_1, close this dataset
delete dset;
} // end try block of bitfield_1
// catch exceptions thrown in try block of bitfield_1
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " FAILED" << endl;
- cerr << " <<< " << "bitfield_1: " << E.getFuncName()
- << " - " << E.getDetailMsg() << " >>>" << endl << endl;
+ cerr << " <<< "
+ << "bitfield_1: " << E.getFuncName() << " - " << E.getDetailMsg() << " >>>" << endl
+ << endl;
if (dset != NULL)
delete dset;
return -1;
}
/* bitfield_2 */
- nelmts = sizeof(buf)/2;
+ nelmts = sizeof(buf) / 2;
try { // bitfield_2 block
- type.copy (PredType::STD_B16LE);
- DataSpace space (1, &nelmts);
+ type.copy(PredType::STD_B16LE);
+ DataSpace space(1, &nelmts);
dset = new DataSet(grp.createDataSet("bitfield_2", type, space));
// Fill buffer
- for (i=0; i<sizeof(buf); i++)
+ for (i = 0; i < sizeof(buf); i++)
buf[i] = static_cast<unsigned char>(0xff) ^ static_cast<unsigned char>(i);
// Write data from buf using all default dataspaces and property
// list; if writing fails, deallocate dset and return.
- dset->write (buf, type);
+ dset->write(buf, type);
// no failure in bitfield_2, close this dataset and reset for
// variable reuse
@@ -1025,44 +995,46 @@ static herr_t test_types(H5File& file)
} // end try block of bitfield_2
// catch exceptions thrown in try block of bitfield_2
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " FAILED" << endl;
- cerr << " <<< " << "bitfield_2: " << E.getFuncName()
- << " - " << E.getDetailMsg() << " >>>" << endl << endl;
+ cerr << " <<< "
+ << "bitfield_2: " << E.getFuncName() << " - " << E.getDetailMsg() << " >>>" << endl
+ << endl;
if (dset != NULL)
delete dset;
throw E; // propagate the exception
}
/* opaque_1 */
- DataType* optype = NULL;
+ DataType *optype = NULL;
try { // opaque_1 block
optype = new DataType(H5T_OPAQUE, 1);
nelmts = sizeof(buf);
- DataSpace space (1, &nelmts);
- optype->setTag ("testing 1-byte opaque type");
+ DataSpace space(1, &nelmts);
+ optype->setTag("testing 1-byte opaque type");
dset = new DataSet(grp.createDataSet("opaque_1", *optype, space));
// Fill buffer
- for (i=0; i<sizeof buf; i++)
+ for (i = 0; i < sizeof buf; i++)
buf[i] = static_cast<unsigned char>(0xff) ^ static_cast<unsigned char>(i);
// Write data from buf using all default dataspaces and property
// list; if writing fails, deallocate dset and return.
- dset->write (buf, *optype);
+ dset->write(buf, *optype);
// no failure in opaque_1
- delete dset; dset = NULL;
- delete optype; optype = NULL;
+ delete dset;
+ dset = NULL;
+ delete optype;
+ optype = NULL;
} // end try block of opaque_1
// catch exceptions thrown in try block of opaque_1
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " FAILED" << endl;
- cerr << " <<< " << "opaque_1: " << E.getFuncName()
- << " - " << E.getDetailMsg() << " >>>" << endl << endl;
+ cerr << " <<< "
+ << "opaque_1: " << E.getFuncName() << " - " << E.getDetailMsg() << " >>>" << endl
+ << endl;
if (dset != NULL)
delete dset;
if (optype != NULL)
@@ -1072,31 +1044,33 @@ static herr_t test_types(H5File& file)
/* opaque_2 */
try { // block opaque_2
- nelmts = sizeof(buf)/4;
- DataSpace space (1, &nelmts);
+ nelmts = sizeof(buf) / 4;
+ DataSpace space(1, &nelmts);
optype = new DataType(H5T_OPAQUE, 4);
- optype->setTag ("testing 4-byte opaque type");
+ optype->setTag("testing 4-byte opaque type");
dset = new DataSet(grp.createDataSet("opaque_2", *optype, space));
// Fill buffer
- for (i=0; i<sizeof(buf); i++)
+ for (i = 0; i < sizeof(buf); i++)
buf[i] = static_cast<unsigned char>(0xff) ^ static_cast<unsigned char>(i);
// Write data from buf using all default dataspaces and property
// list; if writing fails, deallocate dset and return.
- dset->write (buf, *optype);
+ dset->write(buf, *optype);
// no failure in opaque_1
- delete dset; dset = NULL;
- delete optype; optype = NULL;
- } //end try block of opaque_2
+ delete dset;
+ dset = NULL;
+ delete optype;
+ optype = NULL;
+ } // end try block of opaque_2
// catch exceptions thrown in try block of opaque_2
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " FAILED" << endl;
- cerr << " <<< " << "opaque_2: " << E.getFuncName()
- << " - " << E.getDetailMsg() << " >>>" << endl << endl;
+ cerr << " <<< "
+ << "opaque_2: " << E.getFuncName() << " - " << E.getDetailMsg() << " >>>" << endl
+ << endl;
if (dset != NULL)
delete dset;
if (optype != NULL)
@@ -1108,13 +1082,11 @@ static herr_t test_types(H5File& file)
return 0;
} // end top try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
return -1;
}
-} // test_types
+} // test_types
-
/*-------------------------------------------------------------------------
* Function: test_getNativeObjinfo
*
@@ -1126,16 +1098,17 @@ static herr_t test_types(H5File& file)
* July, 2018
*-------------------------------------------------------------------------
*/
-static herr_t test_getnativeinfo(H5File& file)
+static herr_t
+test_getnativeinfo(H5File &file)
{
SUBTEST("Getting object information");
try {
// Create a data space
- hsize_t dims[2];
+ hsize_t dims[2];
dims[0] = 256;
dims[1] = 512;
- DataSpace space (2, dims, NULL);
+ DataSpace space(2, dims, NULL);
// Create a dataset using the default dataset creation properties.
// We're not sure what they are, so we won't check.
@@ -1158,23 +1131,20 @@ static herr_t test_getnativeinfo(H5File& file)
PASSED();
return 0;
- } // outer most try block
+ } // outer most try block
- catch (InvalidActionException& E)
- {
+ catch (InvalidActionException &E) {
cerr << " FAILED" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
return -1;
}
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_getnativeinfo", __LINE__, __FILE__);
return -1;
}
-} // test_getnativeinfo
+} // test_getnativeinfo
-
/*-------------------------------------------------------------------------
* Function: test_chunk_cache
*
@@ -1187,10 +1157,11 @@ static herr_t test_getnativeinfo(H5File& file)
* July 2018
*-------------------------------------------------------------------------
*/
-const int RANK1 = 1;
+const int RANK1 = 1;
const H5std_string FILE_ACCPLIST("test_accplist.h5");
-static herr_t test_chunk_cache(FileAccPropList fapl)
+static herr_t
+test_chunk_cache(FileAccPropList fapl)
{
SUBTEST("DSetAccPropList::set/getChunkCache");
@@ -1200,14 +1171,14 @@ static herr_t test_chunk_cache(FileAccPropList fapl)
DSetAccPropList dapl;
// Verify that chunk cache parameters are the same
- int mdc_nelmts = 0;
+ int mdc_nelmts = 0;
size_t nslots_1 = 0, nslots_4 = 0, nbytes_1 = 0, nbytes_4 = 0;
double w0_1 = 0.0F, w0_4 = 0.0F;
fapl_def.getCache(mdc_nelmts, nslots_1, nbytes_1, w0_1);
dapl.getChunkCache(nslots_4, nbytes_4, w0_4);
- verify_val(nslots_1, nslots_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__);
- verify_val(nbytes_1, nbytes_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__);
- verify_val(w0_1, w0_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__);
+ verify_val(nslots_1, nslots_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__);
+ verify_val(nbytes_1, nbytes_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__);
+ verify_val(w0_1, w0_4, "DSetAccPropList::getChunkCache", __LINE__, __FILE__);
// Set a link access property on dapl to verify property list inheritance
dapl.setNumLinks((size_t)134);
@@ -1220,7 +1191,7 @@ static herr_t test_chunk_cache(FileAccPropList fapl)
// Set new rdcc settings on fapl local
size_t nslots_2 = nslots_1 * 2;
size_t nbytes_2 = nbytes_1 * 2;
- double w0_2 = w0_1 / (double)2.0F;
+ double w0_2 = w0_1 / (double)2.0F;
fapl_local.getCache(mdc_nelmts, nslots_2, nbytes_2, w0_2);
// Create a new file using default fcpl and the passed-in fapl
@@ -1247,17 +1218,16 @@ static herr_t test_chunk_cache(FileAccPropList fapl)
// Retrieve and verify the raw data chunk cache parameters
nslots_4 = nbytes_4 = 0;
- w0_4 = 0.0F;
+ w0_4 = 0.0F;
dapl2.getChunkCache(nslots_4, nbytes_4, w0_4);
verify_val(nslots_2, nslots_4, "DSetCreatPropList::getChunkCache", __LINE__, __FILE__);
verify_val(nbytes_2, nbytes_4, "DSetCreatPropList::getChunkCache", __LINE__, __FILE__);
verify_val(H5_DBL_ABS_EQUAL(w0_2, w0_4), 1, "DSetCreatPropList::getChunkCache", __LINE__, __FILE__);
-
// Set new values on original dapl
size_t nslots_3 = nslots_1 * 2;
size_t nbytes_3 = H5D_CHUNK_CACHE_NBYTES_DEFAULT;
- double w0_3 = w0_2 / 2;
+ double w0_3 = w0_2 / 2;
dapl.getChunkCache(nslots_3, nbytes_3, w0_3);
// Close dataset
@@ -1275,18 +1245,15 @@ static herr_t test_chunk_cache(FileAccPropList fapl)
verify_val(nbytes_3, nbytes_4, "DSetCreatPropList::getLayout", __LINE__, __FILE__);
verify_val(H5_DBL_ABS_EQUAL(w0_3, w0_4), 1, "DSetCreatPropList::getLayout", __LINE__, __FILE__);
-
PASSED();
return 0;
} // end top try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
return -1;
}
} // test_chunk_cache
-
/*-------------------------------------------------------------------------
* Function: test_virtual
*
@@ -1303,7 +1270,8 @@ static herr_t test_chunk_cache(FileAccPropList fapl)
*/
const int RANK = 2;
-static herr_t test_virtual()
+static herr_t
+test_virtual()
{
SUBTEST("DSetCreatPropList::setVirtual");
@@ -1338,8 +1306,8 @@ static herr_t test_virtual()
dims[1] = 6;
DataSpace vspace(RANK, dims, mdims);
- hsize_t start[RANK]; // Hyperslab start
- hsize_t count[RANK]; // Hyperslab count
+ hsize_t start[RANK]; // Hyperslab start
+ hsize_t count[RANK]; // Hyperslab count
start[0] = start[1] = 3;
count[0] = count[1] = 3;
vspace.selectHyperslab(H5S_SELECT_SET, count, start);
@@ -1358,13 +1326,11 @@ static herr_t test_virtual()
return 0;
} // end top try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
return -1;
}
} // test_virtual
-
/*-------------------------------------------------------------------------
* Function: test_dset
*
@@ -1387,15 +1353,14 @@ static herr_t test_virtual()
*
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_dset()
+extern "C" void
+test_dset()
{
hid_t fapl_id;
- fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template
- int nerrors=0; // keep track of number of failures occur
+ fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template
+ int nerrors = 0; // keep track of number of failures occur
- try
- {
+ try {
// Use the file access template id to create a file access prop.
// list object to pass in H5File::H5File
FileAccPropList fapl(fapl_id);
@@ -1403,19 +1368,19 @@ void test_dset()
H5File file(FILE1, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
// Cause the library to emit initial messages
- Group grp = file.createGroup( "emit diagnostics", 0);
+ Group grp = file.createGroup("emit diagnostics", 0);
grp.setComment("Causes diagnostic messages to be emitted");
- nerrors += test_create(file) < 0 ? 1:0;
- nerrors += test_simple_io(file) < 0 ? 1:0;
- nerrors += test_getnativeinfo(file) < 0 ? 1:0;
- nerrors += test_tconv(file) < 0 ? 1:0;
- nerrors += test_compression(file) < 0 ? 1:0;
- nerrors += test_nbit_compression(file) < 0 ? 1:0;
- nerrors += test_multiopen (file) < 0 ? 1:0;
- nerrors += test_types(file) < 0 ? 1:0;
- nerrors += test_virtual() < 0 ? 1:0;
- nerrors += test_chunk_cache(fapl) < 0 ? 1:0;
+ nerrors += test_create(file) < 0 ? 1 : 0;
+ nerrors += test_simple_io(file) < 0 ? 1 : 0;
+ nerrors += test_getnativeinfo(file) < 0 ? 1 : 0;
+ nerrors += test_tconv(file) < 0 ? 1 : 0;
+ nerrors += test_compression(file) < 0 ? 1 : 0;
+ nerrors += test_nbit_compression(file) < 0 ? 1 : 0;
+ nerrors += test_multiopen(file) < 0 ? 1 : 0;
+ nerrors += test_types(file) < 0 ? 1 : 0;
+ nerrors += test_virtual() < 0 ? 1 : 0;
+ nerrors += test_chunk_cache(fapl) < 0 ? 1 : 0;
// Close group "emit diagnostics".
grp.close();
@@ -1423,18 +1388,16 @@ void test_dset()
// Close the file before testing data size.
file.close();
- nerrors += test_datasize(fapl) <0 ? 1:0;
+ nerrors += test_datasize(fapl) < 0 ? 1 : 0;
}
- catch (Exception& E)
- {
+ catch (Exception &E) {
test_report(nerrors, H5std_string(" Dataset"));
}
// Clean up data file
cleanup_dsets();
-} // test_dset
+} // test_dset
-
/*-------------------------------------------------------------------------
* Function: cleanup_dsets
*
@@ -1445,9 +1408,8 @@ void test_dset()
* Programmer (use C version)
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_dsets()
+extern "C" void
+cleanup_dsets()
{
HDremove(FILE1.c_str());
} // cleanup_dsets
-
diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp
index f271eed..b93f136 100644
--- a/c++/test/h5cpputil.cpp
+++ b/c++/test/h5cpputil.cpp
@@ -28,11 +28,11 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
/*-------------------------------------------------------------------------
* Function: test_report
@@ -49,24 +49,21 @@ using namespace H5;
* Friday, February 6, 2001
*-------------------------------------------------------------------------
*/
-int test_report( int nerrors, const H5std_string& testname )
+int
+test_report(int nerrors, const H5std_string &testname)
{
- if (nerrors)
- {
- nerrors = MAX(1, nerrors);
+ if (nerrors) {
+ nerrors = MAX(1, nerrors);
if (1 == nerrors)
- cerr << "***** " << nerrors << testname
- << " TEST FAILED! *****" << endl;
+ cerr << "***** " << nerrors << testname << " TEST FAILED! *****" << endl;
else
- cerr << "***** " << nerrors << testname
- << " TESTS FAILED! *****" << endl;
- return 1;
- }
- else
- {
- cerr << "All" << testname << " tests passed." << endl;
- return 0;
- }
+ cerr << "***** " << nerrors << testname << " TESTS FAILED! *****" << endl;
+ return 1;
+ }
+ else {
+ cerr << "All" << testname << " tests passed." << endl;
+ return 0;
+ }
}
/*-------------------------------------------------------------------------
@@ -81,14 +78,14 @@ int test_report( int nerrors, const H5std_string& testname )
*
*-------------------------------------------------------------------------
*/
-void issue_fail_msg(const char* where, int line, const char* file_name,
- const char* message)
+void
+issue_fail_msg(const char *where, int line, const char *file_name, const char *message)
{
- if (GetTestVerbosity()>=VERBO_HI)
- {
+ if (GetTestVerbosity() >= VERBO_HI) {
cerr << endl;
- cerr << ">>> FAILED in " << where << " at line " << line
- << " in " << file_name << " - " << message << endl << endl;
+ cerr << ">>> FAILED in " << where << " at line " << line << " in " << file_name << " - " << message
+ << endl
+ << endl;
}
}
@@ -104,15 +101,15 @@ void issue_fail_msg(const char* where, int line, const char* file_name,
*
*-------------------------------------------------------------------------
*/
-void issue_fail_msg(const char* where, int line, const char* file_name,
- const char* func_name, const char* message)
+void
+issue_fail_msg(const char *where, int line, const char *file_name, const char *func_name, const char *message)
{
- if (GetTestVerbosity()>=VERBO_HI)
- {
+ if (GetTestVerbosity() >= VERBO_HI) {
cerr << endl;
- cerr << ">>> FAILED in " << where << ": " << func_name << endl <<
- " at line " << line << " in " << file_name << endl <<
- " C library detail: " << message << endl << endl;
+ cerr << ">>> FAILED in " << where << ": " << func_name << endl
+ << " at line " << line << " in " << file_name << endl
+ << " C library detail: " << message << endl
+ << endl;
}
}
@@ -134,13 +131,13 @@ void issue_fail_msg(const char* where, int line, const char* file_name,
* Friday, February 6, 2001
*-------------------------------------------------------------------------
*/
-int check_values (hsize_t i, hsize_t j, int apoint, int acheck)
+int
+check_values(hsize_t i, hsize_t j, int apoint, int acheck)
{
- if (apoint != acheck)
- {
+ if (apoint != acheck) {
cerr << " Read different values than written.\n" << endl;
- cerr << " At index " << static_cast<unsigned long>(i) << "," <<
- static_cast<unsigned long>(j) << endl;
+ cerr << " At index " << static_cast<unsigned long>(i) << "," << static_cast<unsigned long>(j)
+ << endl;
return -1;
}
return 0;
@@ -161,10 +158,10 @@ int check_values (hsize_t i, hsize_t j, int apoint, int acheck)
*
*-------------------------------------------------------------------------
*/
-void check_values(const char *value, const char* msg, int line, const char* file_name)
+void
+check_values(const char *value, const char *msg, int line, const char *file_name)
{
- if (value == NULL)
- {
+ if (value == NULL) {
cerr << endl;
cerr << "*** ERROR: " << msg << ", at line " << line << endl;
IncTestNumErrs();
@@ -187,21 +184,19 @@ void check_values(const char *value, const char* msg, int line, const char* file
* May 2, 2010
*-------------------------------------------------------------------------
*/
-void verify_val(const char* x, const char* value, const char* where, int line, const char* file_name)
+void
+verify_val(const char *x, const char *value, const char *where, int line, const char *file_name)
{
- if (GetTestVerbosity()>=VERBO_HI)
- {
+ if (GetTestVerbosity() >= VERBO_HI) {
cerr << endl;
- cerr << " Call to routine: " << where << " at line " << line
- << " in " << file_name << " had value " << x << endl;
+ cerr << " Call to routine: " << where << " at line " << line << " in " << file_name << " had value "
+ << x << endl;
}
- if (strcmp(x, value) != 0)
- {
+ if (strcmp(x, value) != 0) {
cerr << endl;
- cerr << "*** UNEXPECTED VALUE from " << where << " should be "
- << value << ", but is " << x << " at line " << line
- << " in " << file_name << endl;
- //IncTestNumErrs();
+ cerr << "*** UNEXPECTED VALUE from " << where << " should be " << value << ", but is " << x
+ << " at line " << line << " in " << file_name << endl;
+ // IncTestNumErrs();
throw TestFailedException(where, "");
}
}
@@ -209,7 +204,7 @@ void verify_val(const char* x, const char* value, const char* where, int line, c
//--------------------------------------------------------------------------
// Function: InvalidActionException default constructor
//--------------------------------------------------------------------------
-InvalidActionException::InvalidActionException():Exception(){}
+InvalidActionException::InvalidActionException() : Exception() {}
//--------------------------------------------------------------------------
// Function: InvalidActionException overloaded constructor
@@ -221,7 +216,10 @@ InvalidActionException::InvalidActionException():Exception(){}
// func - IN: Name of the function where failure should occur
// message - IN: Message
//--------------------------------------------------------------------------
-InvalidActionException::InvalidActionException(const H5std_string func, const H5std_string message) : Exception(func, message) {}
+InvalidActionException::InvalidActionException(const H5std_string func, const H5std_string message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: InvalidActionException destructor
@@ -231,7 +229,7 @@ InvalidActionException::~InvalidActionException() throw() {}
//--------------------------------------------------------------------------
// Function: TestFailedException default constructor
//--------------------------------------------------------------------------
-TestFailedException::TestFailedException():Exception(){}
+TestFailedException::TestFailedException() : Exception() {}
//--------------------------------------------------------------------------
// Function: TestFailedException overloaded constructor
@@ -243,10 +241,12 @@ TestFailedException::TestFailedException():Exception(){}
// func - IN: Name of the function where failure should occur
// message - IN: Message
//--------------------------------------------------------------------------
-TestFailedException::TestFailedException(const H5std_string func, const H5std_string message) : Exception(func, message) {}
+TestFailedException::TestFailedException(const H5std_string func, const H5std_string message)
+ : Exception(func, message)
+{
+}
//--------------------------------------------------------------------------
// Function: TestFailedException destructor
//--------------------------------------------------------------------------
TestFailedException::~TestFailedException() throw() {}
-
diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h
index 6664d0c..97ed00b 100644
--- a/c++/test/h5cpputil.h
+++ b/c++/test/h5cpputil.h
@@ -28,94 +28,97 @@ using namespace H5;
using std::cerr;
using std::endl;
-#define MESSAGE(V,A) {if (HDGetTestVerbosity()>(V)) print_func A;}
-#define SUBTEST(TEST) {printf(" Subtest: %-52s",TEST); fflush(stdout);}
+#define MESSAGE(V, A) \
+ { \
+ if (HDGetTestVerbosity() > (V)) \
+ print_func A; \
+ }
+#define SUBTEST(TEST) \
+ { \
+ printf(" Subtest: %-52s", TEST); \
+ fflush(stdout); \
+ }
-int check_values (hsize_t i, hsize_t j, int apoint, int acheck);
-void check_values(const char *value, const char* msg, int line, const char* file_name);
-int test_report (int, const H5std_string&);
-void issue_fail_msg(const char* where, int line, const char* file_name,
- const char* message="");
-void issue_fail_msg(const char* where, int line, const char* file_name,
- const char* func_name, const char* message);
+int check_values(hsize_t i, hsize_t j, int apoint, int acheck);
+void check_values(const char *value, const char *msg, int line, const char *file_name);
+int test_report(int, const H5std_string &);
+void issue_fail_msg(const char *where, int line, const char *file_name, const char *message = "");
+void issue_fail_msg(const char *where, int line, const char *file_name, const char *func_name,
+ const char *message);
class InvalidActionException : public Exception {
- public:
- InvalidActionException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG);
- InvalidActionException();
- virtual ~InvalidActionException() throw();
+ public:
+ InvalidActionException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG);
+ InvalidActionException();
+ virtual ~InvalidActionException() throw();
};
class TestFailedException : public Exception {
- public:
- TestFailedException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG);
- TestFailedException();
- virtual ~TestFailedException() throw();
+ public:
+ TestFailedException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG);
+ TestFailedException();
+ virtual ~TestFailedException() throw();
};
// Overloaded/Template functions to verify values and display proper info
// Verifies
-void verify_val(const char* x, const char* value, const char* where, int line, const char* file_name);
+void verify_val(const char *x, const char *value, const char *where, int line, const char *file_name);
template <class Type1, class Type2>
- void verify_val(Type1 x, Type2 value, const char* where, int line, const char* file_name)
+void
+verify_val(Type1 x, Type2 value, const char *where, int line, const char *file_name)
{
- if (GetTestVerbosity()>=VERBO_HI)
- {
+ if (GetTestVerbosity() >= VERBO_HI) {
cerr << endl;
- cerr << " Call to routine: " << where << " at line " << line
- << " in " << file_name << " had value " << x << endl;
+ cerr << " Call to routine: " << where << " at line " << line << " in " << file_name << " had value "
+ << x << endl;
}
- if (x != value)
- {
+ if (x != value) {
cerr << endl;
- cerr << "*** UNEXPECTED VALUE from " << where << " should be "
- << value << ", but is " << x << " at line " << line
- << " in " << file_name << endl;
+ cerr << "*** UNEXPECTED VALUE from " << where << " should be " << value << ", but is " << x
+ << " at line " << line << " in " << file_name << endl;
IncTestNumErrs();
throw TestFailedException(where, "");
}
}
template <class Type1, class Type2>
- void verify_val(Type1 x, Type2 value, const char* msg, const char* file_name, int line)
+void
+verify_val(Type1 x, Type2 value, const char *msg, const char *file_name, int line)
{
- if (x != value)
- {
+ if (x != value) {
cerr << endl;
- cerr << "*** UNEXPECTED VALUE: " << file_name << ":line " << line
- << ": " << msg << " different: " << x << ", should be " << value
- << endl;
+ cerr << "*** UNEXPECTED VALUE: " << file_name << ":line " << line << ": " << msg
+ << " different: " << x << ", should be " << value << endl;
IncTestNumErrs();
throw TestFailedException(file_name, msg);
}
}
template <class Type1, class Type2>
- void verify_val_noteq(Type1 x, Type2 value, const char* where, int line, const char* file_name)
+void
+verify_val_noteq(Type1 x, Type2 value, const char *where, int line, const char *file_name)
{
- if (GetTestVerbosity()>=VERBO_HI)
- {
+ if (GetTestVerbosity() >= VERBO_HI) {
cerr << endl;
- cerr << " Call to routine: " << where << " at line " << line
- << " in " << file_name << " had value " << x << endl;
+ cerr << " Call to routine: " << where << " at line " << line << " in " << file_name << " had value "
+ << x << endl;
}
- if (x == value)
- {
+ if (x == value) {
cerr << endl;
- cerr << "*** UNEXPECTED VALUE from " << where << " should not be "
- << value << " at line " << line << " in " << file_name << endl;
+ cerr << "*** UNEXPECTED VALUE from " << where << " should not be " << value << " at line " << line
+ << " in " << file_name << endl;
IncTestNumErrs();
throw TestFailedException(where, "");
}
}
template <class Type1, class Type2>
- void CHECK(Type1 x, Type2 value, const char* msg, int line, const char* file_name)
+void
+CHECK(Type1 x, Type2 value, const char *msg, int line, const char *file_name)
{
- if (x == value)
- {
+ if (x == value) {
cerr << endl;
cerr << "*** Function " << msg << " FAILED at line " << line << endl;
IncTestNumErrs();
@@ -124,14 +127,13 @@ template <class Type1, class Type2>
}
template <class Type1, class Type2>
- void verify_val(Type1 x, Type2 value, float epsilon, const char* msg, int line, const char* file_name)
+void
+verify_val(Type1 x, Type2 value, float epsilon, const char *msg, int line, const char *file_name)
{
- if (x == value)
- {
+ if (x == value) {
cerr << endl;
- cerr << "*** UNEXPECTED FLOAT VALUE: " << file_name << ":line " << line
- << ": " << msg << " different: " << x << ", should be " << value
- << " (epsilon=" << epsilon << ")" << endl;
+ cerr << "*** UNEXPECTED FLOAT VALUE: " << file_name << ":line " << line << ": " << msg
+ << " different: " << x << ", should be " << value << " (epsilon=" << epsilon << ")" << endl;
IncTestNumErrs();
throw TestFailedException(file_name, msg);
}
diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp
index d80de16..dc7ea71 100644
--- a/c++/test/tarray.cpp
+++ b/c++/test/tarray.cpp
@@ -25,29 +25,35 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
-const H5std_string FILENAME("tarray.h5");
-const H5std_string ARRAYTYPE_NAME("/Array type 1");
-const int SPACE1_RANK = 1;
-const hsize_t SPACE1_DIM1 = 4;
-const int ARRAY1_RANK = 1;
-const hsize_t ARRAY1_DIM1 = 4;
+const H5std_string FILENAME("tarray.h5");
+const H5std_string ARRAYTYPE_NAME("/Array type 1");
+const int SPACE1_RANK = 1;
+const hsize_t SPACE1_DIM1 = 4;
+const int ARRAY1_RANK = 1;
+const hsize_t ARRAY1_DIM1 = 4;
-typedef enum flt_t {
- FLT_FLOAT, FLT_DOUBLE, FLT_LDOUBLE, FLT_OTHER
-} flt_t;
+typedef enum flt_t { FLT_FLOAT, FLT_DOUBLE, FLT_LDOUBLE, FLT_OTHER } flt_t;
typedef enum int_t {
- INT_CHAR, INT_UCHAR, INT_SHORT, INT_USHORT, INT_INT, INT_UINT,
- INT_LONG, INT_ULONG, INT_LLONG, INT_ULLONG, INT_OTHER
+ INT_CHAR,
+ INT_UCHAR,
+ INT_SHORT,
+ INT_USHORT,
+ INT_INT,
+ INT_UINT,
+ INT_LONG,
+ INT_ULONG,
+ INT_LLONG,
+ INT_ULLONG,
+ INT_OTHER
} int_t;
-
/*-------------------------------------------------------------------------
* Function: test_array_compound_array
*
@@ -59,29 +65,29 @@ typedef enum int_t {
* January, 2016
*-------------------------------------------------------------------------
*/
-static void test_array_compound_array()
+static void
+test_array_compound_array()
{
SUBTEST("ArrayType::getArrayNDims & ArrayType::getArrayDims");
- typedef struct { // Typedef for compound datatype */
- int i;
+ typedef struct { // Typedef for compound datatype */
+ int i;
float f[ARRAY1_DIM1];
} s1_t;
- s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information to write
- s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information read in
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int nmemb; // Number of compound members
- int ii; // counting variables
- hsize_t idxi, idxj, idxk; // dimension indicing variables
- H5T_class_t mclass; // Datatype class for field
+ s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information to write
+ s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information read in
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int nmemb; // Number of compound members
+ int ii; // counting variables
+ hsize_t idxi, idxj, idxk; // dimension indicing variables
+ H5T_class_t mclass; // Datatype class for field
// Initialize array data to write
- for (idxi =0; idxi < SPACE1_DIM1; idxi++)
+ for (idxi = 0; idxi < SPACE1_DIM1; idxi++)
for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) {
wdata[idxi][idxj].i = idxi * 10 + idxj;
- for(idxk = 0; idxk < ARRAY1_DIM1; idxk++)
- {
- float temp = idxi * 10.0 + idxj * 2.5 + idxk;
+ for (idxk = 0; idxk < ARRAY1_DIM1; idxk++) {
+ float temp = idxi * 10.0 + idxj * 2.5 + idxk;
wdata[idxi][idxj].f[idxk] = temp;
}
} // end for
@@ -157,8 +163,8 @@ static void test_array_compound_array()
// Verify that it is an array of compounds
DataType dstype = dataset.getDataType();
- mclass = dstype.getClass();
- verify_val(mclass==H5T_ARRAY, true, "f2_type.getClass", __LINE__, __FILE__);
+ mclass = dstype.getClass();
+ verify_val(mclass == H5T_ARRAY, true, "f2_type.getClass", __LINE__, __FILE__);
dstype.close();
@@ -174,11 +180,12 @@ static void test_array_compound_array()
atype_check.getArrayDims(rdims1);
// Check the array dimensions
- for (ii =0; ii <ndims; ii++)
- if (rdims1[ii]!=tdims1[ii]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=z%d\n", ii, rdims1[ii], ii, tdims1[ii]);
- continue;
- } // end if
+ for (ii = 0; ii < ndims; ii++)
+ if (rdims1[ii] != tdims1[ii]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=z%d\n",
+ ii, rdims1[ii], ii, tdims1[ii]);
+ continue;
+ } // end if
// Test ArrayType::ArrayType(const hid_t existing_id)
ArrayType new_arrtype(atype_check.getId());
@@ -193,9 +200,10 @@ static void test_array_compound_array()
// Check the array dimensions
for (ii = 0; ii < ndims; ii++)
if (rdims1[ii] != tdims1[ii]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=%zd\n", ii, rdims1[ii], ii, tdims1[ii]);
- continue;
- } // end if
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=%zd\n",
+ ii, rdims1[ii], ii, tdims1[ii]);
+ continue;
+ } // end if
/*
* Check the compound datatype and the array of floats datatype
@@ -204,8 +212,8 @@ static void test_array_compound_array()
// Get the compound datatype, which is the base datatype of the
// array datatype atype_check.
DataType base_type = atype_check.getSuper();
- mclass = base_type.getClass();
- verify_val(mclass==H5T_COMPOUND, true, "atype_check.getClass", __LINE__, __FILE__);
+ mclass = base_type.getClass();
+ verify_val(mclass == H5T_COMPOUND, true, "atype_check.getClass", __LINE__, __FILE__);
// Verify the compound datatype info
CompType ctype_check(base_type.getId());
@@ -217,15 +225,15 @@ static void test_array_compound_array()
// Check the 2nd field's name
H5std_string field2_name = ctype_check.getMemberName(1);
- if (HDstrcmp(field2_name.c_str(),"f") != 0)
- TestErrPrintf("Compound field name doesn't match!, field2_name=%s\n",field2_name.c_str());
+ if (HDstrcmp(field2_name.c_str(), "f") != 0)
+ TestErrPrintf("Compound field name doesn't match!, field2_name=%s\n", field2_name.c_str());
// Get the 2nd field's datatype
DataType f2_type = ctype_check.getMemberDataType(1);
// Get the 2nd field's class, this 2nd field should have an array type
mclass = f2_type.getClass();
- verify_val(mclass==H5T_ARRAY, true, "f2_type.getClass", __LINE__, __FILE__);
+ verify_val(mclass == H5T_ARRAY, true, "f2_type.getClass", __LINE__, __FILE__);
f2_type.close();
// Get the 2nd field, array of floats datatype, to check
@@ -242,7 +250,8 @@ static void test_array_compound_array()
// Check the array dimensions
for (ii = 0; ii < ndims; ii++)
if (rdims1[ii] != tdims1[ii]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=%zd\n", ii, rdims1[ii], ii, tdims1[ii]);
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=%zd\n",
+ ii, rdims1[ii], ii, tdims1[ii]);
continue;
} // end if
@@ -257,33 +266,34 @@ static void test_array_compound_array()
for (idxi = 0; idxi < SPACE1_DIM1; idxi++) {
for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) {
if (wdata[idxi][idxj].i != rdata[idxi][idxj].i) {
- TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n",idxi,idxj,wdata[idxi][idxj].i,idxi,idxj,rdata[idxi][idxj].i);
+ TestErrPrintf(
+ "Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n",
+ idxi, idxj, wdata[idxi][idxj].i, idxi, idxj, rdata[idxi][idxj].i);
continue;
} // end if
- } // end for
- } // end for
+ } // end for
+ } // end for
// Close all
atype_check.close();
dataset.close();
file1.close();
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
issue_fail_msg("test_array_compound_array", __LINE__, __FILE__, E.getCDetailMsg());
}
} // end test_array_compound_array()
-
/*
* Helper routine to demonstrate the issue in HDFFV-9562
*/
-H5::DataType getArr()
+H5::DataType
+getArr()
{
hsize_t *dims = new hsize_t;
- *dims = 5;
+ *dims = 5;
H5::ArrayType ret;
ret = H5::ArrayType(H5::PredType::NATIVE_INT, 1, dims);
delete dims;
@@ -304,7 +314,8 @@ H5::DataType getArr()
* Used user's sample code in HDFFV-9562
*-------------------------------------------------------------------------
*/
-static void test_array_assignment()
+static void
+test_array_assignment()
{
hsize_t sdims1[] = {SPACE1_DIM1};
SUBTEST("ArrayType::operator=");
@@ -341,14 +352,12 @@ static void test_array_assignment()
file1.close();
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
issue_fail_msg("test_array_assignment", __LINE__, __FILE__, E.getCDetailMsg());
}
} // end test_array_assignment()
-
/*-------------------------------------------------------------------------
* Function: test_array_info
*
@@ -360,27 +369,27 @@ static void test_array_assignment()
* April, 2016
*-------------------------------------------------------------------------
*/
-static void test_array_info()
+static void
+test_array_info()
{
SUBTEST("ArrayType Const Methods");
- typedef struct { // Typedef for compound datatype */
- int i;
+ typedef struct { // Typedef for compound datatype */
+ int i;
float f[ARRAY1_DIM1];
} s1_t;
- s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information to write
- hsize_t sdims1[] = {SPACE1_DIM1};
- hsize_t tdims1[] = {ARRAY1_DIM1};
- int ii; // counting variables
- hsize_t idxi, idxj, idxk; // dimension indicing variables
- H5T_class_t mclass; // Datatype class for field
+ s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information to write
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int ii; // counting variables
+ hsize_t idxi, idxj, idxk; // dimension indicing variables
+ H5T_class_t mclass; // Datatype class for field
// Initialize array data to write
- for (idxi =0; idxi < SPACE1_DIM1; idxi++)
+ for (idxi = 0; idxi < SPACE1_DIM1; idxi++)
for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) {
wdata[idxi][idxj].i = idxi * 10 + idxj;
- for(idxk = 0; idxk < ARRAY1_DIM1; idxk++)
- {
- float temp = idxi * 10.0 + idxj * 2.5 + idxk;
+ for (idxk = 0; idxk < ARRAY1_DIM1; idxk++) {
+ float temp = idxi * 10.0 + idxj * 2.5 + idxk;
wdata[idxi][idxj].f[idxk] = temp;
}
} // end for
@@ -429,44 +438,44 @@ static void test_array_info()
// Verify that it is an array of compounds
DataType dstype = dataset.getDataType();
- mclass = dstype.getClass();
- verify_val(mclass==H5T_ARRAY, true, "f2_type.getClass", __LINE__, __FILE__);
+ mclass = dstype.getClass();
+ verify_val(mclass == H5T_ARRAY, true, "f2_type.getClass", __LINE__, __FILE__);
dstype.close();
{ // Let atype_check go out of scope
- // Get the array datatype, declared as const
- const ArrayType atype_check = dataset.getArrayType();
-
- // Check the array rank with the const method
- int ndims = atype_check.getArrayNDims();
- verify_val(ndims, ARRAY1_RANK, "atype_check.getArrayNDims", __LINE__, __FILE__);
-
- // Get the array dimensions with the const method
- hsize_t rdims1[H5S_MAX_RANK];
- atype_check.getArrayDims(rdims1);
-
- // Check the array dimensions
- for (ii =0; ii <ndims; ii++)
- if (rdims1[ii]!=tdims1[ii]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=z%d\n", ii, rdims1[ii], ii, tdims1[ii]);
- continue;
- } // end if
+ // Get the array datatype, declared as const
+ const ArrayType atype_check = dataset.getArrayType();
+
+ // Check the array rank with the const method
+ int ndims = atype_check.getArrayNDims();
+ verify_val(ndims, ARRAY1_RANK, "atype_check.getArrayNDims", __LINE__, __FILE__);
+
+ // Get the array dimensions with the const method
+ hsize_t rdims1[H5S_MAX_RANK];
+ atype_check.getArrayDims(rdims1);
+
+ // Check the array dimensions
+ for (ii = 0; ii < ndims; ii++)
+ if (rdims1[ii] != tdims1[ii]) {
+ TestErrPrintf(
+ "Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=z%d\n", ii,
+ rdims1[ii], ii, tdims1[ii]);
+ continue;
+ } // end if
}
// Close all
dataset.close();
file1.close();
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
issue_fail_msg("test_array_info", __LINE__, __FILE__, E.getCDetailMsg());
}
} // end test_array_info()
-
/*-------------------------------------------------------------------------
* Function: test_array
*
@@ -475,8 +484,8 @@ static void test_array_info()
* Return None
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_array()
+extern "C" void
+test_array()
{
// Output message about test being performed
MESSAGE(5, ("Testing Array Datatypes\n"));
@@ -490,9 +499,8 @@ void test_array()
// Test const functions (HDFFV-9725)
test_array_info();
-} // test_array()
+} // test_array()
-
/*-------------------------------------------------------------------------
* Function: cleanup_array
*
@@ -504,8 +512,8 @@ void test_array()
* January, 2016
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_array()
+extern "C" void
+cleanup_array()
{
HDremove(FILENAME.c_str());
-} // cleanup_array
+} // cleanup_array
diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp
index f432723..2290fff 100644
--- a/c++/test/tattr.cpp
+++ b/c++/test/tattr.cpp
@@ -26,11 +26,11 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
const H5std_string FILE_BASIC("tattr_basic.h5");
const H5std_string FILE_COMPOUND("tattr_compound.h5");
@@ -39,10 +39,10 @@ const H5std_string FILE_MULTI("tattr_multi.h5");
const H5std_string FILE_DTYPE("tattr_dtype.h5");
const H5std_string ATTR_TMP_NAME("temp_attr_name");
const H5std_string FATTR_TMP_NAME("temp_fattr_name");
-const size_t ATTR_MAX_DIMS = 7;
+const size_t ATTR_MAX_DIMS = 7;
/* 3-D dataset with fixed dimensions */
-const int SPACE1_RANK = 3;
+const int SPACE1_RANK = 3;
const hsize_t SPACE1_DIM1 = 3;
const hsize_t SPACE1_DIM2 = 15;
const hsize_t SPACE1_DIM3 = 13;
@@ -54,54 +54,55 @@ const H5std_string TYPE1_NAME("/Type");
/* Attribute Rank & Dimensions */
const H5std_string ATTR1_NAME("Attr1");
-const int ATTR1_RANK = 1;
-const hsize_t ATTR1_DIM1 = 3;
-int attr_data1[ATTR1_DIM1]={512,-234,98123}; /* Test data for 1st attribute */
+const int ATTR1_RANK = 1;
+const hsize_t ATTR1_DIM1 = 3;
+int attr_data1[ATTR1_DIM1] = {512, -234, 98123}; /* Test data for 1st attribute */
// File attribute, using the same rank and dimensions as ATTR1_NAME's
const H5std_string FATTR1_NAME("File Attr1");
const H5std_string FATTR2_NAME("File Attr2");
const H5std_string ATTR2_NAME("Attr2");
-const int ATTR2_RANK = 2;
-const hsize_t ATTR2_DIM1 = 2;
-const hsize_t ATTR2_DIM2 = 2;
-int attr_data2[ATTR2_DIM1][ATTR2_DIM2]={{7614,-416},{197814,-3}}; /* Test data for 2nd attribute */
+const int ATTR2_RANK = 2;
+const hsize_t ATTR2_DIM1 = 2;
+const hsize_t ATTR2_DIM2 = 2;
+int attr_data2[ATTR2_DIM1][ATTR2_DIM2] = {{7614, -416}, {197814, -3}}; /* Test data for 2nd attribute */
const H5std_string ATTR3_NAME("Attr3");
-const int ATTR3_RANK = 3;
-const hsize_t ATTR3_DIM1 = 2;
-const hsize_t ATTR3_DIM2 = 2;
-const hsize_t ATTR3_DIM3 = 2;
-double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3]={{{2.3,-26.1},{0.123,-10.0}},{{981724.2,-0.91827},{2.0,23.0}}}; /* Test data for 3rd attribute */
+const int ATTR3_RANK = 3;
+const hsize_t ATTR3_DIM1 = 2;
+const hsize_t ATTR3_DIM2 = 2;
+const hsize_t ATTR3_DIM3 = 2;
+double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = {
+ {{2.3, -26.1}, {0.123, -10.0}}, {{981724.2, -0.91827}, {2.0, 23.0}}}; /* Test data for 3rd attribute */
const H5std_string ATTR4_NAME("Attr4");
-const int ATTR4_RANK = 2;
-const hsize_t ATTR4_DIM1 = 2;
-const hsize_t ATTR4_DIM2 = 2;
+const int ATTR4_RANK = 2;
+const hsize_t ATTR4_DIM1 = 2;
+const hsize_t ATTR4_DIM2 = 2;
const H5std_string ATTR4_FIELDNAME1("i");
const H5std_string ATTR4_FIELDNAME2("d");
const H5std_string ATTR4_FIELDNAME3("c");
-size_t attr4_field1_off=0;
-size_t attr4_field2_off=0;
-size_t attr4_field3_off=0;
+size_t attr4_field1_off = 0;
+size_t attr4_field2_off = 0;
+size_t attr4_field3_off = 0;
struct attr4_struct {
- int i;
+ int i;
double d;
- char c;
- } attr_data4[ATTR4_DIM1][ATTR4_DIM2]={{{3,-26.1,'d'},{-100000, 0.123,'3'}},
- {{-23,981724.2,'Q'},{0,2.0,'\n'}}}; // Test data for 4th attribute
+ char c;
+} attr_data4[ATTR4_DIM1][ATTR4_DIM2] = {
+ {{3, -26.1, 'd'}, {-100000, 0.123, '3'}},
+ {{-23, 981724.2, 'Q'}, {0, 2.0, '\n'}}}; // Test data for 4th attribute
const H5std_string ATTR5_NAME("Attr5");
-const int ATTR5_RANK = 0;
-float attr_data5 = (float)-5.123; // Test data for 5th attribute
+const int ATTR5_RANK = 0;
+float attr_data5 = (float)-5.123; // Test data for 5th attribute
/* Info for another attribute */
const H5std_string ATTR1A_NAME("Attr1_a");
-int attr_data1a[ATTR1_DIM1]={256,11945,-22107};
+int attr_data1a[ATTR1_DIM1] = {256, 11945, -22107};
-
/*-------------------------------------------------------------------------
* Function: test_attr_basic_write
*
@@ -110,12 +111,13 @@ int attr_data1a[ATTR1_DIM1]={256,11945,-22107};
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_basic_write()
+static void
+test_attr_basic_write()
{
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {ATTR1_DIM1};
- hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2};
- int read_data1[ATTR1_DIM1]={0}; // Buffer for reading 1st attribute
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {ATTR1_DIM1};
+ hsize_t dims3[] = {ATTR2_DIM1, ATTR2_DIM2};
+ int read_data1[ATTR1_DIM1] = {0}; // Buffer for reading 1st attribute
hsize_t i;
// Output message about test being performed
@@ -123,10 +125,10 @@ static void test_attr_basic_write()
try {
// Create file
- H5File fid1 (FILE_BASIC, H5F_ACC_TRUNC);
+ H5File fid1(FILE_BASIC, H5F_ACC_TRUNC);
// Create dataspace for dataset
- DataSpace ds_space (SPACE1_RANK, dims1);
+ DataSpace ds_space(SPACE1_RANK, dims1);
/*
* Test attribute with dataset
@@ -136,55 +138,59 @@ static void test_attr_basic_write()
DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, ds_space);
// Create dataspace for attribute
- DataSpace att_space (ATTR1_RANK, dims2);
+ DataSpace att_space(ATTR1_RANK, dims2);
// Create a file attribute
- Attribute file_attr2 = fid1.createAttribute (FATTR1_NAME, PredType::NATIVE_INT, att_space);
+ Attribute file_attr2 = fid1.createAttribute(FATTR1_NAME, PredType::NATIVE_INT, att_space);
// Create a file attribute
- Attribute file_attr1 = fid1.createAttribute (FATTR2_NAME, PredType::NATIVE_INT, att_space);
+ Attribute file_attr1 = fid1.createAttribute(FATTR2_NAME, PredType::NATIVE_INT, att_space);
// Create an attribute for the dataset
- Attribute ds_attr1 = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space);
+ Attribute ds_attr1 = dataset.createAttribute(ATTR1_NAME, PredType::NATIVE_INT, att_space);
// Try creating an attribute that already exists. This should fail
// since two attributes cannot have the same name. If an exception
// is not thrown for this action by createAttribute, then throw an
// invalid action exception.
try {
- Attribute invalid_attr = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space);
+ Attribute invalid_attr = dataset.createAttribute(ATTR1_NAME, PredType::NATIVE_INT, att_space);
// continuation here, that means no exception has been thrown
- throw InvalidActionException("H5File::createDataSet", "Library allowed overwrite of existing dataset");
+ throw InvalidActionException("H5File::createDataSet",
+ "Library allowed overwrite of existing dataset");
}
- catch (AttributeIException& E) // catching invalid creating attribute
- {} // do nothing, exception expected
+ catch (AttributeIException &E) // catching invalid creating attribute
+ {
+ } // do nothing, exception expected
// Write attribute information
- ds_attr1.write (PredType::NATIVE_INT, attr_data1);
+ ds_attr1.write(PredType::NATIVE_INT, attr_data1);
// Read attribute information immediately, without closing attribute
- ds_attr1.read (PredType::NATIVE_INT, read_data1);
+ ds_attr1.read(PredType::NATIVE_INT, read_data1);
// Verify values read in
- for(i=0; i<ATTR1_DIM1; i++)
- if(attr_data1[i]!=read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (attr_data1[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n", __LINE__,
+ i, attr_data1[i], i, read_data1[i]);
// Create two more attributes for this dataset, but only write to one.
- Attribute ds_attr2 = dataset.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, att_space);
- Attribute ds_attr3 = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_INT, att_space);
+ Attribute ds_attr2 = dataset.createAttribute(ATTR2_NAME, PredType::NATIVE_INT, att_space);
+ Attribute ds_attr3 = dataset.createAttribute(ATTR3_NAME, PredType::NATIVE_INT, att_space);
// Write attribute information
- ds_attr2.write (PredType::NATIVE_INT, attr_data1a);
+ ds_attr2.write(PredType::NATIVE_INT, attr_data1a);
// Read attribute information immediately, without closing attribute
- ds_attr2.read (PredType::NATIVE_INT, read_data1);
+ ds_attr2.read(PredType::NATIVE_INT, read_data1);
// Verify values read in
- for(i=0; i<ATTR1_DIM1; i++)
- if(attr_data1a[i]!=read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1a[i],i,read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (attr_data1a[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d,read_data1[%d]=%d\n",
+ __LINE__, i, attr_data1a[i], i, read_data1[i]);
// Close both attributes
ds_attr1.close();
@@ -196,47 +202,46 @@ static void test_attr_basic_write()
*/
// Create group in file fid1
- Group group = fid1.createGroup (GROUP1_NAME);
+ Group group = fid1.createGroup(GROUP1_NAME);
// Create dataspace for attribute
DataSpace sid3(ATTR2_RANK, dims3);
// Create an attribute for the group
- Attribute gr_attr = group.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, sid3);
+ Attribute gr_attr = group.createAttribute(ATTR2_NAME, PredType::NATIVE_INT, sid3);
// Check storage size for attribute
hsize_t attr_size = gr_attr.getStorageSize();
- verify_val((long)attr_size, (long)(ATTR2_DIM1*ATTR2_DIM2*sizeof(int)),
- "Attribute::getStorageSize",__LINE__,__FILE__);
+ verify_val((long)attr_size, (long)(ATTR2_DIM1 * ATTR2_DIM2 * sizeof(int)),
+ "Attribute::getStorageSize", __LINE__, __FILE__);
// Try to create the same attribute again (should fail)
try {
- Attribute invalid_attr = group.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, sid3);
+ Attribute invalid_attr = group.createAttribute(ATTR2_NAME, PredType::NATIVE_INT, sid3);
// continuation here, that means no exception has been thrown
throw InvalidActionException("H5Group::createAttribute",
- "Attempting to create an existing attribute");
+ "Attempting to create an existing attribute");
}
- catch (AttributeIException& E) // catching invalid creating attribute
- {} // do nothing, exception expected
+ catch (AttributeIException &E) // catching invalid creating attribute
+ {
+ } // do nothing, exception expected
// Write attribute information
- gr_attr.write (PredType::NATIVE_INT, attr_data2);
+ gr_attr.write(PredType::NATIVE_INT, attr_data2);
// Check storage size for attribute
attr_size = gr_attr.getStorageSize();
- verify_val((long)attr_size, (long)(ATTR2_DIM1*ATTR2_DIM2*sizeof(int)),
- "Attribute::getStorageSize", __LINE__, __FILE__);
+ verify_val((long)attr_size, (long)(ATTR2_DIM1 * ATTR2_DIM2 * sizeof(int)),
+ "Attribute::getStorageSize", __LINE__, __FILE__);
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_basic_write()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_basic_write()
+} // test_attr_basic_write()
-
/*-------------------------------------------------------------------------
* Function: test_attr_getname
*
@@ -264,7 +269,8 @@ static void test_attr_basic_write()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_getname()
+static void
+test_attr_getname()
{
// Output message about test being performed
SUBTEST("Testing all overloads of Attribute::getName");
@@ -290,36 +296,37 @@ static void test_attr_getname()
// using different buffer sizes and verify against FATTR1_NAME (3 cases)
// 1. With arbitrary buf_size that is larger than the name size
- size_t buf_size = FATTR1_NAME.length() + 10;
- char* fattr1_name = new char[buf_size+1];
- HDmemset(fattr1_name, 0, buf_size+1);
+ size_t buf_size = FATTR1_NAME.length() + 10;
+ char * fattr1_name = new char[buf_size + 1];
+ HDmemset(fattr1_name, 0, buf_size + 1);
ssize_t name_size = 0; // actual length of attribute name
- name_size = fattr1.getName(fattr1_name, buf_size+1);
+ name_size = fattr1.getName(fattr1_name, buf_size + 1);
CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__);
verify_val((size_t)name_size, FATTR1_NAME.length(), "Attribute::getName", __LINE__, __FILE__);
- verify_val((const char*)fattr1_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
- delete []fattr1_name;
+ verify_val((const char *)fattr1_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
+ delete[] fattr1_name;
// 2. With arbitrary buf_size that is smaller than the name's length.
// Let's try 4 first characters in the name.
- buf_size = 4;
+ buf_size = 4;
char short_name[5] = "File"; // to verify the read name
- fattr1_name = new char[buf_size+1];
- HDmemset(fattr1_name, 0, buf_size+1);
- name_size = fattr1.getName(fattr1_name, buf_size+1);
+ fattr1_name = new char[buf_size + 1];
+ HDmemset(fattr1_name, 0, buf_size + 1);
+ name_size = fattr1.getName(fattr1_name, buf_size + 1);
CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__);
verify_val((size_t)name_size, FATTR1_NAME.size(), "Attribute::getName", __LINE__, __FILE__);
- verify_val((const char*)fattr1_name, (const char*)short_name, "Attribute::getName", __LINE__, __FILE__);
- delete []fattr1_name;
+ verify_val((const char *)fattr1_name, (const char *)short_name, "Attribute::getName", __LINE__,
+ __FILE__);
+ delete[] fattr1_name;
// 3. With a buf_size that equals the name's length.
- buf_size = FATTR1_NAME.length();
- fattr1_name = new char[buf_size+1];
- HDmemset(fattr1_name, 0, buf_size+1);
- name_size = fattr1.getName(fattr1_name, buf_size+1);
+ buf_size = FATTR1_NAME.length();
+ fattr1_name = new char[buf_size + 1];
+ HDmemset(fattr1_name, 0, buf_size + 1);
+ name_size = fattr1.getName(fattr1_name, buf_size + 1);
CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__);
verify_val(fattr1_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
- delete []fattr1_name;
+ delete[] fattr1_name;
// B. Get attribute name with
// ssize_t Attribute::getName(H5std_string& attr_name, size_t buf_size)
@@ -357,7 +364,7 @@ static void test_attr_getname()
// Open attribute
Attribute attr1(dataset.openAttribute(ATTR1_NAME));
- size_t len = 4;
+ size_t len = 4;
H5std_string dattr_name1 = attr1.getName(len);
verify_val(dattr_name1, "Attr", "Attribute::getName", __LINE__, __FILE__);
@@ -370,13 +377,11 @@ static void test_attr_getname()
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_getname()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_getname()
+} // test_attr_getname()
-
/*-------------------------------------------------------------------------
* Function: test_attr_rename
*
@@ -385,9 +390,10 @@ static void test_attr_getname()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_rename()
+static void
+test_attr_rename()
{
- int read_data1[ATTR1_DIM1]={0}; // Buffer for reading the attribute
+ int read_data1[ATTR1_DIM1] = {0}; // Buffer for reading the attribute
hsize_t i;
// Output message about test being performed
@@ -441,15 +447,16 @@ static void test_attr_rename()
verify_val(attr_name, ATTR_TMP_NAME, "Attribute::getName", __LINE__, __FILE__);
// Read attribute information immediately, without closing attribute
- attr1.read (PredType::NATIVE_INT, read_data1);
+ attr1.read(PredType::NATIVE_INT, read_data1);
// Verify values read in
- for(i=0; i<ATTR1_DIM1; i++)
- if(attr_data1[i]!=read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (attr_data1[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n", __LINE__,
+ i, attr_data1[i], i, read_data1[i]);
// Close attribute
- attr1.close();
+ attr1.close();
// Check for existence of second attribute
attr_exists = dataset.attrExists(ATTR2_NAME);
@@ -464,12 +471,13 @@ static void test_attr_rename()
verify_val(attr2_name, ATTR2_NAME, "Attribute::getName", __LINE__, __FILE__);
// Read attribute information immediately, without closing attribute
- attr2.read (PredType::NATIVE_INT, read_data1);
+ attr2.read(PredType::NATIVE_INT, read_data1);
// Verify values read in
- for(i=0; i<ATTR1_DIM1; i++)
- if(attr_data1a[i]!=read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1a[i],i,read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (attr_data1a[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d,read_data1[%d]=%d\n",
+ __LINE__, i, attr_data1a[i], i, read_data1[i]);
// Close attribute
attr2.close();
@@ -485,13 +493,11 @@ static void test_attr_rename()
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_rename()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_rename()
+} // test_attr_rename()
-
/*-------------------------------------------------------------------------
* Function: test_attr_basic_read
*
@@ -500,7 +506,8 @@ static void test_attr_rename()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_basic_read()
+static void
+test_attr_basic_read()
{
hsize_t i, j;
@@ -525,16 +532,17 @@ static void test_attr_basic_read()
verify_val(oinfo.num_attrs, 3, "DataSet::getObjinfo", __LINE__, __FILE__);
// Open an attribute for the dataset
- Attribute ds_attr=dataset.openAttribute(ATTR1_NAME);
+ Attribute ds_attr = dataset.openAttribute(ATTR1_NAME);
// Read attribute information
- int read_data1[ATTR1_DIM1]={0}; // Buffer for reading 1st attribute
+ int read_data1[ATTR1_DIM1] = {0}; // Buffer for reading 1st attribute
ds_attr.read(PredType::NATIVE_INT, &read_data1);
// Verify values read in
- for(i=0; i<ATTR1_DIM1; i++)
- if(attr_data1[i]!=read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (attr_data1[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",
+ __LINE__, i, attr_data1[i], i, read_data1[i]);
/*
* Test attribute with group
@@ -555,27 +563,27 @@ static void test_attr_basic_read()
Attribute gr_attr = group.openAttribute(ATTR2_NAME);
// Buffer for reading 2nd attribute
- int read_data2[ATTR2_DIM1][ATTR2_DIM2]={{0}};
+ int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}};
// Read attribute information
gr_attr.read(PredType::NATIVE_INT, read_data2);
// Verify values read in
- for(i=0; i<ATTR2_DIM1; i++)
- for(j=0; j<ATTR2_DIM2; j++)
- if(attr_data2[i][j]!=read_data2[i][j]) {
- TestErrPrintf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",__LINE__, i,j,attr_data2[i][j],i,j,read_data2[i][j]);
+ for (i = 0; i < ATTR2_DIM1; i++)
+ for (j = 0; j < ATTR2_DIM2; j++)
+ if (attr_data2[i][j] != read_data2[i][j]) {
+ TestErrPrintf(
+ "%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",
+ __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]);
}
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_basic_read()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_basic_read()
+} // test_attr_basic_read()
-
/*-------------------------------------------------------------------------
* Function: test_attr_compound_write
*
@@ -584,10 +592,11 @@ static void test_attr_basic_read()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_compound_write()
+static void
+test_attr_compound_write()
{
- // Output message about test being performed
+ // Output message about test being performed
SUBTEST("Multiple Attribute Functions");
try {
@@ -595,11 +604,11 @@ static void test_attr_compound_write()
H5File fid1(FILE_COMPOUND.c_str(), H5F_ACC_TRUNC);
// Create dataspace for dataset
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
DataSpace sid1(SPACE1_RANK, dims1);
// Create a dataset
- DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR,sid1);
+ DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, sid1);
// Create the attribute datatype.
CompType comp_type(sizeof(struct attr4_struct));
@@ -614,7 +623,7 @@ static void test_attr_compound_write()
comp_type.insertMember(ATTR4_FIELDNAME3, attr4_field3_off, PredType::NATIVE_SCHAR);
// Create dataspace for 1st attribute
- hsize_t dims2[] = {ATTR4_DIM1,ATTR4_DIM2};
+ hsize_t dims2[] = {ATTR4_DIM1, ATTR4_DIM2};
DataSpace sid2(ATTR4_RANK, dims2);
// Create complex attribute for the dataset
@@ -622,10 +631,11 @@ static void test_attr_compound_write()
// Try to create the same attribute again (should fail)
try {
- Attribute invalid_attr = dataset.createAttribute (ATTR4_NAME, comp_type, sid2);
+ Attribute invalid_attr = dataset.createAttribute(ATTR4_NAME, comp_type, sid2);
}
- catch (AttributeIException& E) // catching invalid creating attribute
- {} // do nothing, exception expected
+ catch (AttributeIException &E) // catching invalid creating attribute
+ {
+ } // do nothing, exception expected
// Write complex attribute data
attr.write(comp_type, attr_data4);
@@ -633,13 +643,11 @@ static void test_attr_compound_write()
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_compound_write()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_compound_write()
+} // test_attr_compound_write()
-
/*-------------------------------------------------------------------------
* Function: test_attr_compound_read
*
@@ -648,11 +656,12 @@ static void test_attr_compound_write()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_compound_read()
+static void
+test_attr_compound_read()
{
- hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions
- size_t size; // Attribute datatype size as stored in file
- size_t offset; // Attribute datatype field offset
+ hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions
+ size_t size; // Attribute datatype size as stored in file
+ size_t offset; // Attribute datatype field offset
struct attr4_struct read_data4[ATTR4_DIM1][ATTR4_DIM2]; // Buffer for reading 4th attribute
// Output message about test being performed
@@ -690,8 +699,8 @@ static void test_attr_compound_read()
// Get the dims of the dataspace and verify them
int ndims = space.getSimpleExtentDims(dims);
verify_val(ndims, ATTR4_RANK, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
- verify_val((long)dims[0], (long)ATTR4_DIM1, "DataSpace::getSimpleExtentDims",__LINE__, __FILE__);
- verify_val((long)dims[1], (long)ATTR4_DIM2, "DataSpace::getSimpleExtentDims",__LINE__, __FILE__);
+ verify_val((long)dims[0], (long)ATTR4_DIM1, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ verify_val((long)dims[1], (long)ATTR4_DIM2, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
// Get the class of the datatype that is used by attr
H5T_class_t type_class = attr.getTypeClass();
@@ -709,13 +718,11 @@ static void test_attr_compound_read()
// Verify that the fields have the same names as when the type
// was created
int j;
- for(j=0; j<fields; j++)
- {
+ for (j = 0; j < fields; j++) {
H5std_string fieldname = datatype.getMemberName(j);
- if(!((fieldname == ATTR4_FIELDNAME1) ||
- (fieldname == ATTR4_FIELDNAME2) ||
- (fieldname == ATTR4_FIELDNAME3)))
- TestErrPrintf("%d:invalid field name for field #%d: %s\n",__LINE__,j,fieldname.c_str());
+ if (!((fieldname == ATTR4_FIELDNAME1) || (fieldname == ATTR4_FIELDNAME2) ||
+ (fieldname == ATTR4_FIELDNAME3)))
+ TestErrPrintf("%d:invalid field name for field #%d: %s\n", __LINE__, j, fieldname.c_str());
} /* end for */
offset = datatype.getMemberOffset(0);
@@ -733,8 +740,8 @@ static void test_attr_compound_read()
type_class = datatype.getMemberClass(0);
verify_val(type_class, H5T_INTEGER, "DataType::getMemberClass", __LINE__, __FILE__);
// Get and verify the order of this member's type
- IntType i_type = datatype.getMemberIntType(0);
- H5T_order_t order = i_type.getOrder();
+ IntType i_type = datatype.getMemberIntType(0);
+ H5T_order_t order = i_type.getOrder();
verify_val(order, PredType::NATIVE_INT.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
// Get and verify the size of this member's type
@@ -745,7 +752,7 @@ static void test_attr_compound_read()
type_class = datatype.getMemberClass(1);
verify_val(type_class, H5T_FLOAT, "DataType::getMemberClass", __LINE__, __FILE__);
FloatType f_type = datatype.getMemberFloatType(1);
- order = f_type.getOrder();
+ order = f_type.getOrder();
verify_val(order, PredType::NATIVE_DOUBLE.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
size = f_type.getSize();
verify_val(size, PredType::NATIVE_DOUBLE.getSize(), "DataType::getSize", __LINE__, __FILE__);
@@ -756,7 +763,7 @@ static void test_attr_compound_read()
// Note: H5T_INTEGER is correct here!
StrType s_type = datatype.getMemberStrType(2);
- order = s_type.getOrder();
+ order = s_type.getOrder();
verify_val(order, PredType::NATIVE_SCHAR.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
size = s_type.getSize();
verify_val(size, PredType::NATIVE_SCHAR.getSize(), "DataType::getSize", __LINE__, __FILE__);
@@ -766,26 +773,30 @@ static void test_attr_compound_read()
// Verify values read in
hsize_t ii, jj;
- for(ii=0; ii<ATTR4_DIM1; ii++)
- for(jj=0; jj<ATTR4_DIM2; jj++)
- if(HDmemcmp(&attr_data4[ii][jj],&read_data4[ii][jj],sizeof(struct attr4_struct))) {
- TestErrPrintf("%d:attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].i=%d\n",__LINE__,ii,jj,attr_data4[ii][jj].i,ii,jj,read_data4[ii][jj].i);
- TestErrPrintf("%d:attribute data different: attr_data4[%d][%d].d=%f, read_data4[%d][%d].d=%f\n",__LINE__,ii,jj,attr_data4[ii][jj].d,ii,jj,read_data4[ii][jj].d);
- TestErrPrintf("%d:attribute data different: attr_data4[%d][%d].c=%c, read_data4[%d][%d].c=%c\n",__LINE__,ii,jj,attr_data4[ii][jj].c,ii,jj,read_data4[ii][jj].c);
- } /* end if */
+ for (ii = 0; ii < ATTR4_DIM1; ii++)
+ for (jj = 0; jj < ATTR4_DIM2; jj++)
+ if (HDmemcmp(&attr_data4[ii][jj], &read_data4[ii][jj], sizeof(struct attr4_struct))) {
+ TestErrPrintf(
+ "%d:attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].i=%d\n",
+ __LINE__, ii, jj, attr_data4[ii][jj].i, ii, jj, read_data4[ii][jj].i);
+ TestErrPrintf(
+ "%d:attribute data different: attr_data4[%d][%d].d=%f, read_data4[%d][%d].d=%f\n",
+ __LINE__, ii, jj, attr_data4[ii][jj].d, ii, jj, read_data4[ii][jj].d);
+ TestErrPrintf(
+ "%d:attribute data different: attr_data4[%d][%d].c=%c, read_data4[%d][%d].c=%c\n",
+ __LINE__, ii, jj, attr_data4[ii][jj].c, ii, jj, read_data4[ii][jj].c);
+ } /* end if */
// Verify name
H5std_string attr_name = attr.getName();
verify_val(attr_name, ATTR4_NAME, "Attribute::getName", __LINE__, __FILE__);
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_compound_read()", __LINE__, __FILE__, E.getCDetailMsg());
}
- try
- {
+ try {
// Now, try truncating the file to make sure reference counting is good.
// If any references to ids in the previous block are left unterminated,
// the truncating will fail, because the file will not be closed in
@@ -795,13 +806,12 @@ static void test_attr_compound_read()
PASSED();
} // end try block
- catch (FileIException& E)
- {
- issue_fail_msg("test_attr_compound_read()", __LINE__, __FILE__, "Unable to truncate file, possibly because some objects are left opened");
+ catch (FileIException &E) {
+ issue_fail_msg("test_attr_compound_read()", __LINE__, __FILE__,
+ "Unable to truncate file, possibly because some objects are left opened");
}
-} // test_attr_compound_read()
+} // test_attr_compound_read()
-
/*-------------------------------------------------------------------------
* Function: test_attr_scalar_write
*
@@ -810,7 +820,8 @@ static void test_attr_compound_read()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_scalar_write()
+static void
+test_attr_scalar_write()
{
// Output message about test being performed
SUBTEST("Basic Scalar Attribute Writing Functions");
@@ -820,11 +831,11 @@ static void test_attr_scalar_write()
H5File fid1(FILE_SCALAR, H5F_ACC_TRUNC);
// Create dataspace for dataset
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
DataSpace sid1(SPACE1_RANK, dims1);
// Create a dataset
- DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR,sid1);
+ DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, sid1);
// Close dataset's dataspace
sid1.close();
@@ -833,34 +844,34 @@ static void test_attr_scalar_write()
DataSpace att_space(ATTR5_RANK, NULL);
// Create an attribute for the dataset
- Attribute ds_attr = dataset.createAttribute (ATTR5_NAME, PredType::NATIVE_FLOAT, att_space);
+ Attribute ds_attr = dataset.createAttribute(ATTR5_NAME, PredType::NATIVE_FLOAT, att_space);
// Try creating an attribute that already exists. This should fail
// since two attributes cannot have the same name. If an exception
// is not thrown for this action by createAttribute, then throw an
// invalid action exception.
try {
- Attribute invalid_attr = dataset.createAttribute (ATTR5_NAME, PredType::NATIVE_FLOAT, att_space);
+ Attribute invalid_attr = dataset.createAttribute(ATTR5_NAME, PredType::NATIVE_FLOAT, att_space);
// continuation here, that means no exception has been thrown
- throw InvalidActionException("H5File::createDataSet", "Library allowed overwrite of existing dataset");
+ throw InvalidActionException("H5File::createDataSet",
+ "Library allowed overwrite of existing dataset");
}
- catch (AttributeIException& E) // catching invalid creating attribute
- {} // do nothing, exception expected
+ catch (AttributeIException &E) // catching invalid creating attribute
+ {
+ } // do nothing, exception expected
// Write attribute information
- ds_attr.write (PredType::NATIVE_FLOAT, &attr_data5);
+ ds_attr.write(PredType::NATIVE_FLOAT, &attr_data5);
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_scalar_write()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_scalar_write()
+} // test_attr_scalar_write()
-
/*-------------------------------------------------------------------------
* Function: test_attr_scalar_read
*
@@ -872,7 +883,8 @@ static void test_attr_scalar_write()
/* Epsilon for floating-point comparisons */
#define FP_EPSILON 0.000001F
-static void test_attr_scalar_read()
+static void
+test_attr_scalar_read()
{
// Output message about test being performed
SUBTEST("Basic Scalar Attribute Reading Functions");
@@ -889,11 +901,11 @@ static void test_attr_scalar_read()
verify_val(num_attrs, 1, "DataSet::getNumAttrs", __LINE__, __FILE__);
// Open an attribute for the dataset
- Attribute ds_attr=dataset.openAttribute(ATTR5_NAME);
+ Attribute ds_attr = dataset.openAttribute(ATTR5_NAME);
// Read attribute information
- float read_data2=0.0; // Buffer for reading 1st attribute
- ds_attr.read(PredType::NATIVE_FLOAT,&read_data2);
+ float read_data2 = 0.0; // Buffer for reading 1st attribute
+ ds_attr.read(PredType::NATIVE_FLOAT, &read_data2);
if (HDfabs(read_data2 - attr_data5) > FP_EPSILON)
verify_val(read_data2, attr_data5, FP_EPSILON, "Attribute::read", __LINE__, __FILE__);
@@ -907,13 +919,11 @@ static void test_attr_scalar_read()
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_scalar_read()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_scalar_read()
+} // test_attr_scalar_read()
-
/*-------------------------------------------------------------------------
* Function: test_attr_mult_write
*
@@ -922,75 +932,76 @@ static void test_attr_scalar_read()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_mult_write()
+static void
+test_attr_mult_write()
{
// Output message about test being performed
SUBTEST("Multiple Attribute Writing Functions");
try {
// Create file
- H5File fid1 (FILE_MULTI, H5F_ACC_TRUNC);
+ H5File fid1(FILE_MULTI, H5F_ACC_TRUNC);
// Create dataspace for dataset
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- DataSpace ds_space (SPACE1_RANK, dims1);
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ DataSpace ds_space(SPACE1_RANK, dims1);
// Create a dataset
DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, ds_space);
// Create dataspace for 1st attribute
- hsize_t dims2[] = {ATTR1_DIM1};
- DataSpace att_space (ATTR1_RANK, dims2);
+ hsize_t dims2[] = {ATTR1_DIM1};
+ DataSpace att_space(ATTR1_RANK, dims2);
// Create 1st attribute for the dataset
- Attribute ds_attr = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space);
+ Attribute ds_attr = dataset.createAttribute(ATTR1_NAME, PredType::NATIVE_INT, att_space);
// Write attribute information
- ds_attr.write (PredType::NATIVE_INT, attr_data1);
+ ds_attr.write(PredType::NATIVE_INT, attr_data1);
// Create dataspace for 2nd attribute
- hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2};
- DataSpace att2_space (ATTR2_RANK, dims3);
+ hsize_t dims3[] = {ATTR2_DIM1, ATTR2_DIM2};
+ DataSpace att2_space(ATTR2_RANK, dims3);
// Create 2nd attribute for the dataset
- Attribute ds_attr2 = dataset.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, att2_space);
+ Attribute ds_attr2 = dataset.createAttribute(ATTR2_NAME, PredType::NATIVE_INT, att2_space);
// Write 2nd attribute information
- ds_attr2.write (PredType::NATIVE_INT, attr_data2);
+ ds_attr2.write(PredType::NATIVE_INT, attr_data2);
// Create dataspace for 3rd attribute
- hsize_t dims4[] = {ATTR3_DIM1,ATTR3_DIM2,ATTR3_DIM3};
- DataSpace att3_space (ATTR3_RANK, dims4);
+ hsize_t dims4[] = {ATTR3_DIM1, ATTR3_DIM2, ATTR3_DIM3};
+ DataSpace att3_space(ATTR3_RANK, dims4);
// Create 3rd attribute for the dataset
- Attribute ds_attr3 = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_DOUBLE, att3_space);
+ Attribute ds_attr3 = dataset.createAttribute(ATTR3_NAME, PredType::NATIVE_DOUBLE, att3_space);
// Try creating an attribute that already exists. This should fail
// since two attributes cannot have the same name. If an exception
// is not thrown for this action by createAttribute, then throw an
// invalid action exception.
try {
- Attribute invalid_attr = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_DOUBLE, att3_space);
+ Attribute invalid_attr = dataset.createAttribute(ATTR3_NAME, PredType::NATIVE_DOUBLE, att3_space);
// continuation here, that means no exception has been thrown
- throw InvalidActionException("DataSet::createAttribute", "Attempting to create a duplicate attribute");
+ throw InvalidActionException("DataSet::createAttribute",
+ "Attempting to create a duplicate attribute");
}
- catch (AttributeIException& E) // catching invalid creating attribute
- {} // do nothing, exception expected
+ catch (AttributeIException &E) // catching invalid creating attribute
+ {
+ } // do nothing, exception expected
// Write 3rd attribute information
- ds_attr3.write (PredType::NATIVE_DOUBLE, attr_data3);
+ ds_attr3.write(PredType::NATIVE_DOUBLE, attr_data3);
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_mult_write()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_mult_write()
+} // test_attr_mult_write()
-
/*-------------------------------------------------------------------------
* Function: test_attr_mult_read
*
@@ -999,14 +1010,15 @@ static void test_attr_mult_write()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_mult_read()
+static void
+test_attr_mult_read()
{
- int read_data1[ATTR1_DIM1]={0}; // Buffer for reading 1st attribute
- int read_data2[ATTR2_DIM1][ATTR2_DIM2]={{0}}; // Buffer for reading 2nd attribute
- double read_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3]={{{0}}}; // Buffer for reading 3rd attribute
- hsize_t i,j,k;
+ int read_data1[ATTR1_DIM1] = {0}; // Buffer for reading 1st attribute
+ int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; // Buffer for reading 2nd attribute
+ double read_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = {{{0}}}; // Buffer for reading 3rd attribute
+ hsize_t i, j, k;
- // Output message about test being performed
+ // Output message about test being performed
SUBTEST("Multiple Attribute Reading Functions");
try {
@@ -1033,10 +1045,11 @@ static void test_attr_mult_read()
verify_val(rank, ATTR1_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
// Get the dims of the dataspace and verify them
- hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions
- int ndims = space.getSimpleExtentDims(dims);
+ hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions
+ int ndims = space.getSimpleExtentDims(dims);
if ((long)dims[0] != (long)ATTR1_DIM1)
- TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %d\n",__LINE__,(int)dims[0],ATTR1_DIM1);
+ TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %d\n", __LINE__,
+ (int)dims[0], ATTR1_DIM1);
/* Verify Datatype */
@@ -1046,7 +1059,7 @@ static void test_attr_mult_read()
// Verify that the type is of integer datatype
verify_val(type_class, H5T_INTEGER, "Attribute::getTypeClass", __LINE__, __FILE__);
- // Get the integer datatype
+ // Get the integer datatype
IntType i_type1 = attr.getIntType();
// Get and verify the order of this type
@@ -1061,9 +1074,10 @@ static void test_attr_mult_read()
attr.read(PredType::NATIVE_INT, read_data1);
// Verify values read in
- for(i=0; i<ATTR1_DIM1; i++)
- if(attr_data1[i]!=read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]);
+ for (i = 0; i < ATTR1_DIM1; i++)
+ if (attr_data1[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n", __LINE__,
+ i, attr_data1[i], i, read_data1[i]);
// Verify Name
H5std_string attr_name = attr.getName();
@@ -1087,8 +1101,8 @@ static void test_attr_mult_read()
// Get the dims of the dataspace and verify them
ndims = space.getSimpleExtentDims(dims);
- verify_val((long)dims[0], (long)ATTR2_DIM1, "DataSpace::getSimpleExtentDims",__LINE__, __FILE__);
- verify_val((long)dims[1], (long)ATTR2_DIM2, "DataSpace::getSimpleExtentDims",__LINE__, __FILE__);
+ verify_val((long)dims[0], (long)ATTR2_DIM1, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ verify_val((long)dims[1], (long)ATTR2_DIM2, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
/* Verify Datatype */
@@ -1098,7 +1112,7 @@ static void test_attr_mult_read()
// Verify that the type is of integer datatype
verify_val(type_class, H5T_INTEGER, "Attribute::getTypeClass", __LINE__, __FILE__);
- // Get the integer datatype
+ // Get the integer datatype
IntType i_type2 = attr.getIntType();
// Get and verify the order of this type
@@ -1111,13 +1125,15 @@ static void test_attr_mult_read()
// Read attribute information
attr.read(PredType::NATIVE_INT, read_data2);
- //attr.read(i_type, read_data2);
+ // attr.read(i_type, read_data2);
// Verify values read in
- for(i=0; i<ATTR2_DIM1; i++)
- for(j=0; j<ATTR2_DIM2; j++)
- if(attr_data2[i][j]!=read_data2[i][j])
- TestErrPrintf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",__LINE__,i,j,attr_data2[i][j],i,j,read_data2[i][j]);
+ for (i = 0; i < ATTR2_DIM1; i++)
+ for (j = 0; j < ATTR2_DIM2; j++)
+ if (attr_data2[i][j] != read_data2[i][j])
+ TestErrPrintf(
+ "%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",
+ __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]);
// Verify Name
attr_name = attr.getName();
@@ -1139,9 +1155,9 @@ static void test_attr_mult_read()
// Get the dims of the dataspace and verify them
ndims = space.getSimpleExtentDims(dims);
- verify_val((long)dims[0],(long)ATTR3_DIM1,"attribute dimensions",__FILE__,__LINE__);
- verify_val((long)dims[1],(long)ATTR3_DIM2,"attribute dimensions",__FILE__,__LINE__);
- verify_val((long)dims[2],(long)ATTR3_DIM3,"attribute dimensions",__FILE__,__LINE__);
+ verify_val((long)dims[0], (long)ATTR3_DIM1, "attribute dimensions", __FILE__, __LINE__);
+ verify_val((long)dims[1], (long)ATTR3_DIM2, "attribute dimensions", __FILE__, __LINE__);
+ verify_val((long)dims[2], (long)ATTR3_DIM3, "attribute dimensions", __FILE__, __LINE__);
/* Verify Datatype */
@@ -1151,7 +1167,7 @@ static void test_attr_mult_read()
// Verify that the type is of compound datatype
verify_val(type_class, H5T_FLOAT, "Attribute::getTypeClass", __LINE__, __FILE__);
- // Get the double datatype
+ // Get the double datatype
FloatType f_type = attr.getFloatType();
// Get and verify the order of this type
@@ -1166,11 +1182,13 @@ static void test_attr_mult_read()
attr.read(PredType::NATIVE_DOUBLE, read_data3);
// Verify values read in
- for(i=0; i<ATTR3_DIM1; i++)
- for(j=0; j<ATTR3_DIM2; j++)
- for(k=0; k<ATTR3_DIM3; k++)
- if(attr_data3[i][j][k]!=read_data3[i][j][k])
- TestErrPrintf("%d: attribute data different: attr_data3[%d][%d][%d]=%f, read_data3[%d][%d][%d]=%f\n",__LINE__,i,j,k,attr_data3[i][j][k],i,j,k,read_data3[i][j][k]);
+ for (i = 0; i < ATTR3_DIM1; i++)
+ for (j = 0; j < ATTR3_DIM2; j++)
+ for (k = 0; k < ATTR3_DIM3; k++)
+ if (attr_data3[i][j][k] != read_data3[i][j][k])
+ TestErrPrintf("%d: attribute data different: attr_data3[%d][%d][%d]=%f, "
+ "read_data3[%d][%d][%d]=%f\n",
+ __LINE__, i, j, k, attr_data3[i][j][k], i, j, k, read_data3[i][j][k]);
// Verify Name
attr_name = attr.getName();
@@ -1179,13 +1197,11 @@ static void test_attr_mult_read()
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_mult_read()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_mult_read()
+} // test_attr_mult_read()
-
/*-------------------------------------------------------------------------
* Function: test_attr_delete
*
@@ -1194,9 +1210,10 @@ static void test_attr_mult_read()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_delete()
+static void
+test_attr_delete()
{
- H5std_string attr_name; // Buffer for attribute names
+ H5std_string attr_name; // Buffer for attribute names
// Output message about test being performed
SUBTEST("Removing Attribute Function");
@@ -1218,7 +1235,7 @@ static void test_attr_delete()
// Verify the name of the only file attribute left
Attribute fattr = fid1.openAttribute((unsigned)0);
- attr_name = fattr.getName();
+ attr_name = fattr.getName();
verify_val(attr_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
fattr.close();
@@ -1236,10 +1253,12 @@ static void test_attr_delete()
dataset.removeAttr("Bogus");
// continuation here, that means no exception has been thrown
- throw InvalidActionException("DataSet::removeAttr", "Attempting to remove non-existing attribute");
+ throw InvalidActionException("DataSet::removeAttr",
+ "Attempting to remove non-existing attribute");
}
- catch (AttributeIException& E) // catching invalid removing attribute
- {} // do nothing, exception expected
+ catch (AttributeIException &E) // catching invalid removing attribute
+ {
+ } // do nothing, exception expected
// Test deleting dataset's attributes
@@ -1299,13 +1318,11 @@ static void test_attr_delete()
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_delete()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_delete()
+} // test_attr_delete()
-
/*-------------------------------------------------------------------------
* Function: test_attr_dtype_shared
*
@@ -1314,14 +1331,15 @@ static void test_attr_delete()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_dtype_shared()
+static void
+test_attr_dtype_shared()
{
- int data=8; // Data to write
- int rdata=0; // Data read in
+ int data = 8; // Data to write
+ int rdata = 0; // Data read in
#ifndef H5_NO_DEPRECATED_SYMBOLS
- H5G_stat_t statbuf; // Object's information
+ H5G_stat_t statbuf; // Object's information
#endif
- h5_stat_size_t filesize; // Size of file after modifications
+ h5_stat_size_t filesize; // Size of file after modifications
// Output message about test being performed
SUBTEST("Shared Datatypes with Attributes");
@@ -1334,7 +1352,7 @@ static void test_attr_dtype_shared()
fid1.close();
// Get size of file
- h5_stat_size_t empty_filesize; // Size of empty file
+ h5_stat_size_t empty_filesize; // Size of empty file
empty_filesize = h5_get_file_size(FILE_DTYPE.c_str(), H5P_DEFAULT);
if (empty_filesize < 0)
TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
@@ -1347,67 +1365,68 @@ static void test_attr_dtype_shared()
// scope, causing incorrect number of ref counts.
{ // First enclosed block
- // Create a datatype to commit and use
- IntType dtype(PredType::NATIVE_INT);
+ // Create a datatype to commit and use
+ IntType dtype(PredType::NATIVE_INT);
- // Commit datatype to file
- dtype.commit(fid1, TYPE1_NAME);
+ // Commit datatype to file
+ dtype.commit(fid1, TYPE1_NAME);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Check reference count on named datatype
- fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 1, "DataType::getObjinfo", __LINE__, __FILE__);
+ // Check reference count on named datatype
+ fid1.getObjinfo(TYPE1_NAME, statbuf);
+ verify_val((int)statbuf.nlink, 1, "DataType::getObjinfo", __LINE__, __FILE__);
#endif
- // Create dataspace for dataset
- DataSpace dspace;
+ // Create dataspace for dataset
+ DataSpace dspace;
- DataSet dset = fid1.createDataSet(DSET1_NAME, dtype, dspace);
+ DataSet dset = fid1.createDataSet(DSET1_NAME, dtype, dspace);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Check reference count on named datatype
- fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 2, "H5File::getObjinfo", __LINE__, __FILE__);
+ // Check reference count on named datatype
+ fid1.getObjinfo(TYPE1_NAME, statbuf);
+ verify_val((int)statbuf.nlink, 2, "H5File::getObjinfo", __LINE__, __FILE__);
#endif
- // Create attribute on dataset
- Attribute attr = dset.createAttribute(ATTR1_NAME,dtype,dspace);
+ // Create attribute on dataset
+ Attribute attr = dset.createAttribute(ATTR1_NAME, dtype, dspace);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Check reference count on named datatype
- fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 3, "DataSet::getObjinfo", __LINE__, __FILE__);
+ // Check reference count on named datatype
+ fid1.getObjinfo(TYPE1_NAME, statbuf);
+ verify_val((int)statbuf.nlink, 3, "DataSet::getObjinfo", __LINE__, __FILE__);
#endif
- // Close attribute
- attr.close();
+ // Close attribute
+ attr.close();
- // Delete attribute
- dset.removeAttr(ATTR1_NAME);
+ // Delete attribute
+ dset.removeAttr(ATTR1_NAME);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Check reference count on named datatype
- fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 2, "DataSet::getObjinfo after DataSet::removeAttr", __LINE__, __FILE__);
+ // Check reference count on named datatype
+ fid1.getObjinfo(TYPE1_NAME, statbuf);
+ verify_val((int)statbuf.nlink, 2, "DataSet::getObjinfo after DataSet::removeAttr", __LINE__,
+ __FILE__);
#endif
- // Create attribute on dataset
- attr = dset.createAttribute(ATTR1_NAME,dtype,dspace);
+ // Create attribute on dataset
+ attr = dset.createAttribute(ATTR1_NAME, dtype, dspace);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Check reference count on named datatype
- fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 3, "DataSet::createAttribute", __LINE__, __FILE__);
+ // Check reference count on named datatype
+ fid1.getObjinfo(TYPE1_NAME, statbuf);
+ verify_val((int)statbuf.nlink, 3, "DataSet::createAttribute", __LINE__, __FILE__);
#endif
- // Write data into the attribute
- attr.write(PredType::NATIVE_INT,&data);
+ // Write data into the attribute
+ attr.write(PredType::NATIVE_INT, &data);
- // Close attribute, dataset, dataspace, datatype, and file
- attr.close();
- dset.close();
- dspace.close();
- dtype.close();
+ // Close attribute, dataset, dataspace, datatype, and file
+ attr.close();
+ dset.close();
+ dspace.close();
+ dtype.close();
} // end of first enclosing
fid1.close();
@@ -1417,24 +1436,24 @@ static void test_attr_dtype_shared()
{ // Second enclosed block...
- // Open dataset
- DataSet *dset2 = new DataSet (fid1.openDataSet(DSET1_NAME));
+ // Open dataset
+ DataSet *dset2 = new DataSet(fid1.openDataSet(DSET1_NAME));
- // Open attribute
- Attribute *attr2 = new Attribute (dset2->openAttribute(ATTR1_NAME));
+ // Open attribute
+ Attribute *attr2 = new Attribute(dset2->openAttribute(ATTR1_NAME));
- // Read data from the attribute
- attr2->read(PredType::NATIVE_INT, &rdata);
- verify_val(data, rdata, "Attribute::read", __LINE__, __FILE__);
+ // Read data from the attribute
+ attr2->read(PredType::NATIVE_INT, &rdata);
+ verify_val(data, rdata, "Attribute::read", __LINE__, __FILE__);
- // Close attribute and dataset
- delete attr2;
- delete dset2;
+ // Close attribute and dataset
+ delete attr2;
+ delete dset2;
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Check reference count on named datatype
- fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 3, "DataSet::openAttribute", __LINE__, __FILE__);
+ // Check reference count on named datatype
+ fid1.getObjinfo(TYPE1_NAME, statbuf);
+ verify_val((int)statbuf.nlink, 3, "DataSet::openAttribute", __LINE__, __FILE__);
#endif
} // end of second enclosing
@@ -1458,15 +1477,13 @@ static void test_attr_dtype_shared()
verify_val((long)filesize, (long)empty_filesize, "Checking file size", __LINE__, __FILE__);
PASSED();
- } // end try block
+ } // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_dtype_shared()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_dtype_shared()
+} // test_attr_dtype_shared()
-
/*-------------------------------------------------------------------------
* Function: test_string_attr
*
@@ -1480,9 +1497,10 @@ const H5std_string ATTR1_FL_STR_NAME("String_attr 1");
const H5std_string ATTR2_FL_STR_NAME("String_attr 2");
const H5std_string ATTR_VL_STR_NAME("String_attr");
const H5std_string ATTRSTR_DATA("String Attribute");
-const int ATTR_LEN = 17;
+const int ATTR_LEN = 17;
-static void test_string_attr()
+static void
+test_string_attr()
{
// Output message about test being performed
SUBTEST("I/O on FL and VL String Attributes");
@@ -1501,7 +1519,7 @@ static void test_string_attr()
Group root = fid1.openGroup("/");
// Create dataspace for the attribute.
- DataSpace att_space (H5S_SCALAR);
+ DataSpace att_space(H5S_SCALAR);
/* Test Attribute::write(...,const void *buf) with Fixed len string */
@@ -1524,18 +1542,20 @@ static void test_string_attr()
// Read and verify the attribute string as a string of chars.
char flstring_att_check[ATTR_LEN];
gr_flattr1.read(fls_type, flstring_att_check);
- if(HDstrcmp(flstring_att_check, ATTRSTR_DATA.c_str())!=0)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), flstring_att_check);
+ if (HDstrcmp(flstring_att_check, ATTRSTR_DATA.c_str()) != 0)
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",
+ __LINE__, ATTRSTR_DATA.c_str(), flstring_att_check);
// Read and verify the attribute string as a string of chars; buffer
// is dynamically allocated.
size_t attr_size = gr_flattr1.getInMemDataSize();
- char *fl_dyn_string_att_check;
- fl_dyn_string_att_check = new char[attr_size+1];
+ char * fl_dyn_string_att_check;
+ fl_dyn_string_att_check = new char[attr_size + 1];
gr_flattr1.read(fls_type, fl_dyn_string_att_check);
- if(HDstrcmp(fl_dyn_string_att_check, ATTRSTR_DATA.c_str())!=0)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), fl_dyn_string_att_check);
- delete []fl_dyn_string_att_check;
+ if (HDstrcmp(fl_dyn_string_att_check, ATTRSTR_DATA.c_str()) != 0)
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",
+ __LINE__, ATTRSTR_DATA.c_str(), fl_dyn_string_att_check);
+ delete[] fl_dyn_string_att_check;
/* Test Attribute::read(...,H5std_string& strg) with FL string */
@@ -1543,13 +1563,15 @@ static void test_string_attr()
H5std_string read_flstr1;
gr_flattr1.read(fls_type, read_flstr1);
if (read_flstr1 != ATTRSTR_DATA)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_flstr1=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_flstr1.c_str());
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_flstr1=%s\n", __LINE__,
+ ATTRSTR_DATA.c_str(), read_flstr1.c_str());
// Read and verify the attribute string as a string of chars.
HDstrcpy(flstring_att_check, "");
gr_flattr2.read(fls_type, flstring_att_check);
- if(HDstrcmp(flstring_att_check, ATTRSTR_DATA.c_str())!=0)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), flstring_att_check);
+ if (HDstrcmp(flstring_att_check, ATTRSTR_DATA.c_str()) != 0)
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",
+ __LINE__, ATTRSTR_DATA.c_str(), flstring_att_check);
/* Test Attribute::read(...,H5std_string& strg) with FL string */
@@ -1557,7 +1579,8 @@ static void test_string_attr()
H5std_string read_flstr2;
gr_flattr2.read(fls_type, read_flstr2);
if (read_flstr2 != ATTRSTR_DATA)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_flstr2=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_flstr2.c_str());
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_flstr2=%s\n", __LINE__,
+ ATTRSTR_DATA.c_str(), read_flstr2.c_str());
//
// Variable-lenth string attributes
@@ -1575,8 +1598,9 @@ static void test_string_attr()
// Read and verify the attribute string as a string of chars.
char *string_att_check;
gr_vlattr.read(vls_type, &string_att_check);
- if(HDstrcmp(string_att_check, ATTRSTR_DATA.c_str())!=0)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,string_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), string_att_check);
+ if (HDstrcmp(string_att_check, ATTRSTR_DATA.c_str()) != 0)
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,string_att_check=%s\n",
+ __LINE__, ATTRSTR_DATA.c_str(), string_att_check);
HDfree(string_att_check);
/* Test Attribute::read(...,H5std_string& strg) with VL string */
@@ -1584,17 +1608,16 @@ static void test_string_attr()
H5std_string read_str;
gr_vlattr.read(vls_type, read_str);
if (read_str != ATTRSTR_DATA)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_str=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_str.c_str());
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_str=%s\n", __LINE__,
+ ATTRSTR_DATA.c_str(), read_str.c_str());
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_string_attr()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_string_attr()
+} // test_string_attr()
-
/*-------------------------------------------------------------------------
* Function: test_attr_exists
*
@@ -1606,7 +1629,8 @@ static void test_string_attr()
* Additional attrExists tests are in test_attr_rename().
*-------------------------------------------------------------------------
*/
-static void test_attr_exists()
+static void
+test_attr_exists()
{
// Output message about test being performed
SUBTEST("Check Attribute Existence");
@@ -1621,12 +1645,14 @@ static void test_attr_exists()
// Check for existence of attribute
bool attr_exists = fid1.attrExists(ATTR1_FL_STR_NAME);
if (attr_exists == false)
- throw InvalidActionException("H5File::attrExists", "fid1, ATTR1_FL_STR_NAMEAttribute should exist but does not");
+ throw InvalidActionException("H5File::attrExists",
+ "fid1, ATTR1_FL_STR_NAMEAttribute should exist but does not");
// Check for existence of attribute
attr_exists = fid1.attrExists(FATTR1_NAME);
if (attr_exists == false)
- throw InvalidActionException("H5File::attrExists", "fid1,FATTR2_NAMEAttribute should exist but does not");
+ throw InvalidActionException("H5File::attrExists",
+ "fid1,FATTR2_NAMEAttribute should exist but does not");
// Open a group.
Group group = fid1.openGroup(GROUP1_NAME);
@@ -1634,22 +1660,20 @@ static void test_attr_exists()
// Check for existence of attribute
attr_exists = group.attrExists(ATTR2_NAME);
if (attr_exists == false)
- throw InvalidActionException("H5File::attrExists", "group, ATTR2_NAMEAttribute should exist but does not");
+ throw InvalidActionException("H5File::attrExists",
+ "group, ATTR2_NAMEAttribute should exist but does not");
PASSED();
} // end try block
- catch (InvalidActionException& E)
- {
+ catch (InvalidActionException &E) {
issue_fail_msg("test_attr_exists()", __LINE__, __FILE__, E.getCDetailMsg());
}
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_exists()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_exists()
+} // test_attr_exists()
-
/*-------------------------------------------------------------------------
* Function: test_attr_dense_create
*
@@ -1659,25 +1683,25 @@ static void test_attr_exists()
*-------------------------------------------------------------------------
*/
const H5std_string FILE_CRTPROPS("tattr_crt_properties.h5");
-const int NAME_BUF_SIZE = 1024;
-const unsigned MAX_COMPACT_DEF = 8;
-const unsigned MIN_DENSE_DEF = 6;
+const int NAME_BUF_SIZE = 1024;
+const unsigned MAX_COMPACT_DEF = 8;
+const unsigned MIN_DENSE_DEF = 6;
-static void test_attr_dense_create(FileCreatPropList& fcpl,
- FileAccPropList& fapl)
+static void
+test_attr_dense_create(FileCreatPropList &fcpl, FileAccPropList &fapl)
{
// Output message about test being performed
SUBTEST("Dense Attribute Storage Creation");
try {
// Create file
- H5File fid1 (FILE_CRTPROPS, H5F_ACC_TRUNC, fcpl, fapl);
+ H5File fid1(FILE_CRTPROPS, H5F_ACC_TRUNC, fcpl, fapl);
// Close file
fid1.close();
// Get size of file
- h5_stat_size_t empty_filesize; // Size of empty file
+ h5_stat_size_t empty_filesize; // Size of empty file
empty_filesize = h5_get_file_size(FILE_CRTPROPS.c_str(), fapl.getId());
if (empty_filesize < 0)
TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
@@ -1698,16 +1722,18 @@ static void test_attr_dense_create(FileCreatPropList& fcpl,
// Retrieve limits for compact/dense attribute storage
dcpl.getAttrPhaseChange(max_compact, min_dense);
- verify_val(max_compact, MAX_COMPACT_DEF, "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__);
- verify_val(min_dense, MIN_DENSE_DEF, "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__);
+ verify_val(max_compact, MAX_COMPACT_DEF, "DSetCreatPropList::getAttrPhaseChange", __LINE__, __FILE__);
+ verify_val(min_dense, MIN_DENSE_DEF, "DSetCreatPropList::getAttrPhaseChange", __LINE__, __FILE__);
// Set new compact/dense attribute storage limits to some random numbers
dcpl.setAttrPhaseChange(7, 5);
// Retrieve limits for compact/dense attribute storage and verify them
dcpl.getAttrPhaseChange(max_compact, min_dense);
- verify_val(max_compact, static_cast<unsigned>(7), "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__);
- verify_val(min_dense, static_cast<unsigned>(5), "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__);
+ verify_val(max_compact, static_cast<unsigned>(7), "DSetCreatPropList::getAttrPhaseChange", __LINE__,
+ __FILE__);
+ verify_val(min_dense, static_cast<unsigned>(5), "DSetCreatPropList::getAttrPhaseChange", __LINE__,
+ __FILE__);
// Close property list
dcpl.close();
@@ -1715,10 +1741,9 @@ static void test_attr_dense_create(FileCreatPropList& fcpl,
// H5O__is_attr_dense_test - un-usable
// Add attributes, until just before converting to dense storage
- char attr_name[NAME_BUF_SIZE];
+ char attr_name[NAME_BUF_SIZE];
unsigned attr_num;
- for (attr_num = 0; attr_num < max_compact; attr_num++)
- {
+ for (attr_num = 0; attr_num < max_compact; attr_num++) {
// Create attribute
sprintf(attr_name, "attr %02u", attr_num);
Attribute attr = dataset.createAttribute(attr_name, PredType::NATIVE_UINT, ds_space);
@@ -1740,28 +1765,27 @@ static void test_attr_dense_create(FileCreatPropList& fcpl,
}
// Attempt to add attribute again, which should fail
- try
- {
+ try {
// Create another attribute
sprintf(attr_name, "attr %02u", attr_num);
Attribute attr = dataset.createAttribute(attr_name, PredType::NATIVE_UINT, ds_space);
// continuation here, that means no exception has been thrown
- throw InvalidActionException("DataSet::createAttribute", "Maximum number of attributes has been reached");
+ throw InvalidActionException("DataSet::createAttribute",
+ "Maximum number of attributes has been reached");
}
- catch (AttributeIException& E) // catching invalid action
- {} // do nothing, exception expected
+ catch (AttributeIException &E) // catching invalid action
+ {
+ } // do nothing, exception expected
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_dense_create()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_dense_create()
+} // test_attr_dense_create()
-
/*-------------------------------------------------------------------------
* Function: test_attr_corder_create_basic
*
@@ -1770,23 +1794,23 @@ static void test_attr_dense_create(FileCreatPropList& fcpl,
* Return None
*-------------------------------------------------------------------------
*/
-static void test_attr_corder_create_basic(FileCreatPropList& fcpl,
- FileAccPropList& fapl)
+static void
+test_attr_corder_create_basic(FileCreatPropList &fcpl, FileAccPropList &fapl)
{
// Output message about test being performed
SUBTEST("Basic Code for Attributes with Creation Order Info");
try {
// Create file
- H5File fid1 (FILE_CRTPROPS, H5F_ACC_TRUNC, fcpl, fapl);
+ H5File fid1(FILE_CRTPROPS, H5F_ACC_TRUNC, fcpl, fapl);
// Create dataset creation property list.
DSetCreatPropList dcpl;
// Get creation order indexing on object
unsigned crt_order_flags = 0;
- crt_order_flags = dcpl.getAttrCrtOrder();
- verify_val(crt_order_flags, (unsigned)0, "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
+ crt_order_flags = dcpl.getAttrCrtOrder();
+ verify_val(crt_order_flags, (unsigned)0, "DSetCreatPropList::getAttrCrtOrder", __LINE__, __FILE__);
// Setting invalid combination of a attribute order creation order
// indexing on should fail
@@ -1794,16 +1818,19 @@ static void test_attr_corder_create_basic(FileCreatPropList& fcpl,
dcpl.setAttrCrtOrder(H5P_CRT_ORDER_INDEXED);
// continuation here, that means no exception has been thrown
- throw InvalidActionException("DSetCreatPropList::getAttrCrtOrder", "Indexing cannot be set alone, order tracking is required");
+ throw InvalidActionException("DSetCreatPropList::getAttrCrtOrder",
+ "Indexing cannot be set alone, order tracking is required");
}
- catch (PropListIException& E) // catching invalid action
- {} // do nothing, exception expected
+ catch (PropListIException &E) // catching invalid action
+ {
+ } // do nothing, exception expected
// Set attribute creation order tracking & indexing for object then
// verify them
dcpl.setAttrCrtOrder(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED);
crt_order_flags = dcpl.getAttrCrtOrder();
- verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
+ verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED),
+ "DSetCreatPropList::getAttrCrtOrder", __LINE__, __FILE__);
// Create dataspace for dataset
DataSpace ds_space(H5S_SCALAR);
@@ -1838,18 +1865,17 @@ static void test_attr_corder_create_basic(FileCreatPropList& fcpl,
// Query the attribute creation properties
crt_order_flags = dcpl.getAttrCrtOrder();
- verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
+ verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED),
+ "DSetCreatPropList::getAttrCrtOrder", __LINE__, __FILE__);
PASSED();
} // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr_corder_create_basic()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr_corder_create_basic()
+} // test_attr_corder_create_basic()
-
/*-------------------------------------------------------------------------
* Function: test_attr
*
@@ -1858,14 +1884,13 @@ static void test_attr_corder_create_basic(FileCreatPropList& fcpl,
* Return None
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_attr()
+extern "C" void
+test_attr()
{
// Output message about test being performed
MESSAGE(5, ("Testing Attributes\n"));
- try
- {
+ try {
// Create a default file access property list
FileAccPropList fapl;
@@ -1887,45 +1912,41 @@ void test_attr()
// Loop over using new group format
unsigned new_format;
- for (new_format = FALSE; new_format <= TRUE; new_format++)
- {
+ for (new_format = FALSE; new_format <= TRUE; new_format++) {
FileAccPropList curr_fapl;
// Set the file access proplist for the type of format
- if (new_format)
- {
+ if (new_format) {
MESSAGE(7, ("testing with new file format\n"));
curr_fapl = fapl_new;
}
- else
- {
+ else {
MESSAGE(7, ("testing with old file format\n"));
curr_fapl = fapl;
}
- test_attr_basic_write(); // Test basic H5A writing code
- test_attr_getname(); // Test overloads of Attribute::getName
- test_attr_rename(); // Test renaming attribute
- test_attr_basic_read(); // Test basic H5A reading code
+ test_attr_basic_write(); // Test basic H5A writing code
+ test_attr_getname(); // Test overloads of Attribute::getName
+ test_attr_rename(); // Test renaming attribute
+ test_attr_basic_read(); // Test basic H5A reading code
test_attr_compound_write(); // Test complex datatype H5A writing code
test_attr_compound_read(); // Test complex datatype H5A reading code
- test_attr_scalar_write(); // Test scalar dataspace H5A writing code
- test_attr_scalar_read(); // Test scalar dataspace H5A reading code
+ test_attr_scalar_write(); // Test scalar dataspace H5A writing code
+ test_attr_scalar_read(); // Test scalar dataspace H5A reading code
- test_attr_mult_write(); // Test writing multiple attributes
- test_attr_mult_read(); // Test reading multiple attributes
- test_attr_delete(); // Test deleting attributes
+ test_attr_mult_write(); // Test writing multiple attributes
+ test_attr_mult_read(); // Test reading multiple attributes
+ test_attr_delete(); // Test deleting attributes
- test_attr_dtype_shared(); // Test using shared datatypes in attributes
+ test_attr_dtype_shared(); // Test using shared datatypes in attributes
- test_string_attr(); // Test read/write string attribute
- test_attr_exists(); // Test H5Location::attrExists
+ test_string_attr(); // Test read/write string attribute
+ test_attr_exists(); // Test H5Location::attrExists
// Test with new format
- if (new_format)
- {
+ if (new_format) {
// Test dense attribute storage creation
test_attr_dense_create(fcpl, curr_fapl);
@@ -1933,15 +1954,13 @@ void test_attr()
test_attr_corder_create_basic(fcpl, curr_fapl);
}
} // end for
- } // end try block
+ } // end try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_attr()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_attr()
+} // test_attr()
-
/*-------------------------------------------------------------------------
* Function: cleanup_attr
*
@@ -1950,8 +1969,8 @@ void test_attr()
* Return None
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_attr()
+extern "C" void
+cleanup_attr()
{
HDremove(FILE_BASIC.c_str());
HDremove(FILE_COMPOUND.c_str());
@@ -1960,4 +1979,3 @@ void cleanup_attr()
HDremove(FILE_DTYPE.c_str());
HDremove(FILE_CRTPROPS.c_str());
}
-
diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp
index ec8adf0..7b48a78 100644
--- a/c++/test/tcompound.cpp
+++ b/c++/test/tcompound.cpp
@@ -25,21 +25,20 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
/* Number of elements in each test */
#define NTESTELEM 100000
typedef struct complex_t {
- double re;
- double im;
+ double re;
+ double im;
} complex_t;
-
/*-------------------------------------------------------------------------
* Function: test_compound_1
*
@@ -51,7 +50,8 @@ typedef struct complex_t {
* January, 2007
*-------------------------------------------------------------------------
*/
-static void test_compound_1()
+static void
+test_compound_1()
{
// Output message about test being performed
SUBTEST("Compound Data Types");
@@ -63,15 +63,13 @@ static void test_compound_1()
complex_type.insertMember("real", HOFFSET(complex_t, re), PredType::NATIVE_DOUBLE);
complex_type.insertMember("imaginary", HOFFSET(complex_t, im), PredType::NATIVE_DOUBLE);
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_compound_1()
+} // test_compound_1()
-
/*-------------------------------------------------------------------------
* Function: test_compound_2
*
@@ -85,7 +83,8 @@ static void test_compound_1()
* January, 2007
*-------------------------------------------------------------------------
*/
-static void test_compound_2()
+static void
+test_compound_2()
{
typedef struct {
int a, b, c[4], d, e;
@@ -94,33 +93,33 @@ static void test_compound_2()
int e, d, c[4], b, a;
} dst_typ_t;
- src_typ_t *s_ptr;
- dst_typ_t *d_ptr;
- const int nelmts = NTESTELEM;
- const hsize_t four = 4;
- int i;
+ src_typ_t * s_ptr;
+ dst_typ_t * d_ptr;
+ const int nelmts = NTESTELEM;
+ const hsize_t four = 4;
+ int i;
unsigned char *buf = NULL, *orig = NULL, *bkg = NULL;
- ArrayType *array_dt = NULL;
+ ArrayType * array_dt = NULL;
// Output message about test being performed
SUBTEST("Compound Element Reordering");
try {
// Sizes should be the same, but be careful just in case
- buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
- bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t));
- orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t));
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- s_ptr->c[0] = i*8+2;
- s_ptr->c[1] = i*8+3;
- s_ptr->c[2] = i*8+4;
- s_ptr->c[3] = i*8+5;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
+ buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
+ bkg = (unsigned char *)HDmalloc(nelmts * sizeof(dst_typ_t));
+ orig = (unsigned char *)HDmalloc(nelmts * sizeof(src_typ_t));
+ for (i = 0; i < nelmts; i++) {
+ s_ptr = ((src_typ_t *)orig) + i;
+ s_ptr->a = i * 8 + 0;
+ s_ptr->b = i * 8 + 1;
+ s_ptr->c[0] = i * 8 + 2;
+ s_ptr->c[1] = i * 8 + 3;
+ s_ptr->c[2] = i * 8 + 4;
+ s_ptr->c[3] = i * 8 + 5;
+ s_ptr->d = i * 8 + 6;
+ s_ptr->e = i * 8 + 7;
}
- memcpy(buf, orig, nelmts*sizeof(src_typ_t));
+ memcpy(buf, orig, nelmts * sizeof(src_typ_t));
// Build hdf5 datatypes
array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four);
@@ -150,29 +149,22 @@ static void test_compound_2()
st.convert(dt, (size_t)nelmts, buf, bkg);
// Compare results
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- d_ptr = ((dst_typ_t*)buf) + i;
- if (s_ptr->a != d_ptr->a ||
- s_ptr->b != d_ptr->b ||
- s_ptr->c[0] != d_ptr->c[0] ||
- s_ptr->c[1] != d_ptr->c[1] ||
- s_ptr->c[2] != d_ptr->c[2] ||
- s_ptr->c[3] != d_ptr->c[3] ||
- s_ptr->d != d_ptr->d ||
- s_ptr->e != d_ptr->e) {
+ for (i = 0; i < nelmts; i++) {
+ s_ptr = ((src_typ_t *)orig) + i;
+ d_ptr = ((dst_typ_t *)buf) + i;
+ if (s_ptr->a != d_ptr->a || s_ptr->b != d_ptr->b || s_ptr->c[0] != d_ptr->c[0] ||
+ s_ptr->c[1] != d_ptr->c[1] || s_ptr->c[2] != d_ptr->c[2] || s_ptr->c[3] != d_ptr->c[3] ||
+ s_ptr->d != d_ptr->d || s_ptr->e != d_ptr->e) {
H5_FAILED();
cerr << " i=" << i << endl;
- cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b
- << "c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << ","
- << s_ptr->c[2] << "," << s_ptr->c[3] << ", d="
- << s_ptr->d << ", e=" << s_ptr->e << "}" << endl;
- cerr << " dst={a=" << s_ptr->a << ", b=" << s_ptr->b
- << "c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << ","
- << s_ptr->c[2] << "," << s_ptr->c[3] << ", d="
- << s_ptr->d << ", e=" << s_ptr->e << "}" << endl;
- }
+ cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b << "c=[" << s_ptr->c[0] << ","
+ << s_ptr->c[1] << "," << s_ptr->c[2] << "," << s_ptr->c[3] << ", d=" << s_ptr->d
+ << ", e=" << s_ptr->e << "}" << endl;
+ cerr << " dst={a=" << s_ptr->a << ", b=" << s_ptr->b << "c=[" << s_ptr->c[0] << ","
+ << s_ptr->c[1] << "," << s_ptr->c[2] << "," << s_ptr->c[3] << ", d=" << s_ptr->d
+ << ", e=" << s_ptr->e << "}" << endl;
}
+ }
// Release resources
HDfree(buf);
HDfree(bkg);
@@ -182,18 +174,16 @@ static void test_compound_2()
st.close();
dt.close();
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
}
- if(array_dt)
+ if (array_dt)
delete array_dt;
-} // test_compound_2()
+} // test_compound_2()
-
/*-------------------------------------------------------------------------
* Function: test_compound_3
*
@@ -207,42 +197,43 @@ static void test_compound_2()
* January, 2007
*-------------------------------------------------------------------------
*/
-static void test_compound_3()
+static void
+test_compound_3()
{
typedef struct {
int a, b, c[4], d, e;
} src_typ_t;
typedef struct {
- int a, c[4], e;
+ int a, c[4], e;
} dst_typ_t;
- src_typ_t *s_ptr;
- dst_typ_t *d_ptr;
- int i;
- const int nelmts = NTESTELEM;
- const hsize_t four = 4;
+ src_typ_t * s_ptr;
+ dst_typ_t * d_ptr;
+ int i;
+ const int nelmts = NTESTELEM;
+ const hsize_t four = 4;
unsigned char *buf = NULL, *orig = NULL, *bkg = NULL;
- ArrayType* array_dt = NULL;
+ ArrayType * array_dt = NULL;
// Output message about test being performed
SUBTEST("Compound Datatype Subset Conversions");
try {
/* Initialize */
- buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
- bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t));
- orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t));
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- s_ptr->c[0] = i*8+2;
- s_ptr->c[1] = i*8+3;
- s_ptr->c[2] = i*8+4;
- s_ptr->c[3] = i*8+5;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
+ buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
+ bkg = (unsigned char *)HDmalloc(nelmts * sizeof(dst_typ_t));
+ orig = (unsigned char *)HDmalloc(nelmts * sizeof(src_typ_t));
+ for (i = 0; i < nelmts; i++) {
+ s_ptr = ((src_typ_t *)orig) + i;
+ s_ptr->a = i * 8 + 0;
+ s_ptr->b = i * 8 + 1;
+ s_ptr->c[0] = i * 8 + 2;
+ s_ptr->c[1] = i * 8 + 3;
+ s_ptr->c[2] = i * 8 + 4;
+ s_ptr->c[3] = i * 8 + 5;
+ s_ptr->d = i * 8 + 6;
+ s_ptr->e = i * 8 + 7;
}
- memcpy(buf, orig, nelmts*sizeof(src_typ_t));
+ memcpy(buf, orig, nelmts * sizeof(src_typ_t));
/* Build hdf5 datatypes */
array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four);
@@ -270,27 +261,20 @@ static void test_compound_3()
st.convert(dt, (size_t)nelmts, buf, bkg);
/* Compare results */
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- d_ptr = ((dst_typ_t*)buf) + i;
- if (s_ptr->a != d_ptr->a ||
- s_ptr->c[0] != d_ptr->c[0] ||
- s_ptr->c[1] != d_ptr->c[1] ||
- s_ptr->c[2] != d_ptr->c[2] ||
- s_ptr->c[3] != d_ptr->c[3] ||
- s_ptr->e != d_ptr->e) {
+ for (i = 0; i < nelmts; i++) {
+ s_ptr = ((src_typ_t *)orig) + i;
+ d_ptr = ((dst_typ_t *)buf) + i;
+ if (s_ptr->a != d_ptr->a || s_ptr->c[0] != d_ptr->c[0] || s_ptr->c[1] != d_ptr->c[1] ||
+ s_ptr->c[2] != d_ptr->c[2] || s_ptr->c[3] != d_ptr->c[3] || s_ptr->e != d_ptr->e) {
H5_FAILED();
cerr << " i=" << i << endl;
- cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b
- << ", c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << ","
- << s_ptr->c[2] << "," << s_ptr->c[3] << "], d="
- << s_ptr->d << ", e=" << s_ptr->e << "}" << endl;
- cerr << " dst={a=" << d_ptr->a
- << ", c=[" << d_ptr->c[0] << "," << d_ptr->c[1] << ","
- << d_ptr->c[2] << "," << d_ptr->c[3] << "], e="
- << d_ptr->e << "}" << endl;
+ cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b << ", c=[" << s_ptr->c[0] << ","
+ << s_ptr->c[1] << "," << s_ptr->c[2] << "," << s_ptr->c[3] << "], d=" << s_ptr->d
+ << ", e=" << s_ptr->e << "}" << endl;
+ cerr << " dst={a=" << d_ptr->a << ", c=[" << d_ptr->c[0] << "," << d_ptr->c[1] << ","
+ << d_ptr->c[2] << "," << d_ptr->c[3] << "], e=" << d_ptr->e << "}" << endl;
} // if
- } // for
+ } // for
/* Release resources */
HDfree(buf);
@@ -301,18 +285,16 @@ static void test_compound_3()
st.close();
dt.close();
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
}
- if(array_dt)
+ if (array_dt)
delete array_dt;
-} // test_compound_3()
+} // test_compound_3()
-
/*-------------------------------------------------------------------------
* Function: test_compound_4
*
@@ -326,7 +308,8 @@ static void test_compound_3()
* January, 2007
*-------------------------------------------------------------------------
*/
-static void test_compound_4()
+static void
+test_compound_4()
{
typedef struct {
@@ -335,38 +318,38 @@ static void test_compound_4()
typedef struct {
short b;
- int a, c[4];
+ int a, c[4];
short d;
- int e;
+ int e;
} dst_typ_t;
- src_typ_t *s_ptr;
- dst_typ_t *d_ptr;
- int i;
- const int nelmts = NTESTELEM;
- const hsize_t four = 4;
+ src_typ_t * s_ptr;
+ dst_typ_t * d_ptr;
+ int i;
+ const int nelmts = NTESTELEM;
+ const hsize_t four = 4;
unsigned char *buf = NULL, *orig = NULL, *bkg = NULL;
- ArrayType* array_dt = NULL;
+ ArrayType * array_dt = NULL;
// Output message about test being performed
SUBTEST("Compound Element Shrinking & Reordering");
try {
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
- bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t));
- orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t));
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- s_ptr->a = i*8+0;
- s_ptr->b = (i*8+1) & 0x7fff;
- s_ptr->c[0] = i*8+2;
- s_ptr->c[1] = i*8+3;
- s_ptr->c[2] = i*8+4;
- s_ptr->c[3] = i*8+5;
- s_ptr->d = (i*8+6) & 0x7fff;
- s_ptr->e = i*8+7;
+ buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
+ bkg = (unsigned char *)HDmalloc(nelmts * sizeof(dst_typ_t));
+ orig = (unsigned char *)HDmalloc(nelmts * sizeof(src_typ_t));
+ for (i = 0; i < nelmts; i++) {
+ s_ptr = ((src_typ_t *)orig) + i;
+ s_ptr->a = i * 8 + 0;
+ s_ptr->b = (i * 8 + 1) & 0x7fff;
+ s_ptr->c[0] = i * 8 + 2;
+ s_ptr->c[1] = i * 8 + 3;
+ s_ptr->c[2] = i * 8 + 4;
+ s_ptr->c[3] = i * 8 + 5;
+ s_ptr->d = (i * 8 + 6) & 0x7fff;
+ s_ptr->e = i * 8 + 7;
}
- memcpy(buf, orig, nelmts*sizeof(src_typ_t));
+ memcpy(buf, orig, nelmts * sizeof(src_typ_t));
/* Build hdf5 datatypes */
array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four);
@@ -396,30 +379,22 @@ static void test_compound_4()
st.convert(dt, (size_t)nelmts, buf, bkg);
/* Compare results */
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- d_ptr = ((dst_typ_t*)buf) + i;
- if (s_ptr->a != d_ptr->a ||
- s_ptr->b != d_ptr->b ||
- s_ptr->c[0] != d_ptr->c[0] ||
- s_ptr->c[1] != d_ptr->c[1] ||
- s_ptr->c[2] != d_ptr->c[2] ||
- s_ptr->c[3] != d_ptr->c[3] ||
- s_ptr->d != d_ptr->d ||
- s_ptr->e != d_ptr->e)
- {
+ for (i = 0; i < nelmts; i++) {
+ s_ptr = ((src_typ_t *)orig) + i;
+ d_ptr = ((dst_typ_t *)buf) + i;
+ if (s_ptr->a != d_ptr->a || s_ptr->b != d_ptr->b || s_ptr->c[0] != d_ptr->c[0] ||
+ s_ptr->c[1] != d_ptr->c[1] || s_ptr->c[2] != d_ptr->c[2] || s_ptr->c[3] != d_ptr->c[3] ||
+ s_ptr->d != d_ptr->d || s_ptr->e != d_ptr->e) {
H5_FAILED();
cerr << " i=" << i << endl;
- cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b
- << "c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << ","
- << s_ptr->c[2] << "," << s_ptr->c[3] << ", d="
- << s_ptr->d << ", e=" << s_ptr->e << "}" << endl;
- cerr << " dst={a=" << d_ptr->a << ", b=" << d_ptr->b
- << "c=[" << d_ptr->c[0] << "," << d_ptr->c[1] << ","
- << d_ptr->c[2] << "," << d_ptr->c[3] << ", d="
- << d_ptr->d << ", e=" << d_ptr->e << "}" << endl;
+ cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b << "c=[" << s_ptr->c[0] << ","
+ << s_ptr->c[1] << "," << s_ptr->c[2] << "," << s_ptr->c[3] << ", d=" << s_ptr->d
+ << ", e=" << s_ptr->e << "}" << endl;
+ cerr << " dst={a=" << d_ptr->a << ", b=" << d_ptr->b << "c=[" << d_ptr->c[0] << ","
+ << d_ptr->c[1] << "," << d_ptr->c[2] << "," << d_ptr->c[3] << ", d=" << d_ptr->d
+ << ", e=" << d_ptr->e << "}" << endl;
} // if
- } // for
+ } // for
/* Release resources */
HDfree(buf);
@@ -430,18 +405,16 @@ static void test_compound_4()
st.close();
dt.close();
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
}
- if(array_dt)
+ if (array_dt)
delete array_dt;
-} // test_compound_4()
+} // test_compound_4()
-
/*-------------------------------------------------------------------------
* Function: test_compound_5
*
@@ -456,27 +429,27 @@ static void test_compound_4()
* January, 2007
*-------------------------------------------------------------------------
*/
-static void test_compound_5()
+static void
+test_compound_5()
{
typedef struct {
- char name[16];
- short tdim;
- short coll_ids[4];
+ char name[16];
+ short tdim;
+ short coll_ids[4];
} src_typ_t;
typedef struct {
- char name[16];
- short tdim;
- int coll_ids[4];
+ char name[16];
+ short tdim;
+ int coll_ids[4];
} dst_typ_t;
- hsize_t dims[1] = {4};
- src_typ_t src[2] = {{"one", 102, {104, 105, 106, 107}},
- {"two", 202, {204, 205, 206, 207}}};
- dst_typ_t *dst;
- void *buf = HDcalloc(2, sizeof(dst_typ_t));
- void *bkg = HDcalloc(2, sizeof(dst_typ_t));
- ArrayType* array_dt = NULL;
+ hsize_t dims[1] = {4};
+ src_typ_t src[2] = {{"one", 102, {104, 105, 106, 107}}, {"two", 202, {204, 205, 206, 207}}};
+ dst_typ_t *dst;
+ void * buf = HDcalloc(2, sizeof(dst_typ_t));
+ void * bkg = HDcalloc(2, sizeof(dst_typ_t));
+ ArrayType *array_dt = NULL;
// Output message about test being performed
SUBTEST("Optimized Struct Converter");
@@ -484,17 +457,17 @@ static void test_compound_5()
/* Build datatypes */
array_dt = new ArrayType(PredType::NATIVE_SHORT, 1, dims);
- CompType short_array(4*sizeof(short));
+ CompType short_array(4 * sizeof(short));
short_array.insertMember("_", 0, *array_dt);
array_dt->close();
delete array_dt;
- CompType int_array(4*sizeof(int));
+ CompType int_array(4 * sizeof(int));
array_dt = new ArrayType(PredType::NATIVE_INT, 1, dims);
int_array.insertMember("_", 0, *array_dt);
array_dt->close();
- StrType strg(PredType::C_S1, 16);
+ StrType strg(PredType::C_S1, 16);
CompType src_type(sizeof(src_typ_t));
src_type.insertMember("name", HOFFSET(src_typ_t, name), strg);
src_type.insertMember("tdim", HOFFSET(src_typ_t, tdim), PredType::NATIVE_SHORT);
@@ -508,7 +481,7 @@ static void test_compound_5()
/* Convert data */
memcpy(buf, src, sizeof(src));
src_type.convert(dst_type, (size_t)2, buf, bkg);
- dst = (dst_typ_t*)buf;
+ dst = (dst_typ_t *)buf;
/* Cleanup */
src_type.close();
@@ -518,31 +491,27 @@ static void test_compound_5()
int_array.close();
/* Check results */
- if (memcmp(src[1].name, dst[1].name, sizeof(src[1].name)) ||
- src[1].tdim!=dst[1].tdim ||
- src[1].coll_ids[0]!=dst[1].coll_ids[0] ||
- src[1].coll_ids[1]!=dst[1].coll_ids[1] ||
- src[1].coll_ids[2]!=dst[1].coll_ids[2] ||
- src[1].coll_ids[3]!=dst[1].coll_ids[3])
- { H5_FAILED(); }
+ if (memcmp(src[1].name, dst[1].name, sizeof(src[1].name)) || src[1].tdim != dst[1].tdim ||
+ src[1].coll_ids[0] != dst[1].coll_ids[0] || src[1].coll_ids[1] != dst[1].coll_ids[1] ||
+ src[1].coll_ids[2] != dst[1].coll_ids[2] || src[1].coll_ids[3] != dst[1].coll_ids[3]) {
+ H5_FAILED();
+ }
/* Free memory buffers */
HDfree(buf);
HDfree(bkg);
dst = NULL;
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
}
- if(array_dt)
+ if (array_dt)
delete array_dt;
-} // test_compound_5()
+} // test_compound_5()
-
/*-------------------------------------------------------------------------
* Function: test_compound_6
*
@@ -556,7 +525,8 @@ static void test_compound_5()
* January, 2007
*-------------------------------------------------------------------------
*/
-static void test_compound_6()
+static void
+test_compound_6()
{
typedef struct {
short b;
@@ -568,25 +538,25 @@ static void test_compound_6()
long d;
} dst_typ_t;
- src_typ_t *s_ptr;
- dst_typ_t *d_ptr;
- int i;
- const int nelmts = NTESTELEM;
- unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
+ src_typ_t * s_ptr;
+ dst_typ_t * d_ptr;
+ int i;
+ const int nelmts = NTESTELEM;
+ unsigned char *buf = NULL, *orig = NULL, *bkg = NULL;
// Output message about test being performed
SUBTEST("Compound Element Growing");
try {
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
- bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t));
- orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t));
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- s_ptr->b = (i*8+1) & 0x7fff;
- s_ptr->d = (i*8+6) & 0x7fff;
+ buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
+ bkg = (unsigned char *)HDmalloc(nelmts * sizeof(dst_typ_t));
+ orig = (unsigned char *)HDmalloc(nelmts * sizeof(src_typ_t));
+ for (i = 0; i < nelmts; i++) {
+ s_ptr = ((src_typ_t *)orig) + i;
+ s_ptr->b = (i * 8 + 1) & 0x7fff;
+ s_ptr->d = (i * 8 + 6) & 0x7fff;
}
- memcpy(buf, orig, nelmts*sizeof(src_typ_t));
+ memcpy(buf, orig, nelmts * sizeof(src_typ_t));
/* Build hdf5 datatypes */
CompType st(sizeof(src_typ_t));
@@ -601,20 +571,16 @@ static void test_compound_6()
st.convert(dt, (size_t)nelmts, buf, bkg);
/* Compare results */
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- d_ptr = ((dst_typ_t*)buf) + i;
- if (s_ptr->b != d_ptr->b ||
- s_ptr->d != d_ptr->d)
- {
+ for (i = 0; i < nelmts; i++) {
+ s_ptr = ((src_typ_t *)orig) + i;
+ d_ptr = ((dst_typ_t *)buf) + i;
+ if (s_ptr->b != d_ptr->b || s_ptr->d != d_ptr->d) {
H5_FAILED();
cerr << " i=" << i << endl;
- cerr << " src={b=" << s_ptr->b << ", d=" << s_ptr->d
- << "}" << endl;
- cerr << " dst={b=" << d_ptr->b << ", d=" << d_ptr->d
- << "}" << endl;
+ cerr << " src={b=" << s_ptr->b << ", d=" << s_ptr->d << "}" << endl;
+ cerr << " dst={b=" << d_ptr->b << ", d=" << d_ptr->d << "}" << endl;
} // if
- } // for
+ } // for
/* Release resources */
HDfree(buf);
@@ -625,15 +591,13 @@ static void test_compound_6()
st.close();
dt.close();
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_compound_6()
+} // test_compound_6()
-
/*-------------------------------------------------------------------------
* Function: test_compound_7
*
@@ -646,18 +610,19 @@ static void test_compound_6()
* January, 2007
*-------------------------------------------------------------------------
*/
-static void test_compound_7()
+static void
+test_compound_7()
{
typedef struct {
- int a;
+ int a;
float b;
- long c;
+ long c;
} s1_typ_t;
typedef struct {
- int a;
- float b;
- long c;
+ int a;
+ float b;
+ long c;
double d;
} s2_typ_t;
@@ -666,9 +631,9 @@ static void test_compound_7()
try {
CompType tid1(sizeof(s1_typ_t));
- tid1.insertMember("a", HOFFSET(s1_typ_t,a),PredType::NATIVE_INT);
- tid1.insertMember("b", HOFFSET(s1_typ_t,b),PredType::NATIVE_FLOAT);
- tid1.insertMember("c", HOFFSET(s1_typ_t,c),PredType::NATIVE_LONG);
+ tid1.insertMember("a", HOFFSET(s1_typ_t, a), PredType::NATIVE_INT);
+ tid1.insertMember("b", HOFFSET(s1_typ_t, b), PredType::NATIVE_FLOAT);
+ tid1.insertMember("c", HOFFSET(s1_typ_t, c), PredType::NATIVE_LONG);
size_t type_size = tid1.getSize();
verify_val(type_size, sizeof(s1_typ_t), "DataType::getSize", __LINE__, __FILE__);
@@ -683,22 +648,23 @@ static void test_compound_7()
try {
tid2.insertMember("d", HOFFSET(s2_typ_t, d), PredType::NATIVE_DOUBLE);
// Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("CompType::insertMember", "Attempted to insert field past end of compound data type.");
- } catch (DataTypeIException& err) {}
+ throw InvalidActionException("CompType::insertMember",
+ "Attempted to insert field past end of compound data type.");
+ }
+ catch (DataTypeIException &err) {
+ }
/* Release resources */
tid1.close();
tid2.close();
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_compound_7()
+} // test_compound_7()
-
/*-------------------------------------------------------------------------
* Function: test_compound_set_size
*
@@ -712,7 +678,8 @@ static void test_compound_7()
*/
const H5std_string COMPFILE("tcompound_types.h5");
-static void test_compound_set_size()
+static void
+test_compound_set_size()
{
typedef struct {
int a, b, c[4], d, e;
@@ -779,15 +746,13 @@ static void test_compound_set_size()
file.close();
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_compound_set_size()
+} // test_compound_set_size()
-
/*-------------------------------------------------------------------------
* Function: test_compound
*
@@ -799,23 +764,22 @@ static void test_compound_set_size()
* January 2007
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_compound()
+extern "C" void
+test_compound()
{
// Output message about test being performed
MESSAGE(5, ("Testing Compound Data Type operations\n"));
- test_compound_1(); // various things about compound data types
- test_compound_2(); // compound element reordering
- test_compound_3(); // compound datatype subset conversions
- test_compound_4(); // compound element shrinking & reordering
- test_compound_5(); // optimized struct converter
- test_compound_6(); // compound element growing
- test_compound_7(); // compound element insertion
- test_compound_set_size(); // set size on compound data types
-} // test_compound()
-
-
+ test_compound_1(); // various things about compound data types
+ test_compound_2(); // compound element reordering
+ test_compound_3(); // compound datatype subset conversions
+ test_compound_4(); // compound element shrinking & reordering
+ test_compound_5(); // optimized struct converter
+ test_compound_6(); // compound element growing
+ test_compound_7(); // compound element insertion
+ test_compound_set_size(); // set size on compound data types
+} // test_compound()
+
/*-------------------------------------------------------------------------
* Function: cleanup_compound
*
@@ -824,8 +788,8 @@ void test_compound()
* Return None
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_compound()
+extern "C" void
+cleanup_compound()
{
HDremove(COMPFILE.c_str());
-} // cleanup_file
+} // cleanup_file
diff --git a/c++/test/tdspl.cpp b/c++/test/tdspl.cpp
index 438f385..4cdf408 100644
--- a/c++/test/tdspl.cpp
+++ b/c++/test/tdspl.cpp
@@ -26,20 +26,21 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
const H5std_string FILENAME("tdatatransform.h5");
-static void test_transfplist()
+static void
+test_transfplist()
{
- const char* c_to_f = "(9/5.0)*x + 32";
- const char* simple = "(4/2) * ( (2 + 4)/(5 - 2.5))"; /* this equals 4.8 */
+ const char *c_to_f = "(9/5.0)*x + 32";
+ const char *simple = "(4/2) * ( (2 + 4)/(5 - 2.5))"; /* this equals 4.8 */
/* inverses the utrans transform in init_test to get back original array */
- const char* utrans_inv = "(x/3)*4 - 100";
+ const char *utrans_inv = "(x/3)*4 - 100";
SUBTEST("DSetMemXferPropList::set/getDataTransform()");
try {
@@ -63,12 +64,12 @@ static void test_transfplist()
// Find out the length of the transform expression, allocate the buffer
// for it, then read and verify the expression from the copied plist
- ssize_t tran_len = dxpl_c_to_f_copy.getDataTransform(NULL);
- char *c_to_f_read = (char *)HDmalloc(tran_len+1);
- HDmemset(c_to_f_read, 0, tran_len+1);
- dxpl_c_to_f_copy.getDataTransform(c_to_f_read, tran_len+1);
- verify_val((const char*)c_to_f_read, (const char*)c_to_f,
- "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
+ ssize_t tran_len = dxpl_c_to_f_copy.getDataTransform(NULL);
+ char * c_to_f_read = (char *)HDmalloc(tran_len + 1);
+ HDmemset(c_to_f_read, 0, tran_len + 1);
+ dxpl_c_to_f_copy.getDataTransform(c_to_f_read, tran_len + 1);
+ verify_val((const char *)c_to_f_read, (const char *)c_to_f, "DSetMemXferPropList::getDataTransform",
+ __LINE__, __FILE__);
HDfree(c_to_f_read);
//
@@ -78,39 +79,37 @@ static void test_transfplist()
// Get and verify the expression with:
// ssize_t getDataTransform(char* exp, const size_t buf_size [default=0])
- tran_len = dxpl_c_to_f.getDataTransform(NULL);
- c_to_f_read = (char *)HDmalloc(tran_len+1);
- HDmemset(c_to_f_read, 0, tran_len+1);
- dxpl_c_to_f.getDataTransform(c_to_f_read, tran_len+1);
- verify_val((const char*)c_to_f_read, (const char*)c_to_f,
- "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
+ tran_len = dxpl_c_to_f.getDataTransform(NULL);
+ c_to_f_read = (char *)HDmalloc(tran_len + 1);
+ HDmemset(c_to_f_read, 0, tran_len + 1);
+ dxpl_c_to_f.getDataTransform(c_to_f_read, tran_len + 1);
+ verify_val((const char *)c_to_f_read, (const char *)c_to_f, "DSetMemXferPropList::getDataTransform",
+ __LINE__, __FILE__);
HDfree(c_to_f_read);
// Get and verify the expression with:
// H5std_string DSetMemXferPropList::getDataTransform()
H5std_string simple_read = dxpl_simple.getDataTransform();
- verify_val((const char*)simple_read.c_str(), (const char*)simple,
- "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
+ verify_val((const char *)simple_read.c_str(), (const char *)simple,
+ "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
// Get and verify the expression with:
// ssize_t getDataTransform(char* exp, const size_t buf_size)
- tran_len = dxpl_utrans_inv.getDataTransform(NULL, 0);
- char *utrans_inv_read = (char *)HDmalloc(tran_len+1);
- HDmemset(utrans_inv_read, 0, tran_len+1);
- dxpl_utrans_inv.getDataTransform(utrans_inv_read, tran_len+1);
- verify_val((const char*)utrans_inv_read, (const char*)utrans_inv,
- "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
+ tran_len = dxpl_utrans_inv.getDataTransform(NULL, 0);
+ char *utrans_inv_read = (char *)HDmalloc(tran_len + 1);
+ HDmemset(utrans_inv_read, 0, tran_len + 1);
+ dxpl_utrans_inv.getDataTransform(utrans_inv_read, tran_len + 1);
+ verify_val((const char *)utrans_inv_read, (const char *)utrans_inv,
+ "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
HDfree(utrans_inv_read);
PASSED();
}
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_transfplist", __LINE__, __FILE__, E.getCDetailMsg());
}
}
-
/*-------------------------------------------------------------------------
* Function: test_dsproplist
*
@@ -119,17 +118,16 @@ static void test_transfplist()
* Return None
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_dsproplist()
+extern "C" void
+test_dsproplist()
{
// Output message about test being performed
MESSAGE(5, ("Testing Generic Dataset Property Lists\n"));
test_transfplist(); // test set/getDataTransform()
-} // test_dsproplist()
+} // test_dsproplist()
-
/*-------------------------------------------------------------------------
* Function: cleanup_dsproplist
*
@@ -138,8 +136,8 @@ void test_dsproplist()
* Return none
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_dsproplist()
+extern "C" void
+cleanup_dsproplist()
{
HDremove(FILENAME.c_str());
}
diff --git a/c++/test/testhdf5.cpp b/c++/test/testhdf5.cpp
index a2a0867..a38d36d 100644
--- a/c++/test/testhdf5.cpp
+++ b/c++/test/testhdf5.cpp
@@ -47,17 +47,16 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
int
main(int argc, char *argv[])
{
- try
- {
+ try {
// Turn of the auto-printing when failure occurs so that we can
// handle the errors appropriately since sometime failures are
// caused deliberately and expected.
@@ -70,39 +69,38 @@ main(int argc, char *argv[])
// testing dataset functionalities in dset.cpp
AddTest("dsets", test_dset, cleanup_dsets, "Dataset I/O Operations", NULL);
// testing dataspace functionalities in th5s.cpp
- AddTest("th5s", test_h5s, cleanup_h5s, "Dataspaces", NULL);
+ AddTest("th5s", test_h5s, cleanup_h5s, "Dataspaces", NULL);
// testing attribute functionalities in tattr.cpp
- AddTest("tattr", test_attr, cleanup_attr, "Attributes", NULL);
+ AddTest("tattr", test_attr, cleanup_attr, "Attributes", NULL);
// testing object functionalities in tobject.cpp
- AddTest("tobject", test_object, cleanup_object, "Objects", NULL);
+ AddTest("tobject", test_object, cleanup_object, "Objects", NULL);
// testing reference functionalities in trefer.cpp
- AddTest("trefer", test_reference, cleanup_reference, "References", NULL);
+ AddTest("trefer", test_reference, cleanup_reference, "References", NULL);
// testing variable-length strings in tvlstr.cpp
- AddTest("tvlstr", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings", NULL);
- AddTest("ttypes", test_types, cleanup_types, "Generic Data Types", NULL);
- AddTest("tarray", test_array, cleanup_array, "Array Datatypes", NULL);
- AddTest("tcompound", test_compound, cleanup_compound, "Compound Data Types", NULL);
- AddTest("tdspl", test_dsproplist, cleanup_dsproplist, "Dataset Property List", NULL);
- AddTest("tfilter", test_filters, cleanup_filters, "Various Filters", NULL);
- AddTest("tlinks", test_links, cleanup_links, "Various Links", NULL);
-/* Comment out tests that are not done yet. - BMR, Feb 2001
- AddTest("select", test_select, cleanup_select, "Selections", NULL);
- AddTest("time", test_time, cleanup_time, "Time Datatypes", NULL);
- AddTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes", NULL);
-*/
- AddTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration", NULL);
-/*
- AddTest("genprop", test_genprop, cleanup_genprop, "Generic Properties", NULL);
- AddTest("id", test_ids, NULL, "User-Created Identifiers", NULL);
-
-Comment out tests that are not done yet */
-
-/* Tentative - BMR 2007/1/12
- AddTest("enum", test_enum, cleanup_enum, "Enum Data Types", NULL);
-*/
+ AddTest("tvlstr", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings", NULL);
+ AddTest("ttypes", test_types, cleanup_types, "Generic Data Types", NULL);
+ AddTest("tarray", test_array, cleanup_array, "Array Datatypes", NULL);
+ AddTest("tcompound", test_compound, cleanup_compound, "Compound Data Types", NULL);
+ AddTest("tdspl", test_dsproplist, cleanup_dsproplist, "Dataset Property List", NULL);
+ AddTest("tfilter", test_filters, cleanup_filters, "Various Filters", NULL);
+ AddTest("tlinks", test_links, cleanup_links, "Various Links", NULL);
+ /* Comment out tests that are not done yet. - BMR, Feb 2001
+ AddTest("select", test_select, cleanup_select, "Selections", NULL);
+ AddTest("time", test_time, cleanup_time, "Time Datatypes", NULL);
+ AddTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes", NULL);
+ */
+ AddTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration", NULL);
+ /*
+ AddTest("genprop", test_genprop, cleanup_genprop, "Generic Properties", NULL);
+ AddTest("id", test_ids, NULL, "User-Created Identifiers", NULL);
+
+ Comment out tests that are not done yet */
+
+ /* Tentative - BMR 2007/1/12
+ AddTest("enum", test_enum, cleanup_enum, "Enum Data Types", NULL);
+ */
}
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("Tests failed", __LINE__, __FILE__, E.getCDetailMsg());
}
@@ -110,7 +108,7 @@ Comment out tests that are not done yet */
TestInfo(argv[0]);
/* Parse command line arguments */
- TestParseCmdLine(argc,argv);
+ TestParseCmdLine(argc, argv);
/* Perform requested testing */
PerformTests();
@@ -128,4 +126,3 @@ Comment out tests that are not done yet */
return (GetTestNumErrs());
}
-
diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp
index f5625a3..b4e5da5 100644
--- a/c++/test/tfile.cpp
+++ b/c++/test/tfile.cpp
@@ -29,38 +29,37 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
-
-const hsize_t F1_USERBLOCK_SIZE = (hsize_t)0;
-const size_t F1_OFFSET_SIZE = sizeof(haddr_t);
-const size_t F1_LENGTH_SIZE = sizeof(hsize_t);
-const unsigned F1_SYM_LEAF_K = 4;
-const unsigned F1_SYM_INTERN_K = 16;
-const H5std_string FILE1("tfile1.h5");
-
-const hsize_t F2_USERBLOCK_SIZE = (hsize_t)512;
-const size_t F2_OFFSET_SIZE = 8;
-const size_t F2_LENGTH_SIZE = 8;
-const unsigned F2_SYM_LEAF_K = 8;
-const unsigned F2_SYM_INTERN_K = 32;
-const unsigned F2_ISTORE = 64;
-const H5std_string FILE2("tfile2.h5");
-
-const hsize_t F3_USERBLOCK_SIZE = (hsize_t)0;
-const size_t F3_OFFSET_SIZE = F2_OFFSET_SIZE;
-const size_t F3_LENGTH_SIZE = F2_LENGTH_SIZE;
-const unsigned F3_SYM_LEAF_K = F2_SYM_LEAF_K;
-const unsigned F3_SYM_INTERN_K = F2_SYM_INTERN_K;
-const H5std_string FILE3("tfile3.h5");
-
-const int KB = 1024;
-const H5std_string FILE4("tfile4.h5");
-
-
+#include "h5cpputil.h" // C++ utilility header file
+
+const hsize_t F1_USERBLOCK_SIZE = (hsize_t)0;
+const size_t F1_OFFSET_SIZE = sizeof(haddr_t);
+const size_t F1_LENGTH_SIZE = sizeof(hsize_t);
+const unsigned F1_SYM_LEAF_K = 4;
+const unsigned F1_SYM_INTERN_K = 16;
+const H5std_string FILE1("tfile1.h5");
+
+const hsize_t F2_USERBLOCK_SIZE = (hsize_t)512;
+const size_t F2_OFFSET_SIZE = 8;
+const size_t F2_LENGTH_SIZE = 8;
+const unsigned F2_SYM_LEAF_K = 8;
+const unsigned F2_SYM_INTERN_K = 32;
+const unsigned F2_ISTORE = 64;
+const H5std_string FILE2("tfile2.h5");
+
+const hsize_t F3_USERBLOCK_SIZE = (hsize_t)0;
+const size_t F3_OFFSET_SIZE = F2_OFFSET_SIZE;
+const size_t F3_LENGTH_SIZE = F2_LENGTH_SIZE;
+const unsigned F3_SYM_LEAF_K = F2_SYM_LEAF_K;
+const unsigned F3_SYM_INTERN_K = F2_SYM_INTERN_K;
+const H5std_string FILE3("tfile3.h5");
+
+const int KB = 1024;
+const H5std_string FILE4("tfile4.h5");
+
/*-------------------------------------------------------------------------
* Function: test_file_create
*
@@ -80,7 +79,8 @@ const H5std_string FILE4("tfile4.h5");
* with a special routine.
*-------------------------------------------------------------------------
*/
-static void test_file_create()
+static void
+test_file_create()
{
// Output message about test being performed
SUBTEST("File Creation I/O");
@@ -93,21 +93,22 @@ static void test_file_create()
remove(FILE1.c_str());
// Setting this to NULL for cleaning up in failure situations
- H5File* file1 = NULL;
+ H5File *file1 = NULL;
try {
// Create file FILE1
- file1 = new H5File (FILE1, H5F_ACC_EXCL);
+ file1 = new H5File(FILE1, H5F_ACC_EXCL);
// Try to create the same file with H5F_ACC_TRUNC. This should fail
// because file1 is the same file and is currently open.
try {
- H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E
+ H5File file2(FILE1, H5F_ACC_TRUNC); // should throw E
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("H5File constructor", "Attempted to create an existing file.");
}
- catch (FileIException& E) // catch truncating existing file
- {} // do nothing, FAIL expected
+ catch (FileIException &E) // catch truncating existing file
+ {
+ } // do nothing, FAIL expected
// Close file1
delete file1;
@@ -116,52 +117,56 @@ static void test_file_create()
// Try again with H5F_ACC_EXCL. This should fail because the file
// already exists from the previous steps.
try {
- H5File file2(FILE1, H5F_ACC_EXCL); // should throw E
+ H5File file2(FILE1, H5F_ACC_EXCL); // should throw E
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("H5File constructor", "File already exists.");
}
- catch (FileIException& E) // catching creating existing file
- {} // do nothing, FAIL expected
+ catch (FileIException &E) // catching creating existing file
+ {
+ } // do nothing, FAIL expected
- // Test create with H5F_ACC_TRUNC. This will truncate the existing file.
- file1 = new H5File (FILE1, H5F_ACC_TRUNC);
+ // Test create with H5F_ACC_TRUNC. This will truncate the existing file.
+ file1 = new H5File(FILE1, H5F_ACC_TRUNC);
// Try to create first file again. This should fail because file1
// is the same file and is currently open.
- try {
- H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E
+ try {
+ H5File file2(FILE1, H5F_ACC_TRUNC); // should throw E
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("H5File constructor", "H5F_ACC_TRUNC attempt on an opened file.");
}
- catch (FileIException& E) // catching truncating opened file
- {} // do nothing, FAIL expected
+ catch (FileIException &E) // catching truncating opened file
+ {
+ } // do nothing, FAIL expected
- // Try with H5F_ACC_EXCL. This should fail too because the file already
- // exists.
- try {
- H5File file3 (FILE1, H5F_ACC_EXCL); // should throw E
+ // Try with H5F_ACC_EXCL. This should fail too because the file already
+ // exists.
+ try {
+ H5File file3(FILE1, H5F_ACC_EXCL); // should throw E
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("H5File constructor", "H5F_ACC_EXCL attempt on an existing file.");
- }
- catch (FileIException& E) // catching H5F_ACC_EXCL on existing file
- {} // do nothing, FAIL expected
+ }
+ catch (FileIException &E) // catching H5F_ACC_EXCL on existing file
+ {
+ } // do nothing, FAIL expected
- // Get the file-creation template
+ // Get the file-creation template
FileCreatPropList tmpl1 = file1->getCreatePlist();
hsize_t ublock = tmpl1.getUserblock();
- verify_val((long)ublock, (long)F1_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
+ verify_val((long)ublock, (long)F1_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__,
+ __FILE__);
- size_t parm1, parm2; // file-creation parameters
- tmpl1.getSizes( parm1, parm2);
+ size_t parm1, parm2; // file-creation parameters
+ tmpl1.getSizes(parm1, parm2);
verify_val(parm1, F1_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
verify_val(parm2, F1_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- unsigned iparm1,iparm2; // file-creation parameters
- tmpl1.getSymk( iparm1, iparm2);
+ unsigned iparm1, iparm2; // file-creation parameters
+ tmpl1.getSymk(iparm1, iparm2);
verify_val(iparm1, F1_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
verify_val(iparm2, F1_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
@@ -171,85 +176,84 @@ static void test_file_create()
// Close first file
delete file1;
}
- catch (InvalidActionException& E)
- {
+ catch (InvalidActionException &E) {
cerr << " *FAILED*" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
if (file1 != NULL) // clean up
delete file1;
}
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg());
if (file1 != NULL) // clean up
delete file1;
}
// Setting this to NULL for cleaning up in failure situations
- FileCreatPropList* tmpl1 = NULL;
- try
- {
- // Create a new file with a non-standard file-creation template
+ FileCreatPropList *tmpl1 = NULL;
+ try {
+ // Create a new file with a non-standard file-creation template
tmpl1 = new FileCreatPropList;
- // Set the new file-creation parameters
- tmpl1->setUserblock (F2_USERBLOCK_SIZE);
- tmpl1->setSizes( F2_OFFSET_SIZE, F2_LENGTH_SIZE );
- tmpl1->setSymk( F2_SYM_INTERN_K, F2_SYM_LEAF_K );
+ // Set the new file-creation parameters
+ tmpl1->setUserblock(F2_USERBLOCK_SIZE);
+ tmpl1->setSizes(F2_OFFSET_SIZE, F2_LENGTH_SIZE);
+ tmpl1->setSymk(F2_SYM_INTERN_K, F2_SYM_LEAF_K);
- // Try to create second file, with non-standard file-creation template
- // params.
- H5File file2( FILE2, H5F_ACC_TRUNC, *tmpl1 );
+ // Try to create second file, with non-standard file-creation template
+ // params.
+ H5File file2(FILE2, H5F_ACC_TRUNC, *tmpl1);
- // Release file-creation template
+ // Release file-creation template
delete tmpl1;
tmpl1 = NULL;
// Get the file-creation template
- tmpl1 = new FileCreatPropList (file2.getCreatePlist());
+ tmpl1 = new FileCreatPropList(file2.getCreatePlist());
// Get the file-creation parameters
hsize_t ublock = tmpl1->getUserblock();
- verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
+ verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__,
+ __FILE__);
size_t parm1, parm2; // file-creation parameters
- tmpl1->getSizes( parm1, parm2);
+ tmpl1->getSizes(parm1, parm2);
verify_val(parm1, F2_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
verify_val(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- unsigned iparm1,iparm2; // file-creation parameters
- tmpl1->getSymk( iparm1, iparm2);
+ unsigned iparm1, iparm2; // file-creation parameters
+ tmpl1->getSymk(iparm1, iparm2);
verify_val(iparm1, F2_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
verify_val(iparm2, F2_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
// Clone the file-creation template
FileCreatPropList tmpl2;
- tmpl2.copy (*tmpl1);
+ tmpl2.copy(*tmpl1);
// Release file-creation template
delete tmpl1;
tmpl1 = NULL;
// Set the new file-creation parameter
- tmpl2.setUserblock( F3_USERBLOCK_SIZE );
+ tmpl2.setUserblock(F3_USERBLOCK_SIZE);
// Try to create second file, with non-standard file-creation template
// params
- H5File file3( FILE3, H5F_ACC_TRUNC, tmpl2 );
+ H5File file3(FILE3, H5F_ACC_TRUNC, tmpl2);
// Get the file-creation template
- tmpl1 = new FileCreatPropList (file3.getCreatePlist());
+ tmpl1 = new FileCreatPropList(file3.getCreatePlist());
// Get the file-creation parameters
ublock = tmpl1->getUserblock();
- verify_val((long)ublock, (long)F3_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
+ verify_val((long)ublock, (long)F3_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__,
+ __FILE__);
- tmpl1->getSizes( parm1, parm2);
+ tmpl1->getSizes(parm1, parm2);
verify_val(parm1, F3_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
verify_val(parm2, F3_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- tmpl1->getSymk( iparm1, iparm2);
+ tmpl1->getSymk(iparm1, iparm2);
verify_val(iparm1, F3_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
verify_val(iparm2, F3_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
@@ -258,15 +262,13 @@ static void test_file_create()
PASSED();
}
// catch all exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg());
- if (tmpl1 != NULL) // clean up
+ if (tmpl1 != NULL) // clean up
delete tmpl1;
}
-} // test_file_create()
+} // test_file_create()
-
/*-------------------------------------------------------------------------
* Function: test_file_open
*
@@ -286,7 +288,8 @@ static void test_file_create()
* with a special routine.
*-------------------------------------------------------------------------
*/
-static void test_file_open()
+static void
+test_file_open()
{
// Output message about test being performed
SUBTEST("File Opening I/O");
@@ -294,22 +297,23 @@ static void test_file_open()
try {
// Open first file
- H5File file1 (FILE2, H5F_ACC_RDWR );
+ H5File file1(FILE2, H5F_ACC_RDWR);
// Get the file-creation template
FileCreatPropList tmpl1 = file1.getCreatePlist();
// Get the file-creation parameters
hsize_t ublock = tmpl1.getUserblock();
- verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
+ verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__,
+ __FILE__);
- size_t parm1, parm2; // file-creation parameters
- tmpl1.getSizes( parm1, parm2);
+ size_t parm1, parm2; // file-creation parameters
+ tmpl1.getSizes(parm1, parm2);
verify_val(parm1, F2_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
verify_val(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- unsigned iparm1,iparm2; // file-creation parameters
- tmpl1.getSymk( iparm1, iparm2);
+ unsigned iparm1, iparm2; // file-creation parameters
+ tmpl1.getSymk(iparm1, iparm2);
verify_val(iparm1, F2_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
verify_val(iparm2, F2_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
@@ -319,14 +323,15 @@ static void test_file_open()
// Try truncating the file, and it should fail because the file is
// still opened with file2.
- try {
- H5File file3 (FILE2, H5F_ACC_TRUNC); // should throw E
+ try {
+ H5File file3(FILE2, H5F_ACC_TRUNC); // should throw E
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("H5File constructor", "Attempt truncating an opened file.");
- }
- catch (FileIException& E) // catching H5F_ACC_TRUNC on opened file
- {} // do nothing, FAIL expected
+ }
+ catch (FileIException &E) // catching H5F_ACC_TRUNC on opened file
+ {
+ } // do nothing, FAIL expected
// Now, really close the file.
file2.close();
@@ -340,15 +345,13 @@ static void test_file_open()
H5File file4(FILE2, H5F_ACC_TRUNC);
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_file_open()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_file_open()
+} // test_file_open()
-
/*-------------------------------------------------------------------------
* Function: test_file_size
*
@@ -360,12 +363,13 @@ static void test_file_open()
* June, 2004
*-------------------------------------------------------------------------
*/
-static void test_file_size()
+static void
+test_file_size()
{
// Output message about test being performed
SUBTEST("File Size");
- hid_t fapl_id;
+ hid_t fapl_id;
fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template
try {
@@ -373,33 +377,34 @@ static void test_file_size()
// list object to pass in H5File::H5File
FileAccPropList fapl(fapl_id);
- // Set to sec2 driver. Do we want to test other file drivers?
+ // Set to sec2 driver. Do we want to test other file drivers?
// They're not tested in C++.
// File drivers seem not implemented.
// fapl.setSec2();
// Create a file
- H5File file4( FILE4, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+ H5File file4(FILE4, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
// Get file size
hsize_t file_size = file4.getFileSize();
// Check if file size is reasonable. It's supposed to be 2KB now.
- if (file_size < 1*KB || file_size > 4*KB)
- issue_fail_msg("test_file_size()", __LINE__, __FILE__, "getFileSize() returned unreasonable value");
+ if (file_size < 1 * KB || file_size > 4 * KB)
+ issue_fail_msg("test_file_size()", __LINE__, __FILE__,
+ "getFileSize() returned unreasonable value");
// Get the amount of free space in the file
hssize_t free_space = file4.getFreeSpace();
// Check if it's reasonable. It's 0 now.
- if (free_space < 0 || free_space > 4*KB)
- issue_fail_msg("test_file_size()", __LINE__, __FILE__, "getFreeSpace returned unreasonable value");
+ if (free_space < 0 || free_space > 4 * KB)
+ issue_fail_msg("test_file_size()", __LINE__, __FILE__,
+ "getFreeSpace returned unreasonable value");
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_file_size()", __LINE__, __FILE__, E.getCDetailMsg());
}
@@ -408,9 +413,8 @@ static void test_file_size()
if (ret < 0)
issue_fail_msg("test_file_size()", __LINE__, __FILE__, "H5Pclose failed");
-} // test_file_size()
+} // test_file_size()
-
/*-------------------------------------------------------------------------
* Function: test_file_num
*
@@ -422,12 +426,13 @@ static void test_file_size()
* April, 2019
*-------------------------------------------------------------------------
*/
-static void test_file_num()
+static void
+test_file_num()
{
// Output message about test being performed
SUBTEST("File Number");
- hid_t fapl_id;
+ hid_t fapl_id;
fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template
try {
@@ -454,10 +459,9 @@ static void test_file_num()
issue_fail_msg("test_file_num()", __LINE__, __FILE__, "getFileNum() returned wrong value");
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_file_num()", __LINE__, __FILE__, E.getCDetailMsg());
}
@@ -466,9 +470,8 @@ static void test_file_num()
if (ret < 0)
issue_fail_msg("test_file_num()", __LINE__, __FILE__, "H5Pclose failed");
-} // test_file_num()
+} // test_file_num()
-
/*-------------------------------------------------------------------------
* Function: test_file_name
*
@@ -480,14 +483,14 @@ static void test_file_num()
* July, 2004
*-------------------------------------------------------------------------
*/
-const int RANK = 2;
-const int NX = 4;
-const int NY = 5;
-const H5std_string GROUPNAME ("group");
-const H5std_string DSETNAME ("dataset");
-const H5std_string DATTRNAME ("dataset attribute");
-const H5std_string FATTRNAME ("file attribute");
-const H5std_string DTYPENAME ("compound");
+const int RANK = 2;
+const int NX = 4;
+const int NY = 5;
+const H5std_string GROUPNAME("group");
+const H5std_string DSETNAME("dataset");
+const H5std_string DATTRNAME("dataset attribute");
+const H5std_string FATTRNAME("file attribute");
+const H5std_string DTYPENAME("compound");
// Compound datatype
typedef struct s1_t {
@@ -495,7 +498,8 @@ typedef struct s1_t {
float b;
} s1_t;
-static void test_file_name()
+static void
+test_file_name()
{
// Output message about test being performed.
SUBTEST("File Name");
@@ -517,11 +521,11 @@ static void test_file_name()
verify_val(file_name, FILE4, "Group::getFileName", __LINE__, __FILE__);
// Create the data space.
- hsize_t dims[RANK] = {NX, NY};
+ hsize_t dims[RANK] = {NX, NY};
DataSpace space(RANK, dims);
// Create a new dataset.
- DataSet dataset(file4.createDataSet (DSETNAME, PredType::NATIVE_INT, space));
+ DataSet dataset(file4.createDataSet(DSETNAME, PredType::NATIVE_INT, space));
// Get and verify file name via a dataset.
file_name = dataset.getFileName();
@@ -535,7 +539,7 @@ static void test_file_name()
verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__);
// Create a compound datatype.
- CompType comp_type (sizeof(s1_t));
+ CompType comp_type(sizeof(s1_t));
// Insert fields.
comp_type.insertMember("a", HOFFSET(s1_t, a), PredType::NATIVE_INT);
@@ -548,15 +552,13 @@ static void test_file_name()
comp_type.getFileName();
verify_val(file_name, FILE4, "CompType::getFileName", __LINE__, __FILE__);
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_file_name()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_file_name()
+} // test_file_name()
-
/*-------------------------------------------------------------------------
*
* Function: test_file_attribute
@@ -566,15 +568,16 @@ static void test_file_name()
* Return None
*-------------------------------------------------------------------------
*/
-const int RANK1 = 1;
-const int ATTR1_DIM1 = 3;
-const H5std_string FILE5("tfattrs.h5");
-const H5std_string FATTR1_NAME ("file attribute 1");
-const H5std_string FATTR2_NAME ("file attribute 2");
-int fattr_data[ATTR1_DIM1]={512,-234,98123}; // Test data for file attribute
-int dattr_data[ATTR1_DIM1]={256,-123,1000}; // Test data for dataset attribute
-
-static void test_file_attribute()
+const int RANK1 = 1;
+const int ATTR1_DIM1 = 3;
+const H5std_string FILE5("tfattrs.h5");
+const H5std_string FATTR1_NAME("file attribute 1");
+const H5std_string FATTR2_NAME("file attribute 2");
+int fattr_data[ATTR1_DIM1] = {512, -234, 98123}; // Test data for file attribute
+int dattr_data[ATTR1_DIM1] = {256, -123, 1000}; // Test data for dataset attribute
+
+static void
+test_file_attribute()
{
int rdata[ATTR1_DIM1];
int i;
@@ -588,7 +591,7 @@ static void test_file_attribute()
H5File file5(FILE5, H5F_ACC_TRUNC);
// Create the data space
- hsize_t dims[RANK1] = {ATTR1_DIM1};
+ hsize_t dims[RANK1] = {ATTR1_DIM1};
DataSpace space(RANK1, dims);
// Create two attributes for the file
@@ -601,13 +604,15 @@ static void test_file_attribute()
// Try to create the same attribute again (should fail)
Attribute fattr_dup(file5.createAttribute(FATTR2_NAME, PredType::NATIVE_INT, space));
// Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("H5File createAttribute", "Attempted to create an existing attribute.");
+ throw InvalidActionException("H5File createAttribute",
+ "Attempted to create an existing attribute.");
}
- catch (AttributeIException& E) // catch creating existing attribute
- {} // do nothing, FAIL expected
+ catch (AttributeIException &E) // catch creating existing attribute
+ {
+ } // do nothing, FAIL expected
// Create a new dataset
- DataSet dataset(file5.createDataSet (DSETNAME, PredType::NATIVE_INT, space));
+ DataSet dataset(file5.createDataSet(DSETNAME, PredType::NATIVE_INT, space));
// Create an attribute for the dataset
Attribute dattr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space));
@@ -663,20 +668,18 @@ static void test_file_attribute()
if (rdata[i] != dattr_data[i]) {
H5_FAILED();
cerr << endl;
- cerr << "element [" << i << "] is " << rdata[i] <<
- "but should have been " << dattr_data[i] << endl;
- }
+ cerr << "element [" << i << "] is " << rdata[i] << "but should have been " << dattr_data[i]
+ << endl;
}
+ }
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_file_attribute()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_file_attribute()
+} // test_file_attribute()
-
/*-------------------------------------------------------------------------
* Function: test_libver_bounds_real
*
@@ -690,94 +693,92 @@ static void test_file_attribute()
* March, 2015
*-------------------------------------------------------------------------
*/
-const H5std_string FILE6("tfile5.h5");
-const H5std_string ROOTGROUP("/");
-const H5std_string GROUP1("/G1");
-const H5std_string SUBGROUP3("/G1/G3");
-
-static void test_libver_bounds_real(
- H5F_libver_t libver_create, unsigned oh_vers_create,
- H5F_libver_t libver_mod, unsigned oh_vers_mod)
+const H5std_string FILE6("tfile5.h5");
+const H5std_string ROOTGROUP("/");
+const H5std_string GROUP1("/G1");
+const H5std_string SUBGROUP3("/G1/G3");
+
+static void
+test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, H5F_libver_t libver_mod,
+ unsigned oh_vers_mod)
{
try {
- /*
- * Create a new file using the default creation property and access property
- * with latest library version.
- */
- FileAccPropList fapl;
- fapl.setLibverBounds(libver_create, H5F_LIBVER_LATEST);
- H5File file(FILE6, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+ /*
+ * Create a new file using the default creation property and access property
+ * with latest library version.
+ */
+ FileAccPropList fapl;
+ fapl.setLibverBounds(libver_create, H5F_LIBVER_LATEST);
+ H5File file(FILE6, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
- /*
- * Make sure the root group has the correct object header version
- */
- unsigned obj_version = file.childObjVersion(ROOTGROUP);
- verify_val(obj_version, oh_vers_create, "H5File::childObjVersion", __LINE__, __FILE__);
-
- // Verify object header version another way
- H5O_native_info_t ninfo;
- HDmemset(&ninfo, 0, sizeof(ninfo));
- file.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR);
- verify_val(ninfo.hdr.version, oh_vers_create, "H5File::getNativeObjinfo", __LINE__, __FILE__);
-
- /*
- * Reopen the file and make sure the root group still has the correct
- * version
- */
- file.close();
+ /*
+ * Make sure the root group has the correct object header version
+ */
+ unsigned obj_version = file.childObjVersion(ROOTGROUP);
+ verify_val(obj_version, oh_vers_create, "H5File::childObjVersion", __LINE__, __FILE__);
- fapl.setLibverBounds(libver_mod, H5F_LIBVER_LATEST);
+ // Verify object header version another way
+ H5O_native_info_t ninfo;
+ HDmemset(&ninfo, 0, sizeof(ninfo));
+ file.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR);
+ verify_val(ninfo.hdr.version, oh_vers_create, "H5File::getNativeObjinfo", __LINE__, __FILE__);
- file.openFile(FILE6, H5F_ACC_RDWR, fapl);
+ /*
+ * Reopen the file and make sure the root group still has the correct
+ * version
+ */
+ file.close();
- obj_version = file.childObjVersion(ROOTGROUP);
- verify_val(obj_version, oh_vers_create, "H5File::childObjVersion", __LINE__, __FILE__);
+ fapl.setLibverBounds(libver_mod, H5F_LIBVER_LATEST);
- /*
- * Create a group named "/G1" in the file, and make sure it has the correct
- * object header version
- */
- Group group = file.createGroup(GROUP1);
+ file.openFile(FILE6, H5F_ACC_RDWR, fapl);
- obj_version = group.objVersion();
- verify_val(obj_version, oh_vers_mod, "Group::objVersion", __LINE__, __FILE__);
+ obj_version = file.childObjVersion(ROOTGROUP);
+ verify_val(obj_version, oh_vers_create, "H5File::childObjVersion", __LINE__, __FILE__);
- // Verify object header version another way
- HDmemset(&ninfo, 0, sizeof(ninfo));
- group.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR);
- verify_val(ninfo.hdr.version, oh_vers_mod, "Group::getNativeObjinfo", __LINE__, __FILE__);
+ /*
+ * Create a group named "/G1" in the file, and make sure it has the correct
+ * object header version
+ */
+ Group group = file.createGroup(GROUP1);
- group.close(); // close "/G1"
+ obj_version = group.objVersion();
+ verify_val(obj_version, oh_vers_mod, "Group::objVersion", __LINE__, __FILE__);
- /*
- * Create a group named "/G1/G3" in the file, and make sure it has the
- * correct object header version
- */
- group = file.createGroup(SUBGROUP3);
+ // Verify object header version another way
+ HDmemset(&ninfo, 0, sizeof(ninfo));
+ group.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR);
+ verify_val(ninfo.hdr.version, oh_vers_mod, "Group::getNativeObjinfo", __LINE__, __FILE__);
- obj_version = group.objVersion();
- verify_val(obj_version, oh_vers_mod, "Group::objVersion", __LINE__, __FILE__);
+ group.close(); // close "/G1"
- group.close(); // close "/G1/G3"
+ /*
+ * Create a group named "/G1/G3" in the file, and make sure it has the
+ * correct object header version
+ */
+ group = file.createGroup(SUBGROUP3);
- /*
- * Make sure the root group still has the correct object header version
- */
- obj_version = file.childObjVersion(ROOTGROUP);
- verify_val(obj_version, oh_vers_create, "H5File::childObjVersion", __LINE__, __FILE__);
+ obj_version = group.objVersion();
+ verify_val(obj_version, oh_vers_mod, "Group::objVersion", __LINE__, __FILE__);
- // Everything should be closed as they go out of scope
- } // end of try block
+ group.close(); // close "/G1/G3"
- catch (Exception& E)
- {
+ /*
+ * Make sure the root group still has the correct object header version
+ */
+ obj_version = file.childObjVersion(ROOTGROUP);
+ verify_val(obj_version, oh_vers_create, "H5File::childObjVersion", __LINE__, __FILE__);
+
+ // Everything should be closed as they go out of scope
+ } // end of try block
+
+ catch (Exception &E) {
issue_fail_msg("test_libver_bounds_real()", __LINE__, __FILE__, E.getCDetailMsg());
}
} /* end test_libver_bounds_real() */
-
/*-------------------------------------------------------------------------
*
* Function: test_libver_bounds
@@ -791,7 +792,8 @@ static void test_libver_bounds_real(
* March 2015
*-------------------------------------------------------------------------
*/
-static void test_libver_bounds()
+static void
+test_libver_bounds()
{
// Output message about test being performed
SUBTEST("Setting library version bounds");
@@ -802,7 +804,6 @@ static void test_libver_bounds()
PASSED();
} /* end test_libver_bounds() */
-
/*-------------------------------------------------------------------------
* Function: test_commonfg
*
@@ -814,7 +815,8 @@ static void test_libver_bounds()
* March, 2015
*-------------------------------------------------------------------------
*/
-static void test_commonfg()
+static void
+test_commonfg()
{
// Output message about test being performed
SUBTEST("Root group");
@@ -830,11 +832,11 @@ static void test_commonfg()
Group group(rootgroup.createGroup(GROUPNAME, 0));
// Create the data space.
- hsize_t dims[RANK] = {NX, NY};
+ hsize_t dims[RANK] = {NX, NY};
DataSpace space(RANK, dims);
// Create a new dataset.
- DataSet dataset(group.createDataSet (DSETNAME, PredType::NATIVE_INT, space));
+ DataSet dataset(group.createDataSet(DSETNAME, PredType::NATIVE_INT, space));
// Get and verify file name via a dataset.
H5std_string file_name = dataset.getFileName();
@@ -855,16 +857,14 @@ static void test_commonfg()
verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__);
PASSED();
- } // end of try block
+ } // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_commonfg()", __LINE__, __FILE__, E.getCDetailMsg());
}
} /* end test_commonfg() */
-
/*-------------------------------------------------------------------------
* Function: test_file_info
*
@@ -879,16 +879,17 @@ static void test_commonfg()
*-------------------------------------------------------------------------
*/
const H5std_string FILE7("tfile7.h5");
-const hsize_t FSP_SIZE_DEF = 4096;
-const hsize_t FSP_SIZE512 = 512;
+const hsize_t FSP_SIZE_DEF = 4096;
+const hsize_t FSP_SIZE512 = 512;
-static void test_file_info()
+static void
+test_file_info()
{
// Output message about test being performed
SUBTEST("File general information");
- hsize_t out_threshold = 0; // Free space section threshold to get
- hbool_t out_persist = FALSE;// Persist free-space read
+ hsize_t out_threshold = 0; // Free space section threshold to get
+ hbool_t out_persist = FALSE; // Persist free-space read
// File space handling strategy
H5F_fspace_strategy_t out_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR;
@@ -919,7 +920,8 @@ static void test_file_info()
/* Retrieve file space page size */
hsize_t out_fsp_psize = fcpl.getFileSpacePagesize();
- verify_val(out_fsp_psize, FSP_SIZE_DEF, "FileCreatPropList::getFileSpacePagesize", __LINE__, __FILE__);
+ verify_val(out_fsp_psize, FSP_SIZE_DEF, "FileCreatPropList::getFileSpacePagesize", __LINE__,
+ __FILE__);
// Set various file information.
fcpl.setUserblock(F2_USERBLOCK_SIZE);
@@ -927,9 +929,9 @@ static void test_file_info()
fcpl.setSymk(F2_SYM_INTERN_K, F2_SYM_LEAF_K);
fcpl.setIstorek(F2_ISTORE);
- hsize_t threshold = 5; // Free space section threshold to set
- hbool_t persist = TRUE; // Persist free-space to set
- H5F_fspace_strategy_t strategy = H5F_FSPACE_STRATEGY_PAGE;
+ hsize_t threshold = 5; // Free space section threshold to set
+ hbool_t persist = TRUE; // Persist free-space to set
+ H5F_fspace_strategy_t strategy = H5F_FSPACE_STRATEGY_PAGE;
fcpl.setFileSpaceStrategy(strategy, persist, threshold);
fcpl.setFileSpacePagesize(FSP_SIZE512);
@@ -981,10 +983,10 @@ static void test_file_info()
unsigned istore_ik = fcpl2.getIstorek();
verify_val(istore_ik, F2_ISTORE, "FileCreatPropList::getIstorek", __LINE__, __FILE__);
- /* ret=H5Pget_shared_mesg_nindexes(fcpl2,&nindexes);
- CHECK(ret, FAIL, "H5Pget_shared_mesg_nindexes");
- VERIFY(nindexes, MISC11_NINDEXES, "H5Pget_shared_mesg_nindexes");
- */
+ /* ret=H5Pget_shared_mesg_nindexes(fcpl2,&nindexes);
+ CHECK(ret, FAIL, "H5Pget_shared_mesg_nindexes");
+ VERIFY(nindexes, MISC11_NINDEXES, "H5Pget_shared_mesg_nindexes");
+ */
// Get and verify the file space info from the creation property list */
fcpl2.getFileSpaceStrategy(out_strategy, out_persist, out_threshold);
@@ -996,14 +998,12 @@ static void test_file_info()
verify_val(out_fsp_psize, FSP_SIZE512, "FileCreatPropList::getFileSpacePagesize", __LINE__, __FILE__);
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
issue_fail_msg("test_filespace_info()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} /* test_file_info() */
+} /* test_file_info() */
-
/*-------------------------------------------------------------------------
* Function: test_file
*
@@ -1015,24 +1015,23 @@ static void test_file_info()
* January 2001
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_file()
+extern "C" void
+test_file()
{
// Output message about test being performed
MESSAGE(5, ("Testing File I/O Operations\n"));
- test_file_create(); // Test file creation (also creation templates)
- test_file_open(); // Test file opening
- test_file_size(); // Test file size
- test_file_num(); // Test file number
- test_file_name(); // Test getting file's name
- test_file_attribute(); // Test file attribute feature
- test_libver_bounds(); // Test format version
- test_commonfg(); // Test H5File as a root group
- test_file_info(); // Test various file info
-} // test_file()
-
-
+ test_file_create(); // Test file creation (also creation templates)
+ test_file_open(); // Test file opening
+ test_file_size(); // Test file size
+ test_file_num(); // Test file number
+ test_file_name(); // Test getting file's name
+ test_file_attribute(); // Test file attribute feature
+ test_libver_bounds(); // Test format version
+ test_commonfg(); // Test H5File as a root group
+ test_file_info(); // Test various file info
+} // test_file()
+
/*-------------------------------------------------------------------------
* Function: cleanup_file
*
@@ -1044,7 +1043,8 @@ void test_file()
#ifdef __cplusplus
extern "C"
#endif
-void cleanup_file()
+ void
+ cleanup_file()
{
HDremove(FILE1.c_str());
HDremove(FILE2.c_str());
@@ -1053,4 +1053,4 @@ void cleanup_file()
HDremove(FILE5.c_str());
HDremove(FILE6.c_str());
HDremove(FILE7.c_str());
-} // cleanup_file
+} // cleanup_file
diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp
index 5a493ac..e7788e5 100644
--- a/c++/test/tfilter.cpp
+++ b/c++/test/tfilter.cpp
@@ -25,14 +25,14 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
-#define DSET_DIM1 100
-#define DSET_DIM2 200
+#define DSET_DIM1 100
+#define DSET_DIM2 200
#define FILTER_CHUNK_DIM1 2
#define FILTER_CHUNK_DIM2 25
@@ -56,16 +56,15 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
static size_t filter_bogus(size_t nbytes);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_BOGUS[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_BOGUS, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "bogus", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)filter_bogus, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_BOGUS, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "bogus", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ (H5Z_func_t)filter_bogus, /* The actual filter function */
}};
-
/*-------------------------------------------------------------------------
* Function: filter_bogus
*
@@ -90,7 +89,6 @@ filter_bogus(size_t nbytes)
return nbytes;
}
-
/*-------------------------------------------------------------------------
* Function: test_null_filter
*
@@ -107,25 +105,26 @@ filter_bogus(size_t nbytes)
*/
const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2};
-static void test_null_filter()
+static void
+test_null_filter()
{
// Output message about test being performed
SUBTEST("'Null' filter");
try {
- //hsize_t null_size; // Size of dataset with null filter
+ // hsize_t null_size; // Size of dataset with null filter
// Prepare dataset create property list
DSetCreatPropList dsplist;
dsplist.setChunk(2, chunk_size);
- if (H5Zregister (H5Z_BOGUS)<0)
+ if (H5Zregister(H5Z_BOGUS) < 0)
throw Exception("test_null_filter", "H5Zregister failed");
// Set some pretent filter
dsplist.setFilter(H5Z_FILTER_BOGUS);
// this function is just a stub right now; will work on it later - BMR
- //if(test_filter_internal(file,DSET_BOGUS_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&null_size)<0)
+ // if(test_filter_internal(file,DSET_BOGUS_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&null_size)<0)
// throw Exception("test_null_filter", "test_filter_internal failed");
// Close objects.
@@ -134,13 +133,11 @@ static void test_null_filter()
} // end of try
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_null_filter()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_null_filter
+} // test_null_filter
-
/*-------------------------------------------------------------------------
* Function: test_szip_filter
*
@@ -157,28 +154,29 @@ static void test_null_filter()
*/
const H5std_string DSET_SZIP_NAME("szipped dataset");
-static void test_szip_filter(H5File& file1)
+static void
+test_szip_filter(H5File &file1)
{
#ifdef H5_HAVE_FILTER_SZIP
int points[DSET_DIM1][DSET_DIM2], check[DSET_DIM1][DSET_DIM2];
- unsigned szip_options_mask=H5_SZIP_NN_OPTION_MASK;
- unsigned szip_pixels_per_block=4;
+ unsigned szip_options_mask = H5_SZIP_NN_OPTION_MASK;
+ unsigned szip_pixels_per_block = 4;
// Output message about test being performed
SUBTEST("szip filter (with encoder)");
- if ( h5_szip_can_encode() == 1) {
- char* tconv_buf = new char [1000];
+ if (h5_szip_can_encode() == 1) {
+ char *tconv_buf = new char[1000];
try {
- const hsize_t size[2] = {DSET_DIM1, DSET_DIM2};
+ const hsize_t size[2] = {DSET_DIM1, DSET_DIM2};
// Create the data space
DataSpace space1(2, size, NULL);
// Create a small conversion buffer to test strip mining (?)
DSetMemXferPropList xfer;
- xfer.setBuffer (1000, tconv_buf, NULL);
+ xfer.setBuffer(1000, tconv_buf, NULL);
// Prepare dataset create property list
DSetCreatPropList dsplist;
@@ -188,27 +186,24 @@ static void test_szip_filter(H5File& file1)
dsplist.setSzip(szip_options_mask, szip_pixels_per_block);
// Create a dataset with szip compression
- DataSpace space2 (2, size, NULL);
- DataSet dataset(file1.createDataSet (DSET_SZIP_NAME, PredType::NATIVE_INT, space2, dsplist));
+ DataSpace space2(2, size, NULL);
+ DataSet dataset(file1.createDataSet(DSET_SZIP_NAME, PredType::NATIVE_INT, space2, dsplist));
hsize_t i, j, n;
- for (i=n=0; i<size[0]; i++)
- {
- for (j=0; j<size[1]; j++)
- {
+ for (i = n = 0; i < size[0]; i++) {
+ for (j = 0; j < size[1]; j++) {
points[i][j] = (int)n++;
}
}
// Write to the dataset then read back the values
- dataset.write ((void*)points, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
- dataset.read ((void*)check, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset.write((void *)points, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset.read((void *)check, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
// Check that the values read are the same as the values written
for (i = 0; i < size[0]; i++)
- for (j = 0; j < size[1]; j++)
- {
- int status = check_values (i, j, points[i][j], check[i][j]);
+ for (j = 0; j < size[1]; j++) {
+ int status = check_values(i, j, points[i][j], check[i][j]);
if (status == -1)
throw Exception("test_szip_filter", "Failed in testing szip method");
}
@@ -217,8 +212,7 @@ static void test_szip_filter(H5File& file1)
} // end of try
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_szip_filter()", __LINE__, __FILE__, E.getCDetailMsg());
}
@@ -228,15 +222,14 @@ static void test_szip_filter(H5File& file1)
SKIPPED();
}
-#else /* H5_HAVE_FILTER_SZIP */
+#else /* H5_HAVE_FILTER_SZIP */
SUBTEST("szip filter");
SKIPPED();
H5std_string fname = file1.getFileName();
cerr << " Szip filter not enabled for file '" << fname << "'" << endl;
#endif /* H5_HAVE_FILTER_SZIP */
-} // test_szip_filter
+} // test_szip_filter
-
/*-------------------------------------------------------------------------
* Function: test_filters
*
@@ -245,18 +238,17 @@ static void test_szip_filter(H5File& file1)
* Return None
*-------------------------------------------------------------------------
*/
-const H5std_string FILE1("tfilters.h5");
-extern "C"
-void test_filters()
+const H5std_string FILE1("tfilters.h5");
+extern "C" void
+test_filters()
{
// Output message about test being performed
MESSAGE(5, ("Testing Various Filters\n"));
- hid_t fapl_id;
+ hid_t fapl_id;
fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template
- try
- {
+ try {
// Use the file access template id to create a file access prop. list
FileAccPropList fapl(fapl_id);
@@ -266,13 +258,11 @@ void test_filters()
test_null_filter();
test_szip_filter(file1);
}
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_filters()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_filters()
+} // test_filters()
-
/*-------------------------------------------------------------------------
* Function: cleanup_filters
*
@@ -281,8 +271,8 @@ void test_filters()
* Return none
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_filters()
+extern "C" void
+cleanup_filters()
{
HDremove(FILE1.c_str());
}
diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp
index d4853da..8709c25 100644
--- a/c++/test/th5s.cpp
+++ b/c++/test/th5s.cpp
@@ -28,39 +28,39 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
-#include "H5srcdir.h" // srcdir querying header file
+#include "h5cpputil.h" // C++ utilility header file
+#include "H5srcdir.h" // srcdir querying header file
-const H5std_string TESTFILE("th5s.h5");
-const H5std_string DATAFILE("th5s1.h5");
+const H5std_string TESTFILE("th5s.h5");
+const H5std_string DATAFILE("th5s1.h5");
/* 3-D dataset with fixed dimensions */
const H5std_string SPACE1_NAME("Space1");
-const int SPACE1_RANK = 3;
-const int SPACE1_DIM1 = 3;
-const int SPACE1_DIM2 = 15;
-const int SPACE1_DIM3 = 13;
+const int SPACE1_RANK = 3;
+const int SPACE1_DIM1 = 3;
+const int SPACE1_DIM2 = 15;
+const int SPACE1_DIM3 = 13;
/* 4-D dataset with one unlimited dimension */
const H5std_string SPACE2_NAME("Space2");
-const int SPACE2_RANK = 4;
-const int SPACE2_DIM1 = 0;
-const int SPACE2_DIM2 = 15;
-const int SPACE2_DIM3 = 13;
-const int SPACE2_DIM4 = 23;
-const hsize_t SPACE2_MAX1 = H5S_UNLIMITED;
-const hsize_t SPACE2_MAX2 = 15;
-const hsize_t SPACE2_MAX3 = 13;
-const hsize_t SPACE2_MAX4 = 23;
+const int SPACE2_RANK = 4;
+const int SPACE2_DIM1 = 0;
+const int SPACE2_DIM2 = 15;
+const int SPACE2_DIM3 = 13;
+const int SPACE2_DIM4 = 23;
+const hsize_t SPACE2_MAX1 = H5S_UNLIMITED;
+const hsize_t SPACE2_MAX2 = 15;
+const hsize_t SPACE2_MAX3 = 13;
+const hsize_t SPACE2_MAX4 = 23;
/* Scalar dataset with simple datatype */
const H5std_string SPACE3_NAME("Scalar1");
-const int SPACE3_RANK = 0;
-unsigned space3_data=65;
+const int SPACE3_RANK = 0;
+unsigned space3_data = 65;
/* Scalar dataset with compound datatype */
const H5std_string SPACE4_NAME("Scalar2");
@@ -68,21 +68,20 @@ const H5std_string SPACE4_FIELDNAME1("c1");
const H5std_string SPACE4_FIELDNAME2("u");
const H5std_string SPACE4_FIELDNAME3("f");
const H5std_string SPACE4_FIELDNAME4("c2");
-size_t space4_field1_off=0;
-size_t space4_field2_off=0;
-size_t space4_field3_off=0;
-size_t space4_field4_off=0;
+size_t space4_field1_off = 0;
+size_t space4_field2_off = 0;
+size_t space4_field3_off = 0;
+size_t space4_field4_off = 0;
struct space4_struct {
- char c1;
+ char c1;
unsigned u;
- float f;
- char c2;
- } space4_data={'v',987123,(float)-3.14,'g'}; /* Test data for 4th dataspace */
+ float f;
+ char c2;
+} space4_data = {'v', 987123, (float)-3.14, 'g'}; /* Test data for 4th dataspace */
/* Null dataspace */
int space5_data = 7;
-
/*-------------------------------------------------------------------------
* Function: test_h5s_basic
*
@@ -105,11 +104,12 @@ int space5_data = 7;
* size to be zero. So I took out the test against it.
*-------------------------------------------------------------------------
*/
-static void test_h5s_basic()
+static void
+test_h5s_basic()
{
hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2, SPACE2_DIM3, SPACE2_DIM4};
- hsize_t dims3[H5S_MAX_RANK+1];
+ hsize_t dims3[H5S_MAX_RANK + 1];
hsize_t tmax[4];
// Output message about test being performed
@@ -117,13 +117,13 @@ static void test_h5s_basic()
try {
// Create simple dataspace sid1
- DataSpace sid1 (SPACE1_RANK, dims1 );
+ DataSpace sid1(SPACE1_RANK, dims1);
// Get simple extent npoints of the dataspace sid1 and verify it
hssize_t n; // Number of dataspace elements
n = sid1.getSimpleExtentNpoints();
verify_val((long)n, (long)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3),
- "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Get the logical rank of dataspace sid1 and verify it
int rank; // Logical rank of dataspace
@@ -131,21 +131,21 @@ static void test_h5s_basic()
verify_val(rank, SPACE1_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
// Retrieves dimension size of dataspace sid1 and verify it
- int ndims; // Number of dimensions
+ int ndims; // Number of dimensions
hsize_t tdims[4]; // Dimension array to test with
- ndims = sid1.getSimpleExtentDims( tdims );
+ ndims = sid1.getSimpleExtentDims(tdims);
verify_val(ndims, SPACE1_RANK, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
verify_val(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(unsigned)), 0,
- "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
// Create simple dataspace sid2
- hsize_t max2[] = {SPACE2_MAX1, SPACE2_MAX2, SPACE2_MAX3, SPACE2_MAX4};
- DataSpace sid2 (SPACE2_RANK, dims2, max2);
+ hsize_t max2[] = {SPACE2_MAX1, SPACE2_MAX2, SPACE2_MAX3, SPACE2_MAX4};
+ DataSpace sid2(SPACE2_RANK, dims2, max2);
// Get simple extent npoints of dataspace sid2 and verify it
n = sid2.getSimpleExtentNpoints();
verify_val((long)n, (long)(SPACE2_DIM1 * SPACE2_DIM2 * SPACE2_DIM3 * SPACE2_DIM4),
- "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Get the logical rank of dataspace sid2 and verify it
rank = sid2.getSimpleExtentNdims();
@@ -153,34 +153,36 @@ static void test_h5s_basic()
// Retrieves dimension size and max size of dataspace sid2 and
// verify them
- ndims = sid2.getSimpleExtentDims( tdims, tmax );
+ ndims = sid2.getSimpleExtentDims(tdims, tmax);
verify_val(HDmemcmp(tdims, dims2, SPACE2_RANK * sizeof(unsigned)), 0,
- "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
- verify_val(HDmemcmp(tmax, max2, SPACE2_RANK * sizeof(unsigned)), 0,
- "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ verify_val(HDmemcmp(tmax, max2, SPACE2_RANK * sizeof(unsigned)), 0, "DataSpace::getSimpleExtentDims",
+ __LINE__, __FILE__);
// Check to be sure we can't create a simple data space that has too
// many dimensions.
try {
- DataSpace manydims_ds(H5S_MAX_RANK+1, dims3, NULL);
+ DataSpace manydims_ds(H5S_MAX_RANK + 1, dims3, NULL);
// Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("DataSpace constructor", "Library allowed overwrite of existing dataset");
+ throw InvalidActionException("DataSpace constructor",
+ "Library allowed overwrite of existing dataset");
}
- catch (DataSpaceIException& E) // Simple data space with too many dims
- {} // do nothing, exception expected
-
- /*
- * Try reading a file that has been prepared that has a dataset with a
- * higher dimensionality than what the library can handle.
- *
- * If this test fails and the H5S_MAX_RANK variable has changed, follow
- * the instructions in space_overflow.c for regenating the th5s.h5 file.
- */
- char *tmp_str = new char[TESTFILE.length()+1];
+ catch (DataSpaceIException &E) // Simple data space with too many dims
+ {
+ } // do nothing, exception expected
+
+ /*
+ * Try reading a file that has been prepared that has a dataset with a
+ * higher dimensionality than what the library can handle.
+ *
+ * If this test fails and the H5S_MAX_RANK variable has changed, follow
+ * the instructions in space_overflow.c for regenating the th5s.h5 file.
+ */
+ char *tmp_str = new char[TESTFILE.length() + 1];
strcpy(tmp_str, TESTFILE.c_str());
const char *testfile = H5_get_srcdir_filename(tmp_str);
- delete []tmp_str;
+ delete[] tmp_str;
// Create file
H5File fid1(testfile, H5F_ACC_RDONLY);
@@ -188,33 +190,33 @@ static void test_h5s_basic()
// Try to open the dataset that has higher dimensionality than
// what the library can handle and this operation should fail.
try {
- DataSet dset1 = fid1.openDataSet( "dset" );
+ DataSet dset1 = fid1.openDataSet("dset");
// Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("H5File::openDataSet", "Opening a dataset with higher dimensionality than what the library can handle");
+ throw InvalidActionException(
+ "H5File::openDataSet",
+ "Opening a dataset with higher dimensionality than what the library can handle");
}
- catch (FileIException& E) // catching higher dimensionality dataset
- {} // do nothing, exception expected
+ catch (FileIException &E) // catching higher dimensionality dataset
+ {
+ } // do nothing, exception expected
- // CHECK_I(ret, "H5Fclose"); // leave this here, later, fake a failure
- // in the p_close see how this will handle it. - BMR
+ // CHECK_I(ret, "H5Fclose"); // leave this here, later, fake a failure
+ // in the p_close see how this will handle it. - BMR
PASSED();
- } // end of try block
+ } // end of try block
- catch (InvalidActionException& E)
- {
+ catch (InvalidActionException &E) {
cerr << " FAILED" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
}
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_h5s_basic()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_h5s_basic()
+} // test_h5s_basic()
-
/*-------------------------------------------------------------------------
* Function: test_h5s_scalar_write
*
@@ -234,7 +236,8 @@ static void test_h5s_basic()
* with a special routine.
*-------------------------------------------------------------------------
*/
-static void test_h5s_scalar_write()
+static void
+test_h5s_scalar_write()
{
// Output message about test being performed
SUBTEST("Scalar Dataspace Writing");
@@ -246,7 +249,7 @@ static void test_h5s_scalar_write()
// Create scalar dataspace
DataSpace sid1(SPACE3_RANK, NULL);
- //n = H5Sget_simple_extent_npoints(sid1);
+ // n = H5Sget_simple_extent_npoints(sid1);
hssize_t n; // Number of dataspace elements
n = sid1.getSimpleExtentNpoints();
verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
@@ -256,9 +259,9 @@ static void test_h5s_scalar_write()
verify_val(rank, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
// Retrieves dimension size of dataspace sid1 and verify it
- int ndims; // Number of dimensions
+ int ndims; // Number of dimensions
hsize_t tdims[4]; // Dimension array to test with
- ndims = sid1.getSimpleExtentDims( tdims );
+ ndims = sid1.getSimpleExtentDims(tdims);
verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
// Verify extent type
@@ -267,18 +270,16 @@ static void test_h5s_scalar_write()
verify_val(ext_type, H5S_SCALAR, "DataSpace::getSimpleExtentType", __LINE__, __FILE__);
// Create and write a dataset
- DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT,sid1);
+ DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT, sid1);
dataset.write(&space3_data, PredType::NATIVE_UINT);
PASSED();
} // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_h5s_scalar_write()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_h5s_scalar_write()
+} // test_h5s_scalar_write()
-
/*-------------------------------------------------------------------------
* Function: test_h5s_scalar_read
*
@@ -298,7 +299,8 @@ static void test_h5s_scalar_write()
* with a special routine.
*-------------------------------------------------------------------------
*/
-static void test_h5s_scalar_read()
+static void
+test_h5s_scalar_read()
{
hsize_t tdims[4]; // Dimension array to test with
@@ -331,16 +333,14 @@ static void test_h5s_scalar_read()
verify_val(rdata, space3_data, "DataSet::read", __LINE__, __FILE__);
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
// all the exceptions caused by negative returned values by C APIs
issue_fail_msg("test_h5s_scalar_read()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_h5s_scalar_read()
+} // test_h5s_scalar_read()
-
/*-------------------------------------------------------------------------
* Function: test_h5s_null
*
@@ -360,7 +360,8 @@ static void test_h5s_scalar_read()
* with a special routine.
*-------------------------------------------------------------------------
*/
-static void test_h5s_null()
+static void
+test_h5s_null()
{
// Output message about test being performed
SUBTEST("Null Dataspace Writing");
@@ -377,7 +378,7 @@ static void test_h5s_null()
verify_val((long)n, 0, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Create a dataset
- DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT,sid1);
+ DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT, sid1);
// Try to write nothing to the dataset
dataset.write(&space5_data, PredType::NATIVE_INT);
@@ -388,13 +389,11 @@ static void test_h5s_null()
PASSED();
} // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_h5s_null()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_h5s_null()
+} // test_h5s_null()
-
/*-------------------------------------------------------------------------
* Function: test_h5s_compound_scalar_write
*
@@ -415,7 +414,8 @@ static void test_h5s_null()
* with a special routine.
*-------------------------------------------------------------------------
*/
-static void test_h5s_compound_scalar_write()
+static void
+test_h5s_compound_scalar_write()
{
// Output message about test being performed
SUBTEST("Compound Dataspace Writing");
@@ -426,18 +426,14 @@ static void test_h5s_compound_scalar_write()
// Create the compound datatype.
CompType tid1(sizeof(struct space4_struct));
- space4_field1_off=HOFFSET(struct space4_struct, c1);
- tid1.insertMember(SPACE4_FIELDNAME1, space4_field1_off,
- PredType::NATIVE_SCHAR);
- space4_field2_off=HOFFSET(struct space4_struct, u);
- tid1.insertMember(SPACE4_FIELDNAME2, space4_field2_off,
- PredType::NATIVE_UINT);
- space4_field3_off=HOFFSET(struct space4_struct, f);
- tid1.insertMember(SPACE4_FIELDNAME3, space4_field3_off,
- PredType::NATIVE_FLOAT);
- space4_field4_off=HOFFSET(struct space4_struct, c2);
- tid1.insertMember(SPACE4_FIELDNAME4, space4_field4_off,
- PredType::NATIVE_SCHAR);
+ space4_field1_off = HOFFSET(struct space4_struct, c1);
+ tid1.insertMember(SPACE4_FIELDNAME1, space4_field1_off, PredType::NATIVE_SCHAR);
+ space4_field2_off = HOFFSET(struct space4_struct, u);
+ tid1.insertMember(SPACE4_FIELDNAME2, space4_field2_off, PredType::NATIVE_UINT);
+ space4_field3_off = HOFFSET(struct space4_struct, f);
+ tid1.insertMember(SPACE4_FIELDNAME3, space4_field3_off, PredType::NATIVE_FLOAT);
+ space4_field4_off = HOFFSET(struct space4_struct, c2);
+ tid1.insertMember(SPACE4_FIELDNAME4, space4_field4_off, PredType::NATIVE_SCHAR);
// Create scalar dataspace
DataSpace sid1(SPACE3_RANK, NULL);
@@ -459,15 +455,13 @@ static void test_h5s_compound_scalar_write()
dataset.write(&space4_data, tid1);
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
// all the exceptions caused by negative returned values by C APIs
issue_fail_msg("test_h5s_compound_scalar_write()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_h5s_compound_scalar_write()
+} // test_h5s_compound_scalar_write()
-
/*-------------------------------------------------------------------------
* Function: test_h5s_compound_scalar_read
*
@@ -488,7 +482,8 @@ static void test_h5s_compound_scalar_write()
* with a special routine.
*-------------------------------------------------------------------------
*/
-static void test_h5s_compound_scalar_read()
+static void
+test_h5s_compound_scalar_read()
{
hsize_t tdims[4]; // Dimension array to test with
@@ -521,27 +516,24 @@ static void test_h5s_compound_scalar_read()
dataset.read(&rdata, type);
// Verify read data
- if(HDmemcmp(&space4_data,&rdata,sizeof(struct space4_struct)))
- {
- cerr << "scalar data different: space4_data.c1="
- << space4_data.c1 << ", read_data4.c1=" << rdata.c1 << endl;
- cerr << "scalar data different: space4_data.u="
- << space4_data.u << ", read_data4.u=" << rdata.u << endl;
- cerr << "scalar data different: space4_data.f="
- << space4_data.f << ", read_data4.f=" << rdata.f << endl;
- TestErrPrintf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n",
- space4_data.c1, rdata.c2);
+ if (HDmemcmp(&space4_data, &rdata, sizeof(struct space4_struct))) {
+ cerr << "scalar data different: space4_data.c1=" << space4_data.c1
+ << ", read_data4.c1=" << rdata.c1 << endl;
+ cerr << "scalar data different: space4_data.u=" << space4_data.u << ", read_data4.u=" << rdata.u
+ << endl;
+ cerr << "scalar data different: space4_data.f=" << space4_data.f << ", read_data4.f=" << rdata.f
+ << endl;
+ TestErrPrintf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n", space4_data.c1,
+ rdata.c2);
} // end if
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
// all the exceptions caused by negative returned values by C APIs
issue_fail_msg("test_h5s_compound_scalar_read()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_h5s_compound_scalar_read()
+} // test_h5s_compound_scalar_read()
-
/*-------------------------------------------------------------------------
* Function: test_h5s
*
@@ -553,21 +545,20 @@ static void test_h5s_compound_scalar_read()
* Mar 2001
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_h5s()
+extern "C" void
+test_h5s()
{
// Output message about test being performed
MESSAGE(5, ("Testing Dataspaces\n"));
- test_h5s_basic(); // Test basic H5S code
- test_h5s_scalar_write(); // Test scalar H5S writing code
- test_h5s_scalar_read(); // Test scalar H5S reading code
- test_h5s_null(); // Test null H5S code
- test_h5s_compound_scalar_write(); // Test compound datatype scalar H5S writing code
- test_h5s_compound_scalar_read(); // Test compound datatype scalar H5S reading code
-} // test_h5s()
+ test_h5s_basic(); // Test basic H5S code
+ test_h5s_scalar_write(); // Test scalar H5S writing code
+ test_h5s_scalar_read(); // Test scalar H5S reading code
+ test_h5s_null(); // Test null H5S code
+ test_h5s_compound_scalar_write(); // Test compound datatype scalar H5S writing code
+ test_h5s_compound_scalar_read(); // Test compound datatype scalar H5S reading code
+} // test_h5s()
-
/*-------------------------------------------------------------------------
* Function: cleanup_h5s
*
@@ -576,9 +567,8 @@ void test_h5s()
* Return None
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_h5s()
+extern "C" void
+cleanup_h5s()
{
HDremove(DATAFILE.c_str());
-} // cleanup_h5s
-
+} // cleanup_h5s
diff --git a/c++/test/titerate.cpp b/c++/test/titerate.cpp
index d69e8d2..83229b9 100644
--- a/c++/test/titerate.cpp
+++ b/c++/test/titerate.cpp
@@ -25,11 +25,11 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
/* Number of datasets for group iteration test */
#define NDATASETS 50
@@ -41,53 +41,48 @@ using namespace H5;
//#define ITER_NGROUPS 150
/* General maximum length of names used */
-#define NAMELEN 80
+#define NAMELEN 80
/* 1-D dataset with fixed dimensions */
//#define SPACE1_RANK 1
//#define SPACE1_DIM1 4
-const H5std_string FILE_ITERATE("titerate.h5");
-const H5std_string GROUP1("Top Group");
-const H5std_string GROUP1_PATH("/Top Group");
-const H5std_string GROUP1_1("Sub-Group 1.1");
-const H5std_string GROUP1_1_PATH("/Top Group/Sub-Group 1.1");
-const H5std_string GROUP1_2("Sub-Group 1.2");
-const H5std_string GROUP1_2_PATH("/Top Group/Sub-Group 1.2");
-const H5std_string DSET_DEFAULT_NAME("default");
-const H5std_string DSET_IN_FILE("Dataset in File");
-const H5std_string DSET_IN_FILE_PATH("/Dataset in File");
-const H5std_string DSET_IN_GRP1("Dataset in Group 1");
-const H5std_string DSET_IN_GRP1_PATH("/Top Group/Dataset in Group 1");
-const H5std_string DSET_IN_GRP1_2("Dataset in Group 1.2");
-const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset in Group 1.2");
-
-typedef enum {
- RET_ZERO,
- RET_TWO,
- RET_CHANGE,
- RET_CHANGE2
-} iter_enum;
+const H5std_string FILE_ITERATE("titerate.h5");
+const H5std_string GROUP1("Top Group");
+const H5std_string GROUP1_PATH("/Top Group");
+const H5std_string GROUP1_1("Sub-Group 1.1");
+const H5std_string GROUP1_1_PATH("/Top Group/Sub-Group 1.1");
+const H5std_string GROUP1_2("Sub-Group 1.2");
+const H5std_string GROUP1_2_PATH("/Top Group/Sub-Group 1.2");
+const H5std_string DSET_DEFAULT_NAME("default");
+const H5std_string DSET_IN_FILE("Dataset in File");
+const H5std_string DSET_IN_FILE_PATH("/Dataset in File");
+const H5std_string DSET_IN_GRP1("Dataset in Group 1");
+const H5std_string DSET_IN_GRP1_PATH("/Top Group/Dataset in Group 1");
+const H5std_string DSET_IN_GRP1_2("Dataset in Group 1.2");
+const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset in Group 1.2");
+
+typedef enum { RET_ZERO, RET_TWO, RET_CHANGE, RET_CHANGE2 } iter_enum;
/* Custom group iteration callback data */
typedef struct {
- char name[NAMELEN]; /* The name of the object */
- H5O_type_t type; /* The type of the object */
- iter_enum command; /* The type of return value */
+ char name[NAMELEN]; /* The name of the object */
+ H5O_type_t type; /* The type of the object */
+ iter_enum command; /* The type of return value */
} iter_info;
int iter_strcmp(const void *s1, const void *s2);
-
/*-------------------------------------------------------------------------
* Function: iter_strcmp
*
* Purpose String comparison routine for qsort
*-------------------------------------------------------------------------
*/
-int iter_strcmp(const void *s1, const void *s2)
+int
+iter_strcmp(const void *s1, const void *s2)
{
- return(HDstrcmp(*(const char * const *)s1,*(const char * const *)s2));
+ return (HDstrcmp(*(const char *const *)s1, *(const char *const *)s2));
}
/*-------------------------------------------------------------------------
@@ -96,36 +91,37 @@ int iter_strcmp(const void *s1, const void *s2)
* Purpose Custom link iteration callback routine
*-------------------------------------------------------------------------
*/
-static herr_t liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info, void *op_data)
+static herr_t
+liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info,
+ void *op_data)
{
- iter_info *info = (iter_info *)op_data;
- static int count = 0;
+ iter_info *info = (iter_info *)op_data;
+ static int count = 0;
static int count2 = 0;
HDstrcpy(info->name, name);
- switch(info->command) {
+ switch (info->command) {
case RET_ZERO:
- return(0);
+ return (0);
case RET_TWO:
- return(2);
+ return (2);
case RET_CHANGE:
count++;
- return(count > 10 ? 1 : 0);
+ return (count > 10 ? 1 : 0);
case RET_CHANGE2:
count2++;
- return(count2 > 10 ? 1 : 0);
+ return (count2 > 10 ? 1 : 0);
default:
printf("invalid iteration command");
- return(-1);
+ return (-1);
} /* end switch */
} /* end liter_cb() */
-
/*-------------------------------------------------------------------------
* Function: test_iter_group
*
@@ -138,14 +134,15 @@ static herr_t liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_i
* Friday, September 9, 2016
*-------------------------------------------------------------------------
*/
-static void test_iter_group(FileAccPropList& fapl)
+static void
+test_iter_group(FileAccPropList &fapl)
{
- int i; /* counting variable */
- hsize_t idx; /* Index in the group */
- char name[NAMELEN]; /* temporary name buffer */
- char *lnames[NDATASETS + 2];/* Names of the links created */
- iter_info info; /* Custom iteration information */
- herr_t ret; /* Generic return value */
+ int i; /* counting variable */
+ hsize_t idx; /* Index in the group */
+ char name[NAMELEN]; /* temporary name buffer */
+ char * lnames[NDATASETS + 2]; /* Names of the links created */
+ iter_info info; /* Custom iteration information */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
SUBTEST("Group Iteration");
@@ -157,8 +154,8 @@ static void test_iter_group(FileAccPropList& fapl)
/* Test iterating over empty group */
info.command = RET_ZERO;
- idx = 0;
- ret = H5Literate2(file.getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
+ idx = 0;
+ ret = H5Literate2(file.getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
verify_val(ret, SUCCEED, "H5Literate", __LINE__, __FILE__);
DataType datatype(PredType::NATIVE_INT);
@@ -166,16 +163,15 @@ static void test_iter_group(FileAccPropList& fapl)
// Create a scalar file space
DataSpace filespace;
- for (i=0; i< NDATASETS; i++)
- {
- sprintf(name, "Dataset %d", i);
+ for (i = 0; i < NDATASETS; i++) {
+ sprintf(name, "Dataset %d", i);
- // Create a dataset in the file
- DataSet dataset = file.createDataSet(name, datatype, filespace);
+ // Create a dataset in the file
+ DataSet dataset = file.createDataSet(name, datatype, filespace);
- /* Keep a copy of the dataset names */
- lnames[i] = HDstrdup(name);
- check_values(lnames[i], "HDstrdup returns NULL", __LINE__, __FILE__);
+ /* Keep a copy of the dataset names */
+ lnames[i] = HDstrdup(name);
+ check_values(lnames[i], "HDstrdup returns NULL", __LINE__, __FILE__);
} /* end for */
@@ -191,7 +187,6 @@ static void test_iter_group(FileAccPropList& fapl)
/* Sort the dataset names */
HDqsort(lnames, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp);
-
/* Iterate through the datasets in the root group in various ways */
// Open data file to read
@@ -205,15 +200,16 @@ static void test_iter_group(FileAccPropList& fapl)
verify_val(nobjs, (hsize_t)(NDATASETS + 2), "H5Gget_info", __LINE__, __FILE__);
H5std_string obj_name;
- for (i = 0; i < nobjs; i++)
- {
- //H5O_info2_t oinfo; /* Object info */
+ for (i = 0; i < nobjs; i++) {
+ // H5O_info2_t oinfo; /* Object info */
obj_name = root_group.getObjnameByIdx(i);
- //ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
+ // ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i,
+ // dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
- //oinfo = root_group.childObjType((hsize_t)i, H5_INDEX_NAME, H5_ITER_INC, ".");
- //ret = H5Oget_info_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5P_DEFAULT);
+ // oinfo = root_group.childObjType((hsize_t)i, H5_INDEX_NAME, H5_ITER_INC, ".");
+ // ret = H5Oget_info_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo,
+ // H5P_DEFAULT);
} /* end for */
// Attempted to iterate with invalid index, should fail
@@ -223,63 +219,69 @@ static void test_iter_group(FileAccPropList& fapl)
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with invalid index");
}
- catch (GroupIException& invalid_action) // invalid index
- {} // do nothing, exception expected
+ catch (GroupIException &invalid_action) // invalid index
+ {
+ } // do nothing, exception expected
// Attempted to iterate with negative index, should fail
try {
info.command = RET_ZERO;
- idx = (hsize_t)-1;
- obj_name = root_group.getObjnameByIdx(idx);
+ idx = (hsize_t)-1;
+ obj_name = root_group.getObjnameByIdx(idx);
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with negative index");
}
- catch (FileIException& invalid_action) // invalid index
- {} // do nothing, exception expected
- catch (GroupIException& invalid_action) // invalid index
- {} // do nothing, exception expected
+ catch (FileIException &invalid_action) // invalid index
+ {
+ } // do nothing, exception expected
+ catch (GroupIException &invalid_action) // invalid index
+ {
+ } // do nothing, exception expected
/* Test skipping exactly as many entries as in the group */
try {
info.command = RET_ZERO;
- idx = NDATASETS + 2;
- obj_name = root_group.getObjnameByIdx(idx);
+ idx = NDATASETS + 2;
+ obj_name = root_group.getObjnameByIdx(idx);
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with negative index");
}
- catch (FileIException& invalid_action) // invalid index
- {} // do nothing, exception expected
- catch (GroupIException& invalid_action) // invalid index
- {} // do nothing, exception expected
+ catch (FileIException &invalid_action) // invalid index
+ {
+ } // do nothing, exception expected
+ catch (GroupIException &invalid_action) // invalid index
+ {
+ } // do nothing, exception expected
/* Test skipping more entries than are in the group */
try {
info.command = RET_ZERO;
- idx = NDATASETS + 3;
- obj_name = root_group.getObjnameByIdx(idx);
+ idx = NDATASETS + 3;
+ obj_name = root_group.getObjnameByIdx(idx);
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with negative index");
}
- catch (FileIException& invalid_action) // invalid index
- {} // do nothing, exception expected
- catch (GroupIException& invalid_action) // invalid index
- {} // do nothing, exception expected
+ catch (FileIException &invalid_action) // invalid index
+ {
+ } // do nothing, exception expected
+ catch (GroupIException &invalid_action) // invalid index
+ {
+ } // do nothing, exception expected
/* Free the dataset names */
- for(i = 0; i< (NDATASETS + 2); i++)
+ for (i = 0; i < (NDATASETS + 2); i++)
HDfree(lnames[i]);
// Everything will be closed as they go out of scope
PASSED();
- } // try block
+ } // try block
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_iter_group", __LINE__, __FILE__);
}
@@ -348,7 +350,6 @@ static void test_iter_group(FileAccPropList& fapl)
#endif
} /* test_iter_group() */
-
/*-------------------------------------------------------------------------
* Function: printelems
*
@@ -362,31 +363,29 @@ const H5std_string GDATASET_NAME("group dset");
const H5std_string ATTR_NAME("Units");
const H5std_string FATTR_NAME("F attr");
const H5std_string GATTR_NAME("G attr");
-const int DIM1 = 2;
-void printelems(const Group& group, const H5std_string& dsname, const H5std_string& atname)
+const int DIM1 = 2;
+void
+printelems(const Group &group, const H5std_string &dsname, const H5std_string &atname)
{
- try
- {
- DataSet d1(group.openDataSet(dsname));
+ try {
+ DataSet d1(group.openDataSet(dsname));
DataSpace s1 = d1.getSpace();
s1.close();
d1.close();
- unsigned idx = 0;
- Attribute a1(group.openAttribute(idx));
+ unsigned idx = 0;
+ Attribute a1(group.openAttribute(idx));
H5std_string aname = a1.getName();
verify_val(aname, atname, "printelems", __LINE__, __FILE__);
a1.close();
- }
+ }
// Catch all exceptions and rethrow so caller can handle
- catch (Exception& E)
- {
+ catch (Exception &E) {
throw;
}
}
-
/*-------------------------------------------------------------------------
* Function: test_HDFFV_9920
*
@@ -396,33 +395,31 @@ void printelems(const Group& group, const H5std_string& dsname, const H5std_stri
* Friday, September 9, 2016
*-------------------------------------------------------------------------
*/
-static void test_HDFFV_9920()
+static void
+test_HDFFV_9920()
{
- int attr_data[2] = { 100, 200};
- hsize_t dims[1] = { DIM1 };
+ int attr_data[2] = {100, 200};
+ hsize_t dims[1] = {DIM1};
- try
- {
+ try {
// Create a new file and a group in it
- H5File file( FILE_NAME, H5F_ACC_TRUNC );
+ H5File file(FILE_NAME, H5F_ACC_TRUNC);
Group gr1(file.createGroup(GRP_NAME));
// Create the data space for the attribute.
- DataSpace dspace = DataSpace (1, dims );
+ DataSpace dspace = DataSpace(1, dims);
DataSet fds = file.createDataSet(FDATASET_NAME, PredType::STD_I32BE, dspace);
DataSet gds = gr1.createDataSet(GDATASET_NAME, PredType::STD_I32BE, dspace);
// Create a file attribute and a group attribute.
- Attribute fa1 = file.createAttribute(FATTR_NAME, PredType::STD_I32BE,
- dspace);
- Attribute ga1 = gr1.createAttribute(GATTR_NAME, PredType::STD_I32BE,
- dspace);
+ Attribute fa1 = file.createAttribute(FATTR_NAME, PredType::STD_I32BE, dspace);
+ Attribute ga1 = gr1.createAttribute(GATTR_NAME, PredType::STD_I32BE, dspace);
// Write the attribute data.
- fa1.write( PredType::NATIVE_INT, attr_data);
- ga1.write( PredType::NATIVE_INT, attr_data);
+ fa1.write(PredType::NATIVE_INT, attr_data);
+ ga1.write(PredType::NATIVE_INT, attr_data);
fa1.close();
ga1.close();
@@ -433,16 +430,14 @@ static void test_HDFFV_9920()
printelems(file, FDATASET_NAME, FATTR_NAME);
printelems(gr1, GDATASET_NAME, GATTR_NAME);
- } // end of try block
+ } // end of try block
// Catch all failures for handling in the same way
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_HDFFV_9920()", __LINE__, __FILE__, E.getCDetailMsg());
}
}
-
/*-------------------------------------------------------------------------
* Function: test_iterate
*
@@ -455,8 +450,8 @@ static void test_HDFFV_9920()
* Tuesday, September 6, 2016
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_iterate()
+extern "C" void
+test_iterate()
{
// Output message about test being performed
MESSAGE(5, ("Testing Iterate Feature\n"));
@@ -465,13 +460,12 @@ void test_iterate()
FileAccPropList fapl;
fapl.setLibverBounds(H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
- test_iter_group(fapl); // Test iterating groups
- test_HDFFV_9920(); // Test the fix of HDFFV-9920
- //test_iter_attr(fapl); // Test iterating attributes
+ test_iter_group(fapl); // Test iterating groups
+ test_HDFFV_9920(); // Test the fix of HDFFV-9920
+ // test_iter_attr(fapl); // Test iterating attributes
-} // test_iterate
+} // test_iterate
-
/*-------------------------------------------------------------------------
* Function: cleanup_iterate
*
@@ -480,8 +474,8 @@ void test_iterate()
* Return none
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_iterate()
+extern "C" void
+cleanup_iterate()
{
HDremove(FILE_ITERATE.c_str());
} // cleanup_iterate
diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp
index 1bdd442..8690ac2 100644
--- a/c++/test/tlinks.cpp
+++ b/c++/test/tlinks.cpp
@@ -25,37 +25,30 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
-#define NAME_BUF_SIZE 1024
-#define H5L_DIM1 100
-#define H5L_DIM2 100
+#define NAME_BUF_SIZE 1024
+#define H5L_DIM1 100
+#define H5L_DIM2 100
// Object visit structs
typedef struct {
- const char *path; /* Path to object */
- H5O_type_t type; /* Type of object */
+ const char *path; /* Path to object */
+ H5O_type_t type; /* Type of object */
} obj_visit_t;
// User data for callback function
typedef struct {
- unsigned idx; /* Index in object visit structure */
- const obj_visit_t *info; /* Pointer to the object visit structure to use */
+ unsigned idx; /* Index in object visit structure */
+ const obj_visit_t *info; /* Pointer to the object visit structure to use */
} ovisit_ud_t;
-static const char *FILENAME[] = {
- "link0",
- "link1.h5",
- "link2.h5",
- "visit",
- NULL
-};
+static const char *FILENAME[] = {"link0", "link1.h5", "link2.h5", "visit", NULL};
-
/*-------------------------------------------------------------------------
* Function: test_basic_links
*
@@ -67,17 +60,17 @@ static const char *FILENAME[] = {
* October 16, 2009
*-------------------------------------------------------------------------
*/
-static void test_basic_links(hid_t fapl_id, hbool_t new_format)
+static void
+test_basic_links(hid_t fapl_id, hbool_t new_format)
{
hsize_t size[1] = {1};
- char filename[NAME_BUF_SIZE];
+ char filename[NAME_BUF_SIZE];
// Use the file access template id to create a file access prop. list.
FileAccPropList fapl(fapl_id);
- try
- {
- if(new_format)
+ try {
+ if (new_format)
SUBTEST("Link creation (w/new group format)")
else
SUBTEST("Link creation")
@@ -86,7 +79,7 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format)
H5File file(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
// Create simple dataspace
- DataSpace scalar (1, size, size);
+ DataSpace scalar(1, size, size);
// Create a group then close it by letting the object go out of scope
{
@@ -103,25 +96,19 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format)
// Because these are not implemented in the C++ API yet, they are
// used so CommonFG::getLinkval can be tested.
// Create a hard link
- if(H5Lcreate_hard(
- file_id, "dset1", H5L_SAME_LOC, "grp1/hard1",
- H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_hard(file_id, "dset1", H5L_SAME_LOC, "grp1/hard1", H5P_DEFAULT, H5P_DEFAULT) < 0)
throw Exception("test_basic_links", "H5Lcreate_hard failed");
// Create a symbolic link
- if(H5Lcreate_soft(
- "/dset1", file_id, "grp1/soft", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_soft("/dset1", file_id, "grp1/soft", H5P_DEFAULT, H5P_DEFAULT) < 0)
throw Exception("test_basic_links", "H5Lcreate_soft failed");
// Create a symbolic link to something that doesn't exist
- if(H5Lcreate_soft(
- "foobar", file_id, "grp1/dangle", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_soft("foobar", file_id, "grp1/dangle", H5P_DEFAULT, H5P_DEFAULT) < 0)
throw Exception("test_basic_links", "H5Lcreate_soft failed");
// Create a recursive symbolic link
- if(H5Lcreate_soft(
- "/grp1/recursive", file_id, "/grp1/recursive",
- H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_soft("/grp1/recursive", file_id, "/grp1/recursive", H5P_DEFAULT, H5P_DEFAULT) < 0)
throw Exception("test_basic_links", "H5Lcreate_soft failed");
// Verify link values before closing the file
@@ -136,26 +123,24 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format)
verify_val(reclink_val, "/grp1/recursive", "H5File::getLinkval grp1/recursive", __LINE__, __FILE__);
} // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_basic_links()", __LINE__, __FILE__, E.getCDetailMsg());
}
// Open the file and check on the links in it
- try
- {
+ try {
// Open the file above
H5File file(filename, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl);
// Verify link existence
- if(file.nameExists("dset1", LinkAccPropList::DEFAULT) != TRUE)
+ if (file.nameExists("dset1", LinkAccPropList::DEFAULT) != TRUE)
throw InvalidActionException("H5File::nameExists", "dset1 doesn't exist");
- if(file.nameExists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE)
+ if (file.nameExists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE)
throw InvalidActionException("H5File::nameExists", "grp1/soft doesn't exist");
// Deprecated
- if(file.exists("dset1", LinkAccPropList::DEFAULT) != TRUE)
+ if (file.exists("dset1", LinkAccPropList::DEFAULT) != TRUE)
throw InvalidActionException("H5File::exists", "dset1 doesn't exist");
- if(file.exists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE)
+ if (file.exists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE)
throw InvalidActionException("H5File::exists", "grp1/soft doesn't exist");
// Verify link values
@@ -167,13 +152,11 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format)
PASSED();
} // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_basic_links()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_basic_links
-
/*-------------------------------------------------------------------------
* Function: test_lcpl
*
@@ -191,16 +174,15 @@ static void
test_lcpl(hid_t fapl_id, hbool_t new_format)
{
H5L_info2_t linfo;
- char filename[1024];
- hsize_t dims[2];
+ char filename[1024];
+ hsize_t dims[2];
- if(new_format)
+ if (new_format)
SUBTEST("Link creation property lists (w/new group format)")
else
SUBTEST("Link creation property lists")
- try
- {
+ try {
FileAccPropList fapl(fapl_id);
// Create a new file.
@@ -213,7 +195,7 @@ test_lcpl(hid_t fapl_id, hbool_t new_format)
// Check that its character encoding is the default.
linfo = file.getLinkInfo(GROUP1NAME);
- if(linfo.cset != H5T_CSET_ASCII)
+ if (linfo.cset != H5T_CSET_ASCII)
throw InvalidActionException("H5Lget_info", "Character encoding is not default");
// Create and commit a datatype with the default LCPL.
@@ -228,7 +210,7 @@ test_lcpl(hid_t fapl_id, hbool_t new_format)
// Create a simple dataspace.
dims[0] = H5L_DIM1;
dims[1] = H5L_DIM2;
- DataSpace dspace(2 ,dims);
+ DataSpace dspace(2, dims);
// Create a dataset using the default LCPL.
DataSet dset(file.createDataSet("/dataset", PredType::NATIVE_INT, dspace));
@@ -252,13 +234,11 @@ test_lcpl(hid_t fapl_id, hbool_t new_format)
PASSED();
} // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_lcpl()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // end test_lcpl()
-
/*-------------------------------------------------------------------------
* Function: test_move
*
@@ -272,15 +252,14 @@ test_lcpl(hid_t fapl_id, hbool_t new_format)
static void
test_move(hid_t fapl_id, hbool_t new_format)
{
- char filename[1024];
+ char filename[1024];
- if(new_format)
+ if (new_format)
SUBTEST("Group::moveLink (w/new group format)")
else
SUBTEST("Group::moveLink")
- try
- {
+ try {
FileAccPropList fapl(fapl_id);
// Create two new files
@@ -303,15 +282,16 @@ test_move(hid_t fapl_id, hbool_t new_format)
grp_1.moveLink("group_move", file_b, "group_new_name");
// Should throw an exception but didn't
- H5_FAILED();
- cerr << " Group group_move should not be moved across files" << endl;
- } catch (Exception& E) {
+ H5_FAILED();
+ cerr << " Group group_move should not be moved across files" << endl;
+ }
+ catch (Exception &E) {
// expected
}
// Move a soft link across files, should succeed
grp_2.moveLink("soft", file_b, "soft_new_name");
- if(file_b.exists("soft_new_name") != TRUE)
+ if (file_b.exists("soft_new_name") != TRUE)
throw InvalidActionException("H5File::exists", "grp1/soft doesn't exist");
// Move a group across groups in the same file while renaming it
@@ -326,9 +306,10 @@ test_move(hid_t fapl_id, hbool_t new_format)
moved_grp = grp_1.openGroup("group_move");
// Should throw an exception but didn't
- H5_FAILED();
- cerr << " Group group_move should not be in original location" << endl;
- } catch (Exception& E) {
+ H5_FAILED();
+ cerr << " Group group_move should not be in original location" << endl;
+ }
+ catch (Exception &E) {
// expected
}
@@ -360,46 +341,49 @@ test_move(hid_t fapl_id, hbool_t new_format)
moved_grp = grp_1.openGroup("group_newer_name");
moved_grp.close();
- H5_FAILED(); // Should throw an exception but didn't
- cerr << " Group group_newer_name should not be in GROUP1NAME" << endl;
- } catch (Exception& E) {
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_newer_name should not be in GROUP1NAME" << endl;
+ }
+ catch (Exception &E) {
// expected
}
try {
moved_grp = grp_2.openGroup("group_newer_name");
moved_grp.close();
- H5_FAILED(); // Should throw an exception but didn't
- cerr << " Group group_newer_name should not be in GROUP2NAME" << endl;
- } catch (Exception& E) {
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_newer_name should not be in GROUP2NAME" << endl;
+ }
+ catch (Exception &E) {
// expected
}
try {
moved_grp = grp_2.openGroup("group_new_name");
moved_grp.close();
- H5_FAILED(); // Should throw an exception but didn't
- cerr << " Group group_new_name should not be in GROUP2NAME" << endl;
- } catch (Exception& E) {
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_new_name should not be in GROUP2NAME" << endl;
+ }
+ catch (Exception &E) {
// expected
}
try {
moved_grp = grp_1.openGroup("group_copy");
moved_grp.close();
- H5_FAILED(); // Should throw an exception but didn't
- cerr << " Group group_copy should not be in GROUP1NAME" << endl;
- } catch (Exception& E) {
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_copy should not be in GROUP1NAME" << endl;
+ }
+ catch (Exception &E) {
// expected
}
PASSED();
} // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_move()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_move
-
+
/*-------------------------------------------------------------------------
* Function: test_copy
*
@@ -410,17 +394,17 @@ test_move(hid_t fapl_id, hbool_t new_format)
* March, 2018
*-------------------------------------------------------------------------
*/
-static void test_copy(hid_t fapl_id, hbool_t new_format)
+static void
+test_copy(hid_t fapl_id, hbool_t new_format)
{
char filename[1024];
- if(new_format)
+ if (new_format)
SUBTEST("Group::copyLink (w/new group format)")
else
SUBTEST("Group::copyLink")
- try
- {
+ try {
// Create two new files
h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename);
H5File file_a(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl_id);
@@ -439,7 +423,8 @@ static void test_copy(hid_t fapl_id, hbool_t new_format)
// Copy a group across files, should fail
try {
grp_1.copyLink("group_copy", file_b, "group_new_name");
- } catch (Exception& E) {
+ }
+ catch (Exception &E) {
// expected
}
@@ -509,9 +494,10 @@ static void test_copy(hid_t fapl_id, hbool_t new_format)
moved_grp = grp_2.openGroup("group_newer_name");
moved_grp.close();
- H5_FAILED(); // Should throw an exception but didn't
- cerr << " Group group_newer_name should not be in GROUP2NAME" << endl;
- } catch (Exception& E) {
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_newer_name should not be in GROUP2NAME" << endl;
+ }
+ catch (Exception &E) {
// expected
}
@@ -521,21 +507,20 @@ static void test_copy(hid_t fapl_id, hbool_t new_format)
moved_grp = grp_1.openGroup("group_copy");
moved_grp.close();
- H5_FAILED(); // Should throw an exception but didn't
- cerr << " Group group_copy should not be in GROUP1NAME" << endl;
- } catch (Exception& E) {
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_copy should not be in GROUP1NAME" << endl;
+ }
+ catch (Exception &E) {
// expected
}
PASSED();
} // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_copy()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_copy
-
/*-------------------------------------------------------------------------
* Function: test_num_links
*
@@ -547,17 +532,17 @@ static void test_copy(hid_t fapl_id, hbool_t new_format)
* October 16, 2009
*-------------------------------------------------------------------------
*/
-static void test_num_links(hid_t fapl_id, hbool_t new_format)
+static void
+test_num_links(hid_t fapl_id, hbool_t new_format)
{
char filename[NAME_BUF_SIZE];
- if(new_format)
+ if (new_format)
SUBTEST("Setting number of links (w/new group format)")
else
SUBTEST("Setting number of links")
- try
- {
+ try {
// Use the file access template id to create a file access prop. list.
FileAccPropList fapl(fapl_id);
@@ -565,7 +550,7 @@ static void test_num_links(hid_t fapl_id, hbool_t new_format)
H5File file(filename, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl);
LinkAccPropList lapl;
- size_t nlinks = 5;
+ size_t nlinks = 5;
lapl.setNumLinks(nlinks);
// Read it back and verify
@@ -574,13 +559,11 @@ static void test_num_links(hid_t fapl_id, hbool_t new_format)
PASSED();
} // end of try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_num_links()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_num_links
-
// Data for visit on the file
static const obj_visit_t file_visit[] = {
{".", H5O_TYPE_GROUP},
@@ -600,22 +583,25 @@ const H5std_string FILE_NAME("tvisit.h5");
const H5std_string GROUP_NAME("/Data");
const H5std_string DSET1_NAME("/Data/Compressed_Data");
const H5std_string DSET2_NAME("/Data/Float_Data");
-const int RANK = 2;
-const int DIM1 = 2;
+const int RANK = 2;
+const int DIM1 = 2;
// Operator function
-static int visit_obj_cb(H5Object& obj, const H5std_string name, const H5O_info2_t *oinfo, void *_op_data)
+static int
+visit_obj_cb(H5Object &obj, const H5std_string name, const H5O_info2_t *oinfo, void *_op_data)
{
- ovisit_ud_t *op_data = static_cast <ovisit_ud_t *>(_op_data);
+ ovisit_ud_t *op_data = static_cast<ovisit_ud_t *>(_op_data);
// Check for correct object information
- if(strcmp(op_data->info[op_data->idx].path, name.c_str())) return(H5_ITER_ERROR);
- if(op_data->info[op_data->idx].type != oinfo->type) return(H5_ITER_ERROR);
+ if (strcmp(op_data->info[op_data->idx].path, name.c_str()))
+ return (H5_ITER_ERROR);
+ if (op_data->info[op_data->idx].type != oinfo->type)
+ return (H5_ITER_ERROR);
// Advance to next location
op_data->idx++;
- return(H5_ITER_CONT);
+ return (H5_ITER_CONT);
}
/*-------------------------------------------------------------------------
@@ -628,93 +614,90 @@ static int visit_obj_cb(H5Object& obj, const H5std_string name, const H5O_info2_
* February 8, 2019
*-------------------------------------------------------------------------
*/
-static void test_visit(hid_t fapl_id, hbool_t new_format)
+static void
+test_visit(hid_t fapl_id, hbool_t new_format)
{
- hsize_t dims[2];
- hsize_t cdims[2];
- char filename[NAME_BUF_SIZE];
+ hsize_t dims[2];
+ hsize_t cdims[2];
+ char filename[NAME_BUF_SIZE];
- if(new_format)
+ if (new_format)
SUBTEST("H5Object::visit (w/new group format)")
else
SUBTEST("H5Object::visit")
- try
- {
+ try {
// Use the file access template id to create a file access prop. list
FileAccPropList fapl(fapl_id);
// Build the hdf5 file name and create the file
h5_fixname(FILENAME[3], fapl_id, filename, sizeof filename);
- H5File *file = new H5File(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+ H5File *file = new H5File(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
// Create a group
- Group* group = new Group(file->createGroup(GROUP_NAME));
+ Group *group = new Group(file->createGroup(GROUP_NAME));
// Create a chunked/compressed dataset within this group specified by path
- dims[0] = 20;
- dims[1] = 2;
- cdims[0] = 2;
- cdims[1] = 2;
- DataSpace *dataspace = new DataSpace(RANK, dims); // create new dspace
- DSetCreatPropList ds_creatplist; // create dataset creation prop list
- ds_creatplist.setChunk(2, cdims); // then modify it for compression
- ds_creatplist.setDeflate(6);
-
- DataSet* dataset = new DataSet(file->createDataSet(DSET1_NAME,
- PredType::NATIVE_INT, *dataspace, ds_creatplist));
-
- delete dataset;
- delete dataspace;
-
- // Create another dataset
- dims[0] = 5;
- dims[1] = 2;
- dataspace = new DataSpace(RANK, dims); // create second dspace
- dataset = new DataSet(file->createDataSet(DSET2_NAME,
- PredType::NATIVE_FLOAT, *dataspace));
+ dims[0] = 20;
+ dims[1] = 2;
+ cdims[0] = 2;
+ cdims[1] = 2;
+ DataSpace * dataspace = new DataSpace(RANK, dims); // create new dspace
+ DSetCreatPropList ds_creatplist; // create dataset creation prop list
+ ds_creatplist.setChunk(2, cdims); // then modify it for compression
+ ds_creatplist.setDeflate(6);
+
+ DataSet *dataset =
+ new DataSet(file->createDataSet(DSET1_NAME, PredType::NATIVE_INT, *dataspace, ds_creatplist));
+
+ delete dataset;
+ delete dataspace;
+
+ // Create another dataset
+ dims[0] = 5;
+ dims[1] = 2;
+ dataspace = new DataSpace(RANK, dims); // create second dspace
+ dataset = new DataSet(file->createDataSet(DSET2_NAME, PredType::NATIVE_FLOAT, *dataspace));
// Close everything
- delete dataset;
- delete dataspace;
- delete group;
- delete file;
+ delete dataset;
+ delete dataspace;
+ delete group;
+ delete file;
- // Reopen the file and group in the file.
- file = new H5File(filename, H5F_ACC_RDWR);
- group = new Group(file->openGroup("Data"));
+ // Reopen the file and group in the file.
+ file = new H5File(filename, H5F_ACC_RDWR);
+ group = new Group(file->openGroup("Data"));
// Open the group
- dataset = new DataSet(group->openDataSet(DSET2_NAME));
+ dataset = new DataSet(group->openDataSet(DSET2_NAME));
delete dataset;
// Visit objects in the file
- ovisit_ud_t udata; /* User-data for visiting */
- udata.idx = 0;
+ ovisit_ud_t udata; /* User-data for visiting */
+ udata.idx = 0;
udata.info = file_visit;
file->visit(H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC);
// Visit objects in the group
- udata.idx = 0;
+ udata.idx = 0;
udata.info = group_visit;
group->visit(H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC);
- // Close the group and file.
- delete group;
- delete file;
+ // Close the group and file.
+ delete group;
+ delete file;
PASSED();
} // end of try block
- catch (Exception& E)
- {
- cerr << "in catch" << endl;
+ catch (Exception &E) {
+ cerr << "in catch" << endl;
issue_fail_msg("test_visit()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_visit()
-
/*-------------------------------------------------------------------------
* Function: test_links
*
@@ -725,35 +708,33 @@ static void test_visit(hid_t fapl_id, hbool_t new_format)
* October 16, 2009
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_links()
+extern "C" void
+test_links()
{
- hid_t fapl_id, fapl2_id; /* File access property lists */
- unsigned new_format; /* Whether to use the new format or not */
+ hid_t fapl_id, fapl2_id; /* File access property lists */
+ unsigned new_format; /* Whether to use the new format or not */
- if((fapl_id = h5_fileaccess()) < 0)
+ if ((fapl_id = h5_fileaccess()) < 0)
throw Exception("test_links", "Unable to get file access property list");
// Output message about test being performed
MESSAGE(5, ("Testing Various Links\n"));
- try
- {
+ try {
/* Copy the file access property list */
- if((fapl2_id = H5Pcopy(fapl_id)) < 0)
+ if ((fapl2_id = H5Pcopy(fapl_id)) < 0)
throw Exception("test_links", "H5Pcopy failed");
/* Set the "use the latest version of the format" bounds for creating
objects in the file */
- if(H5Pset_libver_bounds(fapl2_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl2_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
throw Exception("test_links", "H5Pset_libver_bounds failed");
/* Loop over using new group format */
- for(new_format = FALSE; new_format <= TRUE; new_format++)
- {
+ for (new_format = FALSE; new_format <= TRUE; new_format++) {
hid_t my_fapl_id;
/* Check for FAPL to use */
- if(new_format)
+ if (new_format)
my_fapl_id = fapl2_id;
else
my_fapl_id = fapl_id;
@@ -773,13 +754,11 @@ void test_links()
h5_clean_files(FILENAME, fapl_id);
}
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_links()", __LINE__, __FILE__, E.getCDetailMsg());
}
}
-
/*-------------------------------------------------------------------------
* Function: cleanup_links
*
@@ -788,8 +767,8 @@ void test_links()
* Return none
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_links()
+extern "C" void
+cleanup_links()
{
HDremove(FILENAME[0]);
HDremove(FILENAME[1]);
diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp
index 9b5dd68..991df3f 100644
--- a/c++/test/tobject.cpp
+++ b/c++/test/tobject.cpp
@@ -23,29 +23,28 @@
#endif
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
-
-const H5std_string FILE_OBJECTS("tobjects.h5");
-const H5std_string FILE_OBJHDR("tobject_header.h5");
-const H5std_string GROUP1("Top Group");
-const H5std_string GROUP1_PATH("/Top Group");
-const H5std_string GROUP1_1("Sub-Group 1.1");
-const H5std_string GROUP1_1_PATH("/Top Group/Sub-Group 1.1");
-const H5std_string GROUP1_2("Sub-Group 1.2");
-const H5std_string GROUP1_2_PATH("/Top Group/Sub-Group 1.2");
-const H5std_string DSET_DEFAULT_NAME("default");
-const H5std_string DSET_IN_FILE("Dataset in File");
-const H5std_string DSET_IN_FILE_PATH("/Dataset in File");
-const H5std_string DSET_IN_GRP1("Dataset_in_Group_1");
-const H5std_string DSET_IN_GRP1_PATH("/Top Group/Dataset_in_Group_1");
-const H5std_string DSET_IN_GRP1_2("Dataset_in_Group_1.2");
-const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset_in_Group_1.2");
-
-
+#include "h5cpputil.h" // C++ utilility header file
+
+const H5std_string FILE_OBJECTS("tobjects.h5");
+const H5std_string FILE_OBJHDR("tobject_header.h5");
+const H5std_string GROUP1("Top Group");
+const H5std_string GROUP1_PATH("/Top Group");
+const H5std_string GROUP1_1("Sub-Group 1.1");
+const H5std_string GROUP1_1_PATH("/Top Group/Sub-Group 1.1");
+const H5std_string GROUP1_2("Sub-Group 1.2");
+const H5std_string GROUP1_2_PATH("/Top Group/Sub-Group 1.2");
+const H5std_string DSET_DEFAULT_NAME("default");
+const H5std_string DSET_IN_FILE("Dataset in File");
+const H5std_string DSET_IN_FILE_PATH("/Dataset in File");
+const H5std_string DSET_IN_GRP1("Dataset_in_Group_1");
+const H5std_string DSET_IN_GRP1_PATH("/Top Group/Dataset_in_Group_1");
+const H5std_string DSET_IN_GRP1_2("Dataset_in_Group_1.2");
+const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset_in_Group_1.2");
+
/*-------------------------------------------------------------------------
* Function: test_get_objname
*
@@ -68,7 +67,8 @@ const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset_
* Friday, March 4, 2014
*-------------------------------------------------------------------------
*/
-static void test_get_objname()
+static void
+test_get_objname()
{
SUBTEST("H5Object::getObjName on Groups and Datasets");
@@ -77,7 +77,7 @@ static void test_get_objname()
H5File file(FILE_OBJECTS, H5F_ACC_TRUNC);
// Create a top group and 2 subgroups
- Group grp1 = file.createGroup(GROUP1, 0);
+ Group grp1 = file.createGroup(GROUP1, 0);
Group grp1_1 = grp1.createGroup(GROUP1_1, 0);
Group grp1_2 = grp1.createGroup(GROUP1_2, 0);
@@ -88,27 +88,24 @@ static void test_get_objname()
ssize_t name_len = grp1.getObjName(NULL);
// Random length is 4
- if (name_len > 4)
- {
- char* grp1_name = new char[5];
- name_len = grp1.getObjName(grp1_name, 5);
- verify_val((const char*)grp1_name, "/Top", "Group::getObjName", __LINE__, __FILE__);
- delete []grp1_name;
+ if (name_len > 4) {
+ char *grp1_name = new char[5];
+ name_len = grp1.getObjName(grp1_name, 5);
+ verify_val((const char *)grp1_name, "/Top", "Group::getObjName", __LINE__, __FILE__);
+ delete[] grp1_name;
}
// Create a data space
- hsize_t dims[2];
+ hsize_t dims[2];
dims[0] = 2;
dims[1] = 5;
- DataSpace space (2, dims, NULL);
+ DataSpace space(2, dims, NULL);
// Create a dataset in the file
- DataSet dsinfile = file.createDataSet(DSET_IN_FILE,
- PredType::NATIVE_DOUBLE, space);
+ DataSet dsinfile = file.createDataSet(DSET_IN_FILE, PredType::NATIVE_DOUBLE, space);
// Create a dataset in the group
- DataSet dsingrp = grp1.createDataSet(DSET_IN_GRP1,
- PredType::NATIVE_INT, space);
+ DataSet dsingrp = grp1.createDataSet(DSET_IN_GRP1, PredType::NATIVE_INT, space);
// Get and verify the name of each dataset, using
// H5std_string getObjName() and
@@ -135,23 +132,21 @@ static void test_get_objname()
// Reopen that same dataset then check the name again with another
// overload: ssize_t getObjName(H5std_string& obj_name, size_t len = 0)
- dsingrp = grp1_2.openDataSet(DSET_IN_GRP1_2);
+ dsingrp = grp1_2.openDataSet(DSET_IN_GRP1_2);
name_len = dsingrp.getObjName(ds_name);
verify_val(ds_name, DSET_IN_GRP1_2_PATH, "DataSet::getObjName", __LINE__, __FILE__);
// Everything will be closed as they go out of scope
PASSED();
- } // try block
+ } // try block
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_get_objname", __LINE__, __FILE__);
}
-} // test_get_objname
+} // test_get_objname
-
/*-------------------------------------------------------------------------
* Function: test_existance
*
@@ -174,7 +169,8 @@ static void test_get_objname()
* Friday, March 4, 2014
*-------------------------------------------------------------------------
*/
-static void test_existance()
+static void
+test_existance()
{
SUBTEST("H5File::exists and Group::exists");
@@ -222,7 +218,7 @@ static void test_existance()
// Check if a dataset exists given dataset as location with full path name
DataSet dset1 = file.openDataSet(DSET_IN_FILE);
- exists = dset1.nameExists("/Top Group/Dataset_in_Group_1");
+ exists = dset1.nameExists("/Top Group/Dataset_in_Group_1");
verify_val(exists, TRUE, "Group::nameExists given dataset with full path name", __LINE__, __FILE__);
exists = grp1_2.nameExists(DSET_IN_GRP1);
@@ -236,16 +232,14 @@ static void test_existance()
// Everything will be closed as they go out of scope
PASSED();
- } // try block
+ } // try block
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_existance", __LINE__, __FILE__);
}
-} // test_existance
+} // test_existance
-
/*-------------------------------------------------------------------------
* Function: test_get_objname_ontypes
*
@@ -258,7 +252,8 @@ static void test_existance()
* March 4, 2014
*-------------------------------------------------------------------------
*/
-static void test_get_objname_ontypes()
+static void
+test_get_objname_ontypes()
{
SUBTEST("H5Object::getObjName on Committed Datatypes");
@@ -267,7 +262,7 @@ static void test_get_objname_ontypes()
H5File file(FILE_OBJECTS, H5F_ACC_RDWR);
// Create a group
- Group grp = file.createGroup ("typetests");
+ Group grp = file.createGroup("typetests");
// Create a datatype and save it
IntType inttype(PredType::STD_B8LE);
@@ -326,7 +321,8 @@ static void test_get_objname_ontypes()
// Name this datatype
new_int_type.commit(grp, "IntType NATIVE_INT");
ssize_t name_len = new_int_type.getObjName(type_name); // default len
- verify_val(name_len, (ssize_t)HDstrlen("/typetests/IntType NATIVE_INT"), "DataType::getObjName", __LINE__, __FILE__);
+ verify_val(name_len, (ssize_t)HDstrlen("/typetests/IntType NATIVE_INT"), "DataType::getObjName",
+ __LINE__, __FILE__);
verify_val(type_name, "/typetests/IntType NATIVE_INT", "DataType::getObjName", __LINE__, __FILE__);
// Close everything or they can be closed when objects go out of scope
@@ -338,13 +334,11 @@ static void test_get_objname_ontypes()
PASSED();
} // end top try block
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_get_objname_ontypes", __LINE__, __FILE__);
}
-} // test_get_objname_ontypes
+} // test_get_objname_ontypes
-
/*-------------------------------------------------------------------------
* Function: test_get_objtype
*
@@ -357,7 +351,8 @@ static void test_get_objname_ontypes()
* Friday, March 4, 2014
*-------------------------------------------------------------------------
*/
-static void test_get_objtype()
+static void
+test_get_objtype()
{
SUBTEST("H5File::childObjType and H5Group::childObjType");
@@ -398,16 +393,14 @@ static void test_get_objtype()
// Everything will be closed as they go out of scope
PASSED();
- } // try block
+ } // try block
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_get_objtype", __LINE__, __FILE__);
}
-} // test_get_objtype
+} // test_get_objtype
-
/*-------------------------------------------------------------------------
* Function: test_open_object_header
*
@@ -427,9 +420,10 @@ const H5std_string DSETNAME("dataset");
#define DIM0 5
#define DIM1 10
-static void test_open_object_header()
+static void
+test_open_object_header()
{
- hsize_t dims[2];
+ hsize_t dims[2];
// Output message about test being performed
SUBTEST("Group::getObjId");
@@ -452,16 +446,16 @@ static void test_open_object_header()
dims[0] = DIM0;
dims[1] = DIM1;
DataSpace dspace(RANK, dims);
- DataSet dset(file1.createDataSet(DSETNAME, PredType::NATIVE_INT, dspace));
+ DataSet dset(file1.createDataSet(DSETNAME, PredType::NATIVE_INT, dspace));
// Close dataset and dataspace
dset.close();
dspace.close();
// Now make sure that getObjId can open all three types of objects
- hid_t obj_grp = file1.getObjId(GROUPNAME);
+ hid_t obj_grp = file1.getObjId(GROUPNAME);
hid_t obj_dtype = file1.getObjId(DTYPENAME);
- hid_t obj_dset = file1.getObjId(DSETNAME);
+ hid_t obj_dset = file1.getObjId(DSETNAME);
// Make sure that each is the right kind of ID
H5I_type_t id_type = IdComponent::getHDFObjType(obj_grp);
@@ -473,7 +467,7 @@ static void test_open_object_header()
/* Do something more complex with each of the IDs to make sure */
- Group grp2(obj_grp);
+ Group grp2(obj_grp);
hsize_t num_objs = grp2.getNumObjs();
verify_val(num_objs, 1, "H5Gget_info", __LINE__, __FILE__);
// There should be one object, the datatype
@@ -482,7 +476,7 @@ static void test_open_object_header()
file1.closeObjId(obj_dtype);
dset.setId(obj_dset);
- dspace = dset.getSpace();
+ dspace = dset.getSpace();
bool is_simple = dspace.isSimple();
verify_val(is_simple, true, "isSimple", __LINE__, __FILE__);
dspace.close();
@@ -509,23 +503,20 @@ static void test_open_object_header()
grp2.close();
PASSED();
- } // end of try block
+ } // end of try block
// catch invalid action exception
- catch (InvalidActionException& E)
- {
+ catch (InvalidActionException &E) {
cerr << " in InvalidActionException" << endl;
cerr << " *FAILED*" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
}
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " in Exception" << endl;
issue_fail_msg("test_file_name()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_open_object_header
+} // test_open_object_header
-
/*-------------------------------------------------------------------------
* Function: test_getobjectinfo_same_file
*
@@ -540,9 +531,10 @@ static void test_open_object_header()
const H5std_string FILE_OBJINFO("tobject_getinfo.h5");
const H5std_string GROUP1NAME("group1");
const H5std_string GROUP2NAME("group2");
-static void test_getobjectinfo_same_file()
+static void
+test_getobjectinfo_same_file()
{
- H5O_info2_t oinfo1, oinfo2; /* Object info structs */
+ H5O_info2_t oinfo1, oinfo2; /* Object info structs */
// Output message about test being performed
SUBTEST("Group::getObjinfo");
@@ -588,7 +580,6 @@ static void test_getobjectinfo_same_file()
grp2.getObjinfo(oinfo2);
verify_val(oinfo1.fileno, oinfo2.fileno, "file number from getObjinfo", __LINE__, __FILE__);
-
// Reset object info
HDmemset(&oinfo1, 0, sizeof(oinfo1));
HDmemset(&oinfo2, 0, sizeof(oinfo2));
@@ -604,16 +595,15 @@ static void test_getobjectinfo_same_file()
file2.close();
PASSED();
- } // end of try block
+ } // end of try block
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " in Exception " << E.getCFuncName() << "detail: " << E.getCDetailMsg() << endl;
issue_fail_msg("test_getobjectinfo_same_file()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_getobjectinfo_same_file
-
+} // test_getobjectinfo_same_file
+
/*-------------------------------------------------------------------------
* Function: test_intermediate_groups
*
@@ -636,7 +626,8 @@ const H5std_string GROUP20NAME("/group20");
const H5std_string GROUP21NAME("/group20/group21");
const H5std_string GROUP22NAME("group21/group22");
const H5std_string GROUP22FULLNAME("/group20/group21/group22");
-static void test_intermediate_groups()
+static void
+test_intermediate_groups()
{
// Output message about test being performed
SUBTEST("Group::set/getCreateIntermediateGroup");
@@ -663,7 +654,9 @@ static void test_intermediate_groups()
// fail because group GROUP13NAME is missing
try {
Group grp14_nopl(file.createGroup(GROUP14NAME));
- } catch (FileIException& expected1) {} // Failure is ignored
+ }
+ catch (FileIException &expected1) {
+ } // Failure is ignored
// Create GROUP14NAME with the flag to create missing groups set
// to FALSE, should fail because group GROUP13NAME is missing
@@ -677,14 +670,15 @@ static void test_intermediate_groups()
try {
Group grp14_false(file.createGroup(GROUP14NAME, lcpl));
- } catch (FileIException& expected2) {} // Failure is ignored
+ }
+ catch (FileIException &expected2) {
+ } // Failure is ignored
// Set the flag to create missing groups set to TRUE
lcpl.setCreateIntermediateGroup(true);
crt_int_grps = lcpl.getCreateIntermediateGroup();
verify_val(crt_int_grps, true, "LinkCreatPropList::getCreateIntermediateGroup", __LINE__, __FILE__);
-
// Create GROUP14NAME with the use of link create plist
Group grp14(file.createGroup(GROUP14NAME, lcpl));
@@ -715,16 +709,15 @@ static void test_intermediate_groups()
Group grp22fromfile(file.openGroup(GROUP22FULLNAME));
PASSED();
- } // end of try block
+ } // end of try block
// catch all other exceptions
- catch (Exception& E)
- {
+ catch (Exception &E) {
cerr << " in Exception " << E.getCFuncName() << "detail: " << E.getCDetailMsg() << endl;
issue_fail_msg("test_intermediate_groups()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_intermediate_groups
-
+} // test_intermediate_groups
+
/*-------------------------------------------------------------------------
* Function: test_object
*
@@ -736,8 +729,8 @@ static void test_intermediate_groups()
* March 4, 2014
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_object()
+extern "C" void
+test_object()
{
// Output message about test being performed
MESSAGE(5, ("Testing Object Functions\n"));
@@ -750,9 +743,8 @@ void test_object()
test_getobjectinfo_same_file(); // Test object info in same file
test_intermediate_groups(); // Test intermediate group property
-} // test_object
+} // test_object
-
/*-------------------------------------------------------------------------
* Function: cleanup_objects
*
@@ -761,8 +753,8 @@ void test_object()
* Return None
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_object()
+extern "C" void
+cleanup_object()
{
HDremove(FILE_OBJECTS.c_str());
} // cleanup_objects
diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp
index b46ae29..beba36a 100644
--- a/c++/test/trefer.cpp
+++ b/c++/test/trefer.cpp
@@ -26,22 +26,22 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
-const H5std_string FILE1("trefer1.h5");
-const H5std_string FILE2("trefer2.h5");
+const H5std_string FILE1("trefer1.h5");
+const H5std_string FILE2("trefer2.h5");
// Dataset 1
-const H5std_string DSET1_NAME("Dataset1");
-const H5std_string DSET2_NAME("Dataset2");
+const H5std_string DSET1_NAME("Dataset1");
+const H5std_string DSET2_NAME("Dataset2");
-const H5std_string MEMBER1( "a_name" );
-const H5std_string MEMBER2( "b_name" );
-const H5std_string MEMBER3( "c_name" );
+const H5std_string MEMBER1("a_name");
+const H5std_string MEMBER2("b_name");
+const H5std_string MEMBER3("c_name");
// 1-D dataset with fixed dimensions
const int SPACE1_RANK = 1;
@@ -58,10 +58,9 @@ const int POINT1_NPOINTS = 10;
typedef struct s1_t {
unsigned int a;
unsigned int b;
- float c;
+ float c;
} s1_t;
-
/*-------------------------------------------------------------------------
* Function: test_reference_params
*
@@ -70,30 +69,31 @@ typedef struct s1_t {
* Return None
*-------------------------------------------------------------------------
*/
-static void test_reference_params()
+static void
+test_reference_params()
{
const char *write_comment = "Foo!"; /* Comments for group */
// Output message about test being performed
SUBTEST("Object Reference Parameters");
- H5File* file1 = NULL;
+ H5File *file1 = NULL;
try {
- hobj_ref_t *wbuf, // buffer to write to disk
- *rbuf, // buffer read from disk
- *tbuf; // temp. buffer read from disk
+ hobj_ref_t *wbuf, // buffer to write to disk
+ *rbuf, // buffer read from disk
+ *tbuf; // temp. buffer read from disk
// Allocate write & read buffers
- int temp_size = MAX(sizeof(unsigned),sizeof(hobj_ref_t));
- wbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
- rbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
- tbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
+ int temp_size = MAX(sizeof(unsigned), sizeof(hobj_ref_t));
+ wbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1);
+ rbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1);
+ tbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1);
// Create file FILE1
- file1 = new H5File (FILE1, H5F_ACC_TRUNC);
+ file1 = new H5File(FILE1, H5F_ACC_TRUNC);
// Create dataspace for datasets
- hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims1[] = {SPACE1_DIM1};
DataSpace sid1(SPACE1_RANK, dims1);
// Create a group
@@ -105,10 +105,10 @@ static void test_reference_params()
// Create a dataset (inside /Group1)
DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1);
- unsigned *tu32; // Temporary pointer to uint32 data
- int i;
- for (tu32=(unsigned *)wbuf, i=0; i<SPACE1_DIM1; i++)
- *tu32++=i*3; // from C test
+ unsigned *tu32; // Temporary pointer to uint32 data
+ int i;
+ for (tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
+ *tu32++ = i * 3; // from C test
// Write selection to disk
dataset.write(wbuf, PredType::NATIVE_UINT);
@@ -143,19 +143,29 @@ static void test_reference_params()
/* Test parameters to H5Location::reference */
try {
file1->reference(NULL, "/Group1/Dataset1");
- } catch (ReferenceException& E) {} // We expect this to fail
+ }
+ catch (ReferenceException &E) {
+ } // We expect this to fail
try {
file1->reference(&wbuf[0], NULL);
- } catch (ReferenceException& E) {} // We expect this to fail
+ }
+ catch (ReferenceException &E) {
+ } // We expect this to fail
try {
file1->reference(&wbuf[0], "");
- } catch (ReferenceException& E) {} // We expect this to fail
+ }
+ catch (ReferenceException &E) {
+ } // We expect this to fail
try {
file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_MAXTYPE);
- } catch (ReferenceException& E) {} // We expect this to fail
+ }
+ catch (ReferenceException &E) {
+ } // We expect this to fail
try {
file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_DATASET_REGION);
- } catch (ReferenceException& E) {} // We expect this to fail
+ }
+ catch (ReferenceException &E) {
+ } // We expect this to fail
// Close resources
dataset.close();
@@ -169,17 +179,14 @@ static void test_reference_params()
PASSED();
} // end try
- catch (Exception& E)
- {
- issue_fail_msg("test_reference_param()",__LINE__,__FILE__,
- E.getCFuncName(), E.getCDetailMsg());
+ catch (Exception &E) {
+ issue_fail_msg("test_reference_param()", __LINE__, __FILE__, E.getCFuncName(), E.getCDetailMsg());
}
- if(file1)
+ if (file1)
delete file1;
-} /* test_reference_param() */
+} /* test_reference_param() */
-
/*-------------------------------------------------------------------------
* Function: test_reference_obj
*
@@ -189,31 +196,32 @@ static void test_reference_params()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_reference_obj()
+static void
+test_reference_obj()
{
- int i; // counting variables
- const H5std_string write_comment="Foo!"; // Comments for group
+ int i; // counting variables
+ const H5std_string write_comment = "Foo!"; // Comments for group
// Output message about test being performed
SUBTEST("Object Reference Functions");
- H5File* file1 = NULL;
+ H5File *file1 = NULL;
try {
- hobj_ref_t *wbuf, // buffer to write to disk
- *rbuf, // buffer read from disk
- *tbuf; // temp. buffer read from disk
+ hobj_ref_t *wbuf, // buffer to write to disk
+ *rbuf, // buffer read from disk
+ *tbuf; // temp. buffer read from disk
// Allocate write & read buffers
- int temp_size = MAX(sizeof(unsigned),sizeof(hobj_ref_t));
- wbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
- rbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
- tbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
+ int temp_size = MAX(sizeof(unsigned), sizeof(hobj_ref_t));
+ wbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1);
+ rbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1);
+ tbuf = (hobj_ref_t *)HDmalloc(temp_size * SPACE1_DIM1);
// Create file FILE1
- file1 = new H5File (FILE1, H5F_ACC_TRUNC);
+ file1 = new H5File(FILE1, H5F_ACC_TRUNC);
// Create dataspace for datasets
- hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims1[] = {SPACE1_DIM1};
DataSpace sid1(SPACE1_RANK, dims1);
// Create dataset access property list
@@ -228,9 +236,9 @@ static void test_reference_obj()
// Create a dataset (inside /Group1)
DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1);
- unsigned *tu32; // Temporary pointer to uint32 data
+ unsigned *tu32; // Temporary pointer to uint32 data
for (tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
- *tu32++=i*3; // from C test
+ *tu32++ = i * 3; // from C test
// Write selection to disk
dataset.write(wbuf, PredType::NATIVE_UINT);
@@ -265,22 +273,22 @@ static void test_reference_obj()
// Create reference to dataset and test getRefObjType
file1->reference(&wbuf[0], "/Group1/Dataset1");
H5O_type_t refobj_type = dataset.getRefObjType(&wbuf[0], H5R_OBJECT);
- verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__);
+ verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__);
// Create reference to dataset and test getRefObjType
file1->reference(&wbuf[1], "/Group1/Dataset2");
refobj_type = dataset.getRefObjType(&wbuf[1], H5R_OBJECT);
- verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__);
+ verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__);
// Create reference to group
file1->reference(&wbuf[2], "/Group1");
refobj_type = dataset.getRefObjType(&wbuf[2], H5R_OBJECT);
- verify_val(refobj_type, H5O_TYPE_GROUP, "DataSet::getRefObjType",__LINE__,__FILE__);
+ verify_val(refobj_type, H5O_TYPE_GROUP, "DataSet::getRefObjType", __LINE__, __FILE__);
// Create reference to named datatype
file1->reference(&wbuf[3], "/Group1/Datatype1");
refobj_type = dataset.getRefObjType(&wbuf[3], H5R_OBJECT);
- verify_val(refobj_type, H5O_TYPE_NAMED_DATATYPE, "DataSet::getRefObjType",__LINE__,__FILE__);
+ verify_val(refobj_type, H5O_TYPE_NAMED_DATATYPE, "DataSet::getRefObjType", __LINE__, __FILE__);
// Write selection to disk
dataset.write(wbuf, PredType::STD_REF_OBJ);
@@ -304,15 +312,15 @@ static void test_reference_obj()
DataSet dset2(dataset, &rbuf[0], H5R_OBJECT, dapl);
// Check information in the referenced dataset
- sid1 = dset2.getSpace();
+ sid1 = dset2.getSpace();
hssize_t n_elements = sid1.getSimpleExtentNpoints();
- verify_val((long)n_elements, 4, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__);
+ verify_val((long)n_elements, 4, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Read from disk
dset2.read(tbuf, PredType::NATIVE_UINT);
- for(tu32 = (unsigned *)tbuf, i = 0; i < SPACE1_DIM1; i++, tu32++)
- verify_val(*tu32, (uint32_t)(i*3), "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__);
+ for (tu32 = (unsigned *)tbuf, i = 0; i < SPACE1_DIM1; i++, tu32++)
+ verify_val(*tu32, (uint32_t)(i * 3), "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Close dereferenced dataset
dset2.close();
@@ -323,18 +331,19 @@ static void test_reference_obj()
// Get group's comment using
// H5std_string getComment(const char* name, <buf_size=0 by default>)
H5std_string read_comment1 = group.getComment(".", 10);
- verify_val(read_comment1.c_str(), write_comment, "Group::getComment",__LINE__,__FILE__);
+ verify_val(read_comment1.c_str(), write_comment, "Group::getComment", __LINE__, __FILE__);
// Test with the old default value
read_comment1 = group.getComment(".", 256);
- verify_val(read_comment1.c_str(), write_comment, "Group::getComment",__LINE__,__FILE__);
+ verify_val(read_comment1.c_str(), write_comment, "Group::getComment", __LINE__, __FILE__);
// Test that getComment handles failures gracefully, using
// H5std_string getComment(const char* name, <buf_size=0 by default>)
try {
H5std_string read_comment_tmp = group.getComment(NULL);
}
- catch (Exception& E) {} // We expect this to fail
+ catch (Exception &E) {
+ } // We expect this to fail
// Close group
group.close();
@@ -349,9 +358,9 @@ static void test_reference_obj()
H5T_class_t tclass;
tclass = dtype1.getClass();
- verify_val(tclass, H5T_COMPOUND, "DataType::getClass",__LINE__,__FILE__);
+ verify_val(tclass, H5T_COMPOUND, "DataType::getClass", __LINE__, __FILE__);
int n_members = dtype1.getNmembers();
- verify_val(n_members, 3, "CompType::getNmembers",__LINE__,__FILE__);
+ verify_val(n_members, 3, "CompType::getNmembers", __LINE__, __FILE__);
// Close all objects and file
dtype1.close();
@@ -365,17 +374,14 @@ static void test_reference_obj()
PASSED();
} // end try
- catch (Exception& E)
- {
- issue_fail_msg("test_reference_obj()",__LINE__,__FILE__,
- E.getCFuncName(), E.getCDetailMsg());
+ catch (Exception &E) {
+ issue_fail_msg("test_reference_obj()", __LINE__, __FILE__, E.getCFuncName(), E.getCDetailMsg());
}
- if(file1)
+ if (file1)
delete file1;
-} // test_reference_obj()
+} // test_reference_obj()
-
/*-------------------------------------------------------------------------
* Function: test_reference_group
*
@@ -384,23 +390,24 @@ static void test_reference_obj()
* Return None
*-------------------------------------------------------------------------
*/
-#define GROUPNAME "/group"
-#define GROUPNAME2 "group2"
-#define GROUPNAME3 "group3"
-#define DSETNAME "/dset"
-#define DSETNAME2 "dset2"
-#define NAME_SIZE 16
-
-static void test_reference_group()
+#define GROUPNAME "/group"
+#define GROUPNAME2 "group2"
+#define GROUPNAME3 "group3"
+#define DSETNAME "/dset"
+#define DSETNAME2 "dset2"
+#define NAME_SIZE 16
+
+static void
+test_reference_group()
{
- hobj_ref_t wref; /* Reference to write */
- hobj_ref_t rref; /* Reference to read */
- const H5std_string write_comment="Foo!"; // Comments for group
+ hobj_ref_t wref; /* Reference to write */
+ hobj_ref_t rref; /* Reference to read */
+ const H5std_string write_comment = "Foo!"; // Comments for group
// Output message about test being performed
SUBTEST("Object Reference to Group");
- H5File* file1 = NULL;
+ H5File *file1 = NULL;
try {
/*
* Create file with a group and a dataset containing an object
@@ -408,7 +415,7 @@ static void test_reference_group()
*/
// Create file FILE1
- file1 = new H5File (FILE1, H5F_ACC_TRUNC);
+ file1 = new H5File(FILE1, H5F_ACC_TRUNC);
// Create scalar dataspace
DataSpace sid1;
@@ -467,25 +474,25 @@ static void test_reference_group()
// Check number of objects in the group dereferenced by constructor
hsize_t nobjs = refgroup.getNumObjs();
- verify_val(nobjs, (hsize_t)3, "H5Group::getNumObjs",__LINE__,__FILE__);
+ verify_val(nobjs, (hsize_t)3, "H5Group::getNumObjs", __LINE__, __FILE__);
// Check number of objects in the group dereferenced by ::reference
nobjs = group.getNumObjs();
- verify_val(nobjs, (hsize_t)3, "H5Group::getNumObjs",__LINE__,__FILE__);
+ verify_val(nobjs, (hsize_t)3, "H5Group::getNumObjs", __LINE__, __FILE__);
// Check getting file name given the group dereferenced via constructor
H5std_string fname = refgroup.getFileName();
- verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__);
+ verify_val(fname, FILE1, "H5Group::getFileName", __LINE__, __FILE__);
// Check getting file name given the group dereferenced by ::reference
fname = group.getFileName();
- verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__);
+ verify_val(fname, FILE1, "H5Group::getFileName", __LINE__, __FILE__);
// Check object type using Group::getObjinfo()
H5O_info2_t oinfo;
HDmemset(&oinfo, 0, sizeof(oinfo));
group.getObjinfo(".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, oinfo);
- verify_val(oinfo.type, H5O_TYPE_DATASET, "Group::getObjinfo",__LINE__,__FILE__);
+ verify_val(oinfo.type, H5O_TYPE_DATASET, "Group::getObjinfo", __LINE__, __FILE__);
// Check for out of bound query by index
try {
@@ -494,12 +501,14 @@ static void test_reference_group()
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("Group::getObjinfo", "Out of bound index.");
- } catch (Exception& err) {} // do nothing, failure expected
+ }
+ catch (Exception &err) {
+ } // do nothing, failure expected
// Unlink one of the objects in the dereferenced group, and re-check
refgroup.unlink(GROUPNAME2);
nobjs = refgroup.getNumObjs();
- verify_val(nobjs, (hsize_t)2, "H5Group::getNumObjs",__LINE__,__FILE__);
+ verify_val(nobjs, (hsize_t)2, "H5Group::getNumObjs", __LINE__, __FILE__);
// Close resources
group.close();
@@ -509,17 +518,14 @@ static void test_reference_group()
PASSED();
} // end try
- catch (Exception& E)
- {
- issue_fail_msg("test_reference_group()",__LINE__,__FILE__,
- E.getCFuncName(), E.getCDetailMsg());
+ catch (Exception &E) {
+ issue_fail_msg("test_reference_group()", __LINE__, __FILE__, E.getCFuncName(), E.getCDetailMsg());
}
- if(file1)
+ if (file1)
delete file1;
-} /* test_reference_group() */
+} /* test_reference_group() */
-
/*-------------------------------------------------------------------------
* Function: test_reference_region_1D
*
@@ -528,30 +534,31 @@ static void test_reference_group()
* Return None
*-------------------------------------------------------------------------
*/
-static void test_reference_region_1D()
+static void
+test_reference_region_1D()
{
- hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */
- hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
- hsize_t * coords; /* Coordinate buffer */
- hsize_t low[SPACE3_RANK]; /* Selection bounds */
- hsize_t high[SPACE3_RANK]; /* Selection bounds */
- int i; /* counting variables */
+ hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
+ hsize_t *coords; /* Coordinate buffer */
+ hsize_t low[SPACE3_RANK]; /* Selection bounds */
+ hsize_t high[SPACE3_RANK]; /* Selection bounds */
+ int i; /* counting variables */
// Output message about test being performed
SUBTEST("1-D Dataset Region Reference Functions");
try {
- hdset_reg_ref_t *wbuf, // buffer to write to disk
- *rbuf; // buffer read from disk
- uint8_t *dwbuf, // Buffer for writing numeric data to disk
- *drbuf; // Buffer for reading numeric data from disk
+ hdset_reg_ref_t *wbuf, // buffer to write to disk
+ *rbuf; // buffer read from disk
+ uint8_t *dwbuf, // Buffer for writing numeric data to disk
+ *drbuf; // Buffer for reading numeric data from disk
// Allocate write & read buffers
- wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
- rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
+ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
+ rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1);
drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
@@ -559,7 +566,7 @@ static void test_reference_region_1D()
H5File file1(FILE2, H5F_ACC_TRUNC);
// Create dataspace for datasets
- hsize_t dims3[] = {SPACE3_DIM1};
+ hsize_t dims3[] = {SPACE3_DIM1};
DataSpace sid3(SPACE3_RANK, dims3);
// Create dataset access property list
@@ -568,7 +575,7 @@ static void test_reference_region_1D()
// Create a dataset
DataSet dset3 = file1.createDataSet(DSET2_NAME, PredType::STD_U8LE, sid3);
- uint8_t *tu8; // Temporary pointer to uint8 data
+ uint8_t *tu8; // Temporary pointer to uint8 data
for (tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++)
*tu8++ = i * 3; // from C test
@@ -579,7 +586,7 @@ static void test_reference_region_1D()
dset3.close();
// Create dataspace for datasets
- hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims1[] = {SPACE1_DIM1};
DataSpace sid1(SPACE1_RANK, dims1);
// Create a dataset
@@ -590,24 +597,24 @@ static void test_reference_region_1D()
*/
/* Select 15 2x1 hyperslabs for first reference */
- start[0] = 2;
+ start[0] = 2;
stride[0] = 5;
- count[0] = 15;
- block[0] = 2;
+ count[0] = 15;
+ block[0] = 2;
// Select a hyperslab region to add to the current selected region
sid3.selectHyperslab(H5S_SELECT_SET, count, start, stride, block);
// Get and verify the number of elements in a dataspace selection
hssize_t nelms = sid3.getSelectNpoints();
- verify_val(nelms, 30, "DataSet::getRefObjType",__LINE__,__FILE__);
+ verify_val(nelms, 30, "DataSet::getRefObjType", __LINE__, __FILE__);
// Store first dataset region
file1.reference(&wbuf[0], "/Dataset2", sid3);
// Get and verify object type
H5O_type_t obj_type = dset1.getRefObjType(&wbuf[0], H5R_DATASET_REGION);
- verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__);
+ verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__);
/* Select sequence of ten points for second reference */
coord1[0][0] = 16;
@@ -626,7 +633,7 @@ static void test_reference_region_1D()
// Get and verify the number of elements in a dataspace selection
nelms = sid3.getSelectNpoints();
- verify_val(nelms, 10, "DataSet::getRefObjType",__LINE__,__FILE__);
+ verify_val(nelms, 10, "DataSet::getRefObjType", __LINE__, __FILE__);
// Store first dataset region
file1.reference(&wbuf[1], "/Dataset2", sid3);
@@ -658,12 +665,12 @@ static void test_reference_region_1D()
// Get and verify object type
obj_type = dset1.getRefObjType(&rbuf[0], H5R_DATASET_REGION);
- verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__);
+ verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType", __LINE__, __FILE__);
// Get dataspace of dset3 the verify number of elements
- sid1 = dset3.getSpace();
+ sid1 = dset3.getSpace();
nelms = sid1.getSimpleExtentNpoints();
- verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__);
+ verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
} // End of test DataSet::dereference
{ // Test DataSet constructor -by dereference
@@ -672,9 +679,9 @@ static void test_reference_region_1D()
DataSet newds(dset1, &rbuf[0], H5R_DATASET_REGION, dapl);
// Get dataspace of newds then verify number of elements
- sid1 = newds.getSpace();
+ sid1 = newds.getSpace();
nelms = sid1.getSimpleExtentNpoints();
- verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__);
+ verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
// Close objects for this mini test
newds.close();
@@ -684,8 +691,8 @@ static void test_reference_region_1D()
// Read from disk
dset3.read(drbuf, PredType::STD_U8LE);
- for(tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++)
- verify_val(*tu8, (uint8_t)(i * 3), "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__);
+ for (tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++)
+ verify_val(*tu8, (uint8_t)(i * 3), "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
/*
* Test getting the referenced region
@@ -696,11 +703,11 @@ static void test_reference_region_1D()
// Get and verify number of elements in a dataspace selection
nelms = reg_sp.getSelectNpoints();
- verify_val((long)nelms, 30, "DataSpace::getSelectNpoints",__LINE__,__FILE__);
+ verify_val((long)nelms, 30, "DataSpace::getSelectNpoints", __LINE__, __FILE__);
// Get and verify number of hyperslab blocks
nelms = reg_sp.getSelectHyperNblocks();
- verify_val((long)nelms, 15, "DataSpace::getSelectNpoints",__LINE__,__FILE__);
+ verify_val((long)nelms, 15, "DataSpace::getSelectNpoints", __LINE__, __FILE__);
/* Allocate space for the hyperslab blocks */
coords = (hsize_t *)HDmalloc(nelms * SPACE3_RANK * sizeof(hsize_t) * 2);
@@ -709,43 +716,43 @@ static void test_reference_region_1D()
reg_sp.getSelectHyperBlocklist((hsize_t)0, (hsize_t)nelms, coords);
// Verify values in the list
- verify_val(coords[0], (hsize_t)2, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[1], (hsize_t)3, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[2], (hsize_t)7, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[3], (hsize_t)8, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[4],(hsize_t)12, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[5],(hsize_t)13, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[6],(hsize_t)17, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[7],(hsize_t)18, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[8],(hsize_t)22, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[9],(hsize_t)23, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[10],(hsize_t)27, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[11],(hsize_t)28, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[12],(hsize_t)32, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[13],(hsize_t)33, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[14],(hsize_t)37, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[15],(hsize_t)38, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[16],(hsize_t)42, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[17],(hsize_t)43, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[18],(hsize_t)47, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[19],(hsize_t)48, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[20],(hsize_t)52, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[21],(hsize_t)53, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[22],(hsize_t)57, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[23],(hsize_t)58, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[24],(hsize_t)62, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[25],(hsize_t)63, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[26],(hsize_t)67, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[27],(hsize_t)68, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[28],(hsize_t)72, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[29],(hsize_t)73, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[0], (hsize_t)2, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[1], (hsize_t)3, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[2], (hsize_t)7, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[3], (hsize_t)8, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[4], (hsize_t)12, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[5], (hsize_t)13, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[6], (hsize_t)17, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[7], (hsize_t)18, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[8], (hsize_t)22, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[9], (hsize_t)23, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[10], (hsize_t)27, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[11], (hsize_t)28, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[12], (hsize_t)32, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[13], (hsize_t)33, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[14], (hsize_t)37, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[15], (hsize_t)38, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[16], (hsize_t)42, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[17], (hsize_t)43, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[18], (hsize_t)47, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[19], (hsize_t)48, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[20], (hsize_t)52, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[21], (hsize_t)53, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[22], (hsize_t)57, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[23], (hsize_t)58, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[24], (hsize_t)62, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[25], (hsize_t)63, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[26], (hsize_t)67, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[27], (hsize_t)68, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[28], (hsize_t)72, "Hyperslab Coordinates", __LINE__, __FILE__);
+ verify_val(coords[29], (hsize_t)73, "Hyperslab Coordinates", __LINE__, __FILE__);
HDfree(coords);
// Check boundaries
reg_sp.getSelectBounds(low, high);
- verify_val(low[0],(hsize_t)2, "DataSpace::getSelectBounds",__LINE__,__FILE__);
- verify_val(high[0],(hsize_t)73, "DataSpace::getSelectBounds",__LINE__,__FILE__);
+ verify_val(low[0], (hsize_t)2, "DataSpace::getSelectBounds", __LINE__, __FILE__);
+ verify_val(high[0], (hsize_t)73, "DataSpace::getSelectBounds", __LINE__, __FILE__);
/* Close region space */
reg_sp.close();
@@ -759,7 +766,7 @@ static void test_reference_region_1D()
// Get and verify number of element points in the current selection
hssize_t nelmspts = elm_sp.getSelectElemNpoints();
- verify_val((long)nelmspts, 10, "DataSpace::getSelectNpoints",__LINE__,__FILE__);
+ verify_val((long)nelmspts, 10, "DataSpace::getSelectNpoints", __LINE__, __FILE__);
/* Allocate space for the hyperslab blocks */
coords = (hsize_t *)HDmalloc(nelmspts * SPACE3_RANK * sizeof(hsize_t));
@@ -768,23 +775,23 @@ static void test_reference_region_1D()
elm_sp.getSelectElemPointlist((hsize_t)0, (hsize_t)nelmspts, coords);
// Verify points
- verify_val(coords[0], coord1[0][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[1], coord1[1][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[2], coord1[2][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[3], coord1[3][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[4], coord1[4][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[5], coord1[5][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[6], coord1[6][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[7], coord1[7][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[8], coord1[8][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[9], coord1[9][0], "Element Coordinates",__LINE__,__FILE__);
+ verify_val(coords[0], coord1[0][0], "Element Coordinates", __LINE__, __FILE__);
+ verify_val(coords[1], coord1[1][0], "Element Coordinates", __LINE__, __FILE__);
+ verify_val(coords[2], coord1[2][0], "Element Coordinates", __LINE__, __FILE__);
+ verify_val(coords[3], coord1[3][0], "Element Coordinates", __LINE__, __FILE__);
+ verify_val(coords[4], coord1[4][0], "Element Coordinates", __LINE__, __FILE__);
+ verify_val(coords[5], coord1[5][0], "Element Coordinates", __LINE__, __FILE__);
+ verify_val(coords[6], coord1[6][0], "Element Coordinates", __LINE__, __FILE__);
+ verify_val(coords[7], coord1[7][0], "Element Coordinates", __LINE__, __FILE__);
+ verify_val(coords[8], coord1[8][0], "Element Coordinates", __LINE__, __FILE__);
+ verify_val(coords[9], coord1[9][0], "Element Coordinates", __LINE__, __FILE__);
HDfree(coords);
// Check boundaries
elm_sp.getSelectBounds(low, high);
- verify_val(low[0],(hsize_t)3, "DataSpace::getSelectBounds",__LINE__,__FILE__);
- verify_val(high[0],(hsize_t)97, "DataSpace::getSelectBounds",__LINE__,__FILE__);
+ verify_val(low[0], (hsize_t)3, "DataSpace::getSelectBounds", __LINE__, __FILE__);
+ verify_val(high[0], (hsize_t)97, "DataSpace::getSelectBounds", __LINE__, __FILE__);
// Close element space
elm_sp.close();
@@ -803,12 +810,10 @@ static void test_reference_region_1D()
PASSED();
} // end try
- catch (Exception& E)
- {
- issue_fail_msg("test_reference_region_1D()",__LINE__,__FILE__,
- E.getCFuncName(), E.getCDetailMsg());
+ catch (Exception &E) {
+ issue_fail_msg("test_reference_region_1D()", __LINE__, __FILE__, E.getCFuncName(), E.getCDetailMsg());
}
-} /* test_reference_region_1D() */
+} /* test_reference_region_1D() */
/*-------------------------------------------------------------------------
*
@@ -816,8 +821,8 @@ static void test_reference_region_1D()
*
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_reference()
+extern "C" void
+test_reference()
{
// Output message about test being performed
MESSAGE(5, ("Testing References\n"));
@@ -827,9 +832,8 @@ void test_reference()
test_reference_group(); // Test group reference functionality
test_reference_region_1D(); // Test 1-D reference functionality
-} // test_reference()
+} // test_reference()
-
/*-------------------------------------------------------------------------
* Function: cleanup_reference
*
@@ -838,10 +842,9 @@ void test_reference()
* Return None
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_reference()
+extern "C" void
+cleanup_reference()
{
HDremove(FILE1.c_str());
HDremove(FILE2.c_str());
}
-
diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp
index b8846f4..7411e37 100644
--- a/c++/test/ttypes.cpp
+++ b/c++/test/ttypes.cpp
@@ -25,17 +25,17 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
/*
* Offset from alinged memory returned by malloc(). This can be used to test
* that type conversions handle non-aligned buffers correctly.
*/
-#define ALIGNMENT 1
+#define ALIGNMENT 1
/*
* Define if you want to test alignment code on a machine that doesn't
@@ -50,35 +50,34 @@ using namespace H5;
#define H5T_FRIEND
#include "H5Tpkg.h"
#endif
-#define SET_ALIGNMENT(TYPE,VAL) \
- H5T_NATIVE_##TYPE##_ALIGN_g=MAX(H5T_NATIVE_##TYPE##_ALIGN_g, VAL)
+#define SET_ALIGNMENT(TYPE, VAL) H5T_NATIVE_##TYPE##_ALIGN_g = MAX(H5T_NATIVE_##TYPE##_ALIGN_g, VAL)
#endif
- /* #include "H5Tpkg.h"
+/* #include "H5Tpkg.h"
*/
-const char *FILENAME[] = {
- "dtypes1.h5",
- "dtypes2.h5",
- "dtypes3.h5",
- "dtypes4.h5",
- NULL
-};
+const char *FILENAME[] = {"dtypes1.h5", "dtypes2.h5", "dtypes3.h5", "dtypes4.h5", NULL};
/*
* Count up or down depending on whether the machine is big endian or little
* endian. If local variable `endian' is H5T_ORDER_BE then the result will
* be I, otherwise the result will be Z-(I+1).
*/
-#define ENDIAN(Z,I) (H5T_ORDER_BE==endian?(I):(Z)-((I)+1))
+#define ENDIAN(Z, I) (H5T_ORDER_BE == endian ? (I) : (Z) - ((I) + 1))
-
-typedef enum flt_t {
- FLT_FLOAT, FLT_DOUBLE, FLT_LDOUBLE, FLT_OTHER
-} flt_t;
+typedef enum flt_t { FLT_FLOAT, FLT_DOUBLE, FLT_LDOUBLE, FLT_OTHER } flt_t;
typedef enum int_t {
- INT_CHAR, INT_UCHAR, INT_SHORT, INT_USHORT, INT_INT, INT_UINT,
- INT_LONG, INT_ULONG, INT_LLONG, INT_ULLONG, INT_OTHER
+ INT_CHAR,
+ INT_UCHAR,
+ INT_SHORT,
+ INT_USHORT,
+ INT_INT,
+ INT_UINT,
+ INT_LONG,
+ INT_ULONG,
+ INT_LLONG,
+ INT_ULLONG,
+ INT_OTHER
} int_t;
typedef struct {
@@ -88,7 +87,6 @@ typedef struct {
double d;
} src_typ_t;
-
/*-------------------------------------------------------------------------
* Function: test_classes
*
@@ -100,7 +98,8 @@ typedef struct {
* January, 2007
*-------------------------------------------------------------------------
*/
-static void test_classes()
+static void
+test_classes()
{
SUBTEST("PredType::getClass()");
try {
@@ -108,24 +107,23 @@ static void test_classes()
// PredType::NATIVE_INT should be in H5T_INTEGER class
H5T_class_t tcls = PredType::NATIVE_INT.getClass();
- if (H5T_INTEGER!=tcls) {
+ if (H5T_INTEGER != tcls) {
puts(" Invalid type class for H5T_NATIVE_INT");
}
// PredType::NATIVE_DOUBLE should be in H5T_FLOAT class
tcls = PredType::NATIVE_DOUBLE.getClass();
- if (H5T_FLOAT!=tcls) {
- verify_val(tcls, H5T_FLOAT, "test_class: invalid type class for NATIVE_DOUBLE -", __LINE__, __FILE__);
+ if (H5T_FLOAT != tcls) {
+ verify_val(tcls, H5T_FLOAT, "test_class: invalid type class for NATIVE_DOUBLE -", __LINE__,
+ __FILE__);
}
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
issue_fail_msg("test_classes", __LINE__, __FILE__, E.getCDetailMsg());
}
}
-
/*-------------------------------------------------------------------------
* Function: test_copy
*
@@ -137,7 +135,8 @@ static void test_classes()
* January, 2007
*-------------------------------------------------------------------------
*/
-static void test_copy()
+static void
+test_copy()
{
SUBTEST("DataType::copy() and DataType::operator=");
@@ -148,7 +147,7 @@ static void test_copy()
// Test copying a predefined type using DataType::copy
DataType copied_type;
- copied_type.copy (PredType::STD_B8LE);
+ copied_type.copy(PredType::STD_B8LE);
// Test copying a user-defined type using DataType::operator=
DataType assigned_usertype;
@@ -159,7 +158,7 @@ static void test_copy()
copied_usertype.copy(copied_type);
// Test copying a user-defined int type using DataType::operator=
- IntType orig_int(PredType::STD_B8LE);
+ IntType orig_int(PredType::STD_B8LE);
DataType generic_type;
generic_type = orig_int;
@@ -172,13 +171,11 @@ static void test_copy()
PASSED();
}
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_copy", __LINE__, __FILE__, E.getCDetailMsg());
}
}
-
/*-------------------------------------------------------------------------
* Function: test_detect_type_class
*
@@ -190,29 +187,30 @@ static void test_copy()
* August, 2017
*-------------------------------------------------------------------------
*/
-typedef struct { /* Struct with atomic fields */
- int i;
- float f;
- char c;
- double d;
- short s;
+typedef struct { /* Struct with atomic fields */
+ int i;
+ float f;
+ char c;
+ double d;
+ short s;
} atomic_typ_t;
-typedef struct { /* Struct with complex fields */
- hobj_ref_t arr_r[3][3];
- int i;
- hvl_t vl_f;
- hvl_t vl_s;
- char c;
- short s;
+typedef struct { /* Struct with complex fields */
+ hobj_ref_t arr_r[3][3];
+ int i;
+ hvl_t vl_f;
+ hvl_t vl_s;
+ char c;
+ short s;
} complex_typ_t;
-static void test_detect_type_class()
+static void
+test_detect_type_class()
{
SUBTEST("DataType::detectClass()");
try {
- bool in_class = false; // indicates whether a datatype is in a class
+ bool in_class = false; // indicates whether a datatype is in a class
/*
* Test class of some atomic types.
@@ -260,8 +258,8 @@ static void test_detect_type_class()
*/
// Create an array datatype with an atomic base type
- unsigned rank = 2; // Rank for array datatype
- hsize_t dims[2] = {3,3}; // Dimensions for array datatype
+ unsigned rank = 2; // Rank for array datatype
+ hsize_t dims[2] = {3, 3}; // Dimensions for array datatype
ArrayType atom_arr(PredType::STD_REF_OBJ, rank, dims);
// Make certain that the correct classes can be detected
@@ -367,13 +365,11 @@ static void test_detect_type_class()
PASSED();
}
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_detect_type_class", __LINE__, __FILE__, E.getCDetailMsg());
}
}
-
/*-------------------------------------------------------------------------
* Function: test_vltype
*
@@ -385,12 +381,12 @@ static void test_detect_type_class()
* August, 2017
*-------------------------------------------------------------------------
*/
-static void test_vltype()
+static void
+test_vltype()
{
// Output message about test being performed
SUBTEST("VarLenType functions");
- try
- {
+ try {
VarLenType vltype(PredType::NATIVE_INT);
bool in_class = vltype.detectClass(H5T_VLEN);
@@ -408,9 +404,11 @@ static void test_vltype()
in_class = vltype2.detectClass(H5T_VLEN);
verify_val(in_class, true, "VarLenType::detectClass() with H5T_VLEN for vltype2", __LINE__, __FILE__);
in_class = vltype2.detectClass(H5T_INTEGER);
- verify_val(in_class, true, "VarLenType::detectClass() with H5T_INTEGER for vltype2", __LINE__, __FILE__);
+ verify_val(in_class, true, "VarLenType::detectClass() with H5T_INTEGER for vltype2", __LINE__,
+ __FILE__);
in_class = vltype2.detectClass(H5T_FLOAT);
- verify_val(in_class, false, "VarLenType::detectClass() with H5T_FLOAT for vltype2", __LINE__, __FILE__);
+ verify_val(in_class, false, "VarLenType::detectClass() with H5T_FLOAT for vltype2", __LINE__,
+ __FILE__);
// Create a new file to use in this test
H5File file(FILENAME[3], H5F_ACC_TRUNC);
@@ -435,17 +433,16 @@ static void test_vltype()
in_class = vltype2.detectClass(H5T_VLEN);
verify_val(in_class, true, "VarLenType::detectClass() with H5T_VLEN for vltype2", __LINE__, __FILE__);
in_class = first_vlt_again.detectClass(H5T_FLOAT);
- verify_val(in_class, true, "VarLenType::detectClass() with H5T_FLOAT for first_vlt_again", __LINE__, __FILE__);
+ verify_val(in_class, true, "VarLenType::detectClass() with H5T_FLOAT for first_vlt_again", __LINE__,
+ __FILE__);
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
issue_fail_msg("test_vltype", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_vltype
+} // test_vltype
-
/*-------------------------------------------------------------------------
* Function: test_query
*
@@ -460,14 +457,14 @@ static void test_vltype()
const H5std_string CompT_NAME("Compound_type");
const H5std_string EnumT_NAME("Enum_type");
-static void test_query()
+static void
+test_query()
{
- short enum_val;
+ short enum_val;
// Output message about test being performed
SUBTEST("Query functions of compound and enumeration types");
- try
- {
+ try {
// Create File
H5File file(FILENAME[2], H5F_ACC_TRUNC);
@@ -482,11 +479,11 @@ static void test_query()
// Create a enumerate datatype
EnumType tid2(sizeof(short));
- tid2.insert("RED", (enum_val=0,&enum_val));
- tid2.insert("GREEN", (enum_val=1,&enum_val));
- tid2.insert("BLUE", (enum_val=2,&enum_val));
- tid2.insert("ORANGE", (enum_val=3,&enum_val));
- tid2.insert("YELLOW", (enum_val=4,&enum_val));
+ tid2.insert("RED", (enum_val = 0, &enum_val));
+ tid2.insert("GREEN", (enum_val = 1, &enum_val));
+ tid2.insert("BLUE", (enum_val = 2, &enum_val));
+ tid2.insert("ORANGE", (enum_val = 3, &enum_val));
+ tid2.insert("YELLOW", (enum_val = 4, &enum_val));
// Query member number and member index by name, for compound type
int nmembs = tid1.getNmembers();
@@ -506,10 +503,10 @@ static void test_query()
// prop list, then close it
tid1.commit(file, CompT_NAME);
PropList tcpl = tid1.getCreatePlist();
- if (!IdComponent::isValid(tcpl.getId()))
- {
+ if (!IdComponent::isValid(tcpl.getId())) {
// Throw an invalid action exception
- throw InvalidActionException("H5Object::createAttribute", "Datatype creation property list is not valid");
+ throw InvalidActionException("H5Object::createAttribute",
+ "Datatype creation property list is not valid");
}
tcpl.close();
tid1.close();
@@ -518,10 +515,10 @@ static void test_query()
// prop list, then close it
tid2.commit(file, EnumT_NAME);
tcpl = tid2.getCreatePlist();
- if (!IdComponent::isValid(tcpl.getId()))
- {
+ if (!IdComponent::isValid(tcpl.getId())) {
// Throw an invalid action exception
- throw InvalidActionException("H5Object::createAttribute", "Datatype creation property list is not valid");
+ throw InvalidActionException("H5Object::createAttribute",
+ "Datatype creation property list is not valid");
}
tcpl.close();
tid2.close();
@@ -560,14 +557,12 @@ static void test_query()
H5File file1(FILENAME[2], H5F_ACC_TRUNC);
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
issue_fail_msg("test_query", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_query
+} // test_query
-
/*-------------------------------------------------------------------------
* Function: test_transient
*
@@ -579,17 +574,18 @@ static void test_query()
* January, 2007
*-------------------------------------------------------------------------
*/
-const char* filename1 = "dtypes1.h5";
+const char *filename1 = "dtypes1.h5";
-static void test_transient ()
+static void
+test_transient()
{
- static hsize_t ds_size[2] = {10, 20};
+ static hsize_t ds_size[2] = {10, 20};
SUBTEST("Transient datatypes");
try {
// Create the file and the dataspace.
- H5File file(filename1, H5F_ACC_TRUNC);
+ H5File file(filename1, H5F_ACC_TRUNC);
DataSpace space(2, ds_size, ds_size);
// Copying a predefined type results in a modifiable copy
@@ -600,8 +596,11 @@ static void test_transient ()
try {
Attribute attr(type.createAttribute("attr1", PredType::NATIVE_INT, space));
// Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("H5Object::createAttribute", "Attempted to commit a predefined datatype.");
- } catch (AttributeIException& err) {} // do nothing, failure expected
+ throw InvalidActionException("H5Object::createAttribute",
+ "Attempted to commit a predefined datatype.");
+ }
+ catch (AttributeIException &err) {
+ } // do nothing, failure expected
// Create a dataset from a transient datatype
// type.close(); - put trace in H5Tclose to make sure it's closed
@@ -614,8 +613,11 @@ static void test_transient ()
itype.setPrecision(256);
// Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("PredType::setPrecision", "Dataset datatypes should not be modifiable!");
- } catch (DataTypeIException& err) {}
+ throw InvalidActionException("PredType::setPrecision",
+ "Dataset datatypes should not be modifiable!");
+ }
+ catch (DataTypeIException &err) {
+ }
itype.close();
// Get a copy of the dataset's datatype by applying DataType::copy()
@@ -635,14 +637,12 @@ static void test_transient ()
type.close();
space.close();
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
issue_fail_msg("test_transient", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_transient
+} // test_transient
-
/*-------------------------------------------------------------------------
* Function: test_named
*
@@ -656,12 +656,13 @@ static void test_transient ()
*/
const H5std_string filename2("dtypes2.h5");
-static void test_named ()
+static void
+test_named()
{
static hsize_t ds_size[2] = {10, 20};
- hsize_t i;
- unsigned attr_data[10][20];
- DataType *ds_type = NULL;
+ hsize_t i;
+ unsigned attr_data[10][20];
+ DataType * ds_type = NULL;
SUBTEST("Named datatypes");
try {
@@ -678,15 +679,16 @@ static void test_named ()
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("PredType::commit", "Attempted to commit a predefined datatype.");
- } catch (DataTypeIException& err) {}
+ }
+ catch (DataTypeIException &err) {
+ }
// Copy a predefined datatype and commit the copy.
IntType itype(PredType::NATIVE_INT);
itype.commit(file, "native-int");
// Test commit passing in const H5File& for prototype with const
- try
- {
+ try {
// Create random char type
IntType atype(PredType::NATIVE_UCHAR);
@@ -696,9 +698,8 @@ static void test_named ()
// Commit type passing in const group; compilation would fail if
// no matching prototype
atype.commit(const_grp, "random uchar");
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
issue_fail_msg("test_named", __LINE__, __FILE__, "Commit at const group");
}
@@ -708,11 +709,14 @@ static void test_named ()
// We should not be able to modify a type after it has been committed.
try {
- itype.setPrecision(256); // attempt an invalid action...
+ itype.setPrecision(256); // attempt an invalid action...
// Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("IntType::setPrecision", "Attempted to modify a committed datatype.");
- } catch (DataTypeIException& err) {}
+ throw InvalidActionException("IntType::setPrecision",
+ "Attempted to modify a committed datatype.");
+ }
+ catch (DataTypeIException &err) {
+ }
// We should not be able to re-commit a committed type
try {
@@ -720,12 +724,14 @@ static void test_named ()
// Should FAIL but didn't, so throw an invalid action exception
throw InvalidActionException("IntType::commit", "Attempted to re-commit a committed datatype.");
- } catch (DataTypeIException& err) {} // do nothing, failure expected
+ }
+ catch (DataTypeIException &err) {
+ } // do nothing, failure expected
// It should be possible to define an attribute for the named type
Attribute attr1 = itype.createAttribute("attr1", PredType::NATIVE_UCHAR, space);
- for (i=0; i<ds_size[0]*ds_size[1]; i++)
- attr_data[0][i] = (int)i;/*tricky*/
+ for (i = 0; i < ds_size[0] * ds_size[1]; i++)
+ attr_data[0][i] = (int)i; /*tricky*/
attr1.write(PredType::NATIVE_UINT, attr_data);
attr1.close();
@@ -734,13 +740,15 @@ static void test_named ()
IntType trans_type;
trans_type.copy(itype);
bool iscommitted = trans_type.committed();
- verify_val(iscommitted, 0, "DataType::committed() - Copying a named type should result in a transient type!", __LINE__, __FILE__);
+ verify_val(iscommitted, 0,
+ "DataType::committed() - Copying a named type should result in a transient type!",
+ __LINE__, __FILE__);
trans_type.setPrecision(256);
trans_type.close();
// Close the committed type and reopen it. It should be a named type.
itype.close();
- itype = file.openIntType("native-int");
+ itype = file.openIntType("native-int");
iscommitted = itype.committed();
if (!iscommitted)
throw InvalidActionException("IntType::committed()", "Opened named types should be named types!");
@@ -748,8 +756,8 @@ static void test_named ()
// Create a dataset that uses the named type, then get the dataset's
// datatype and make sure it's a named type.
DataSet dset = file.createDataSet("dset1", itype, space);
- ds_type = new DataType(dset.getDataType());
- iscommitted = ds_type->committed();
+ ds_type = new DataType(dset.getDataType());
+ iscommitted = ds_type->committed();
if (!iscommitted)
throw InvalidActionException("IntType::committed()", "Dataset type should be named type!");
dset.close();
@@ -758,8 +766,8 @@ static void test_named ()
// Reopen the dataset and its type, then make sure the type is
// a named type.
- dset = file.openDataSet("dset1");
- ds_type = new DataType(dset.getDataType());
+ dset = file.openDataSet("dset1");
+ ds_type = new DataType(dset.getDataType());
iscommitted = ds_type->committed();
if (!iscommitted)
throw InvalidActionException("IntType::committed()", "Dataset type should be named type!");
@@ -773,8 +781,8 @@ static void test_named ()
delete ds_type;
// Reopen the second dataset and make sure the type is shared
- dset = file.openDataSet("dset2");
- ds_type = new DataType(dset.getDataType());
+ dset = file.openDataSet("dset2");
+ ds_type = new DataType(dset.getDataType());
iscommitted = ds_type->committed();
if (!iscommitted)
throw InvalidActionException("DataType::iscommitted()", "Dataset type should be named type!");
@@ -793,17 +801,15 @@ static void test_named ()
space.close();
file.close();
PASSED();
- } // end of try block
- catch (Exception& E)
- {
+ } // end of try block
+ catch (Exception &E) {
issue_fail_msg("test_named", __LINE__, __FILE__, E.getCDetailMsg());
}
- if(ds_type)
+ if (ds_type)
delete ds_type;
-} // test_named
+} // test_named
-
/*-------------------------------------------------------------------------
* Function: test_encode_decode
*
@@ -816,12 +822,13 @@ static void test_named ()
*-------------------------------------------------------------------------
*/
const H5std_string filename3("encode_decode.h5");
-const int ARRAY1_RANK = 1;
-const int ARRAY1_DIM = 10;
+const int ARRAY1_RANK = 1;
+const int ARRAY1_DIM = 10;
-static void test_encode_decode()
+static void
+test_encode_decode()
{
- short enum_val;
+ short enum_val;
SUBTEST("DataType::encode() and DataType::decode()");
try {
@@ -847,7 +854,7 @@ static void test_encode_decode()
verify_val(cmptyp.hasBinaryDesc(), true, "DataType::encode", __LINE__, __FILE__);
// Decode compound type's buffer to a new CompType
- CompType* decoded_cmp_ptr(static_cast<CompType *>(cmptyp.decode()));
+ CompType *decoded_cmp_ptr(static_cast<CompType *>(cmptyp.decode()));
// Verify that the datatype was copied exactly via encoding/decoding
verify_val(cmptyp == *decoded_cmp_ptr, true, "DataType::decode", __LINE__, __FILE__);
@@ -871,11 +878,11 @@ static void test_encode_decode()
// Create a enumerate datatype
EnumType enumtyp(sizeof(short));
- enumtyp.insert("RED", (enum_val=0,&enum_val));
- enumtyp.insert("GREEN", (enum_val=1,&enum_val));
- enumtyp.insert("BLUE", (enum_val=2,&enum_val));
- enumtyp.insert("ORANGE", (enum_val=3,&enum_val));
- enumtyp.insert("YELLOW", (enum_val=4,&enum_val));
+ enumtyp.insert("RED", (enum_val = 0, &enum_val));
+ enumtyp.insert("GREEN", (enum_val = 1, &enum_val));
+ enumtyp.insert("BLUE", (enum_val = 2, &enum_val));
+ enumtyp.insert("ORANGE", (enum_val = 3, &enum_val));
+ enumtyp.insert("YELLOW", (enum_val = 4, &enum_val));
// Encode compound type in a buffer
enumtyp.encode();
@@ -884,7 +891,7 @@ static void test_encode_decode()
verify_val(enumtyp.hasBinaryDesc(), true, "DataType::encode", __LINE__, __FILE__);
// Decode enumeration type's buffer to a new EnumType
- EnumType* decoded_enum_ptr(static_cast<EnumType *>(enumtyp.decode()));
+ EnumType *decoded_enum_ptr(static_cast<EnumType *>(enumtyp.decode()));
// Verify that the datatype was copied exactly via encoding/decoding
verify_val(enumtyp == *decoded_enum_ptr, true, "DataType::decode", __LINE__, __FILE__);
@@ -916,7 +923,7 @@ static void test_encode_decode()
verify_val(vlsttyp.hasBinaryDesc(), true, "DataType::encode", __LINE__, __FILE__);
// Decode the variable-length type's buffer to a new StrType
- StrType* decoded_str_ptr(static_cast<StrType *>(vlsttyp.decode()));
+ StrType *decoded_str_ptr(static_cast<StrType *>(vlsttyp.decode()));
verify_val(vlsttyp == *decoded_str_ptr, true, "DataType::decode", __LINE__, __FILE__);
verify_val(decoded_str_ptr->isVariableStr(), true, "DataType::decode", __LINE__, __FILE__);
@@ -926,7 +933,7 @@ static void test_encode_decode()
// Test decoding the type by way of DataType*
// Decode variable-length string type to a new DataType
- DataType* decoded_vlstr_ptr(vlsttyp.decode());
+ DataType *decoded_vlstr_ptr(vlsttyp.decode());
// Create a StrType instance from the DataType object and verify it
StrType decoded_vlsttyp(decoded_vlstr_ptr->getId());
@@ -951,7 +958,7 @@ static void test_encode_decode()
verify_val(arrtyp.hasBinaryDesc(), true, "DataType::encode", __LINE__, __FILE__);
// Create an ArrayType instance from the decoded pointer and verify it
- ArrayType* decoded_arr_ptr(static_cast<ArrayType *>(arrtyp.decode()));
+ ArrayType *decoded_arr_ptr(static_cast<ArrayType *>(arrtyp.decode()));
verify_val(arrtyp == *decoded_arr_ptr, true, "DataType::decode", __LINE__, __FILE__);
@@ -983,7 +990,7 @@ static void test_encode_decode()
verify_val(inttyp.hasBinaryDesc(), true, "DataType::encode", __LINE__, __FILE__);
// Create an IntType instance from the decoded pointer and verify it
- IntType* decoded_int_ptr(static_cast<IntType *>(inttyp.decode()));
+ IntType * decoded_int_ptr(static_cast<IntType *>(inttyp.decode()));
H5T_sign_t int_sign = decoded_int_ptr->getSign();
verify_val(int_sign, H5T_SGN_NONE, "DataType::decode", __LINE__, __FILE__);
verify_val(inttyp == *decoded_int_ptr, true, "DataType::decode", __LINE__, __FILE__);
@@ -1004,27 +1011,25 @@ static void test_encode_decode()
verify_val(flttyp.hasBinaryDesc(), true, "DataType::encode", __LINE__, __FILE__);
// Decode the array type's buffer
- DataType* decoded_flt_ptr(flttyp.decode());
+ DataType *decoded_flt_ptr(flttyp.decode());
// Create a IntType instance from the decoded pointer and verify it
FloatType decoded_flttyp(decoded_flt_ptr->getId());
verify_val(flttyp == decoded_flttyp, true, "DataType::decode", __LINE__, __FILE__);
- //H5std_string norm_string;
- //H5T_norm_t mant_norm = decoded_flttyp.getNorm(norm_string);
- //verify_val(decoded_flttyp.isVariableStr(), true, "DataType::decode", __LINE__, __FILE__);
+ // H5std_string norm_string;
+ // H5T_norm_t mant_norm = decoded_flttyp.getNorm(norm_string);
+ // verify_val(decoded_flttyp.isVariableStr(), true, "DataType::decode", __LINE__, __FILE__);
delete decoded_flt_ptr;
PASSED();
}
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_encode_decode", __LINE__, __FILE__, E.getCDetailMsg());
}
}
-
/*-------------------------------------------------------------------------
* Function: test_operators
*
@@ -1038,9 +1043,10 @@ static void test_encode_decode()
*/
const H5std_string filename4("h5_type_operators.h5");
-static void test_operators()
+static void
+test_operators()
{
- short enum_val;
+ short enum_val;
SUBTEST("DataType::operator== and DataType::operator!=");
try {
@@ -1073,9 +1079,9 @@ static void test_operators()
// Create an enumerate datatype
EnumType enumtyp(sizeof(short));
- enumtyp.insert("RED", (enum_val=0,&enum_val));
- enumtyp.insert("GREEN", (enum_val=1,&enum_val));
- enumtyp.insert("BLUE", (enum_val=2,&enum_val));
+ enumtyp.insert("RED", (enum_val = 0, &enum_val));
+ enumtyp.insert("GREEN", (enum_val = 1, &enum_val));
+ enumtyp.insert("BLUE", (enum_val = 2, &enum_val));
// Verify that operator== and operator!= work properly
verify_val(cmptyp == enumtyp, false, "DataType::operator==", __LINE__, __FILE__);
@@ -1086,7 +1092,7 @@ static void test_operators()
//
// Create random atomic datatypes
- IntType inttyp(PredType::NATIVE_INT);
+ IntType inttyp(PredType::NATIVE_INT);
FloatType flttyp(PredType::NATIVE_FLOAT);
// Get the NATIVE_INT member from the compound datatype above
@@ -1106,13 +1112,11 @@ static void test_operators()
PASSED();
}
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_operators", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_operators
+} // test_operators
-
/*-------------------------------------------------------------------------
* Function: test_types
*
@@ -1121,8 +1125,8 @@ static void test_operators()
* Return None
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_types()
+extern "C" void
+test_types()
{
// Output message about test being performed
MESSAGE(5, ("Testing Generic Data Types\n"));
@@ -1138,9 +1142,8 @@ void test_types()
test_encode_decode();
test_operators();
-} // test_types()
+} // test_types()
-
/*-------------------------------------------------------------------------
* Function: cleanup_types
*
@@ -1149,9 +1152,9 @@ void test_types()
* Return None
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_types()
+extern "C" void
+cleanup_types()
{
for (int i = 0; i < 3; i++)
HDremove(FILENAME[i]);
-} // cleanup_types
+} // cleanup_types
diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp
index 2421a87..8f0c0ab 100644
--- a/c++/test/tvlstr.cpp
+++ b/c++/test/tvlstr.cpp
@@ -27,17 +27,17 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
// Data file used in most test functions
const H5std_string FILENAME("tvlstr.h5");
// 1-D dataset with fixed dimensions
-const int SPACE1_RANK = 1;
+const int SPACE1_RANK = 1;
const hsize_t SPACE1_DIM1 = 4;
/*-------------------------------------------------------------------------
@@ -137,10 +137,11 @@ static void test_vlstr_free_custom(void *_mem, void *info)
const H5std_string DSET1_NAME("String_ds");
const H5std_string DSET1_DATA("String Dataset");
-static void test_vlstring_dataset()
+static void
+test_vlstring_dataset()
{
char *dynstring_ds_write = NULL;
- char *string_ds_check = NULL;
+ char *string_ds_check = NULL;
// Output message about test being performed
SUBTEST("VL String on Datasets");
@@ -156,7 +157,7 @@ static void test_vlstring_dataset()
Group root = file1.openGroup("/");
// Create dataspace for the dataset.
- DataSpace ds_space (H5S_SCALAR);
+ DataSpace ds_space(H5S_SCALAR);
// Create an dataset in the root group.
DataSet dset1 = root.createDataSet(DSET1_NAME, vlst, ds_space);
@@ -166,17 +167,19 @@ static void test_vlstring_dataset()
// Read and verify the dataset string as a string of chars.
dset1.read(&string_ds_check, vlst);
- if(HDstrcmp(string_ds_check, DSET1_DATA.c_str())!=0)
- TestErrPrintf("Line %d: Attribute data different: DSET1_DATA=%s,string_ds_check=%s\n",__LINE__, DSET1_DATA.c_str(), string_ds_check);
+ if (HDstrcmp(string_ds_check, DSET1_DATA.c_str()) != 0)
+ TestErrPrintf("Line %d: Attribute data different: DSET1_DATA=%s,string_ds_check=%s\n", __LINE__,
+ DSET1_DATA.c_str(), string_ds_check);
- HDfree(string_ds_check); // note: no need for std::string test
+ HDfree(string_ds_check); // note: no need for std::string test
string_ds_check = NULL;
// Read and verify the dataset string as an std::string.
H5std_string read_str;
dset1.read(read_str, vlst);
if (read_str != DSET1_DATA)
- TestErrPrintf("Line %d: Attribute data different: DSET1_DATA=%s,read_str=%s\n",__LINE__, DSET1_DATA.c_str(), read_str.c_str());
+ TestErrPrintf("Line %d: Attribute data different: DSET1_DATA=%s,read_str=%s\n", __LINE__,
+ DSET1_DATA.c_str(), read_str.c_str());
// Close the dataset.
dset1.close();
@@ -184,7 +187,7 @@ static void test_vlstring_dataset()
// Test scalar type dataset with 1 value.
dset1 = root.createDataSet("test_scalar_small", vlst, ds_space);
- dynstring_ds_write = (char*)HDcalloc(1, sizeof(char));
+ dynstring_ds_write = (char *)HDcalloc(1, sizeof(char));
HDmemset(dynstring_ds_write, 'A', 1);
// Write data to the dataset, then read it back.
@@ -192,8 +195,9 @@ static void test_vlstring_dataset()
dset1.read(&string_ds_check, vlst);
// Verify data read.
- if(HDstrcmp(string_ds_check,dynstring_ds_write)!=0)
- TestErrPrintf("VL string datasets don't match!, dynstring_ds_write=%s, string_ds_check=%s\n",dynstring_ds_write,string_ds_check);
+ if (HDstrcmp(string_ds_check, dynstring_ds_write) != 0)
+ TestErrPrintf("VL string datasets don't match!, dynstring_ds_write=%s, string_ds_check=%s\n",
+ dynstring_ds_write, string_ds_check);
HDfree(string_ds_check);
string_ds_check = NULL;
dset1.close();
@@ -209,16 +213,15 @@ static void test_vlstring_dataset()
} // end try block
// Catch all exceptions.
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_vlstring_dataset()", __LINE__, __FILE__, E.getCDetailMsg());
}
- if(dynstring_ds_write)
+ if (dynstring_ds_write)
HDfree(dynstring_ds_write);
- if(string_ds_check)
+ if (string_ds_check)
HDfree(string_ds_check);
-} // test_vlstring_dataset()
+} // test_vlstring_dataset()
/*-------------------------------------------------------------------------
* Function: test_vlstring_array_dataset
@@ -234,22 +237,22 @@ static void test_vlstring_dataset()
*/
const H5std_string DSSTRARR_NAME("StringArray_dset");
-static void test_vlstring_array_dataset()
+static void
+test_vlstring_array_dataset()
{
- const char *string_ds_array[SPACE1_DIM1]= {
- "Line 1", "Line 2", "Line 3", "Line 4"
- }; // Information to write
+ const char *string_ds_array[SPACE1_DIM1] = {"Line 1", "Line 2", "Line 3",
+ "Line 4"}; // Information to write
// Output message about test being performed
SUBTEST("VL String Array on Datasets");
- H5File* file1 = NULL;
+ H5File *file1 = NULL;
try {
// Create file.
file1 = new H5File(FILENAME, H5F_ACC_RDWR);
// Create dataspace for datasets.
- hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims1[] = {SPACE1_DIM1};
DataSpace ds_space(SPACE1_RANK, dims1);
// Create a datatype to refer to.
@@ -265,10 +268,10 @@ static void test_vlstring_array_dataset()
dataset.read(string_ds_check, vlst);
hsize_t ii;
- for (ii = 0; ii < SPACE1_DIM1; ii++)
- {
- if(HDstrcmp(string_ds_check[ii], string_ds_array[ii])!=0)
- TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n",__LINE__, string_ds_array[ii], string_ds_check[ii]);
+ for (ii = 0; ii < SPACE1_DIM1; ii++) {
+ if (HDstrcmp(string_ds_check[ii], string_ds_array[ii]) != 0)
+ TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n", __LINE__,
+ string_ds_array[ii], string_ds_check[ii]);
HDfree(string_ds_check[ii]);
}
@@ -286,14 +289,14 @@ static void test_vlstring_array_dataset()
// Create and write another dataset.
DataSet dataset2(file1->createDataSet("Dataset2", vlst, scalar_space));
- char *wdata2 = (char*)HDcalloc(65534, sizeof(char));
+ char * wdata2 = (char *)HDcalloc(65534, sizeof(char));
HDmemset(wdata2, 'A', 65533);
dataset2.write(&wdata2, vlst);
char *rdata2;
dataset2.read(&rdata2, vlst);
- if (HDstrcmp(wdata2, rdata2)!=0)
- TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n",__LINE__, wdata2, rdata2);
+ if (HDstrcmp(wdata2, rdata2) != 0)
+ TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n", __LINE__, wdata2, rdata2);
// Release resources from second dataset operation.
scalar_space.close();
@@ -310,12 +313,11 @@ static void test_vlstring_array_dataset()
} // end try
// Catch all exceptions.
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_vlstring_array_dataset()", __LINE__, __FILE__, E.getCDetailMsg());
}
- if(file1)
+ if (file1)
delete file1;
} // end test_vlstring_array_dataset()
@@ -332,11 +334,12 @@ static void test_vlstring_array_dataset()
*
*-------------------------------------------------------------------------
*/
-static void test_vlstrings_special()
+static void
+test_vlstrings_special()
{
- const char *wdata[SPACE1_DIM1] = {"one", "two", "", "four"};
+ const char *wdata[SPACE1_DIM1] = {"one", "two", "", "four"};
const char *wdata2[SPACE1_DIM1] = {NULL, NULL, NULL, NULL};
- char *rdata[SPACE1_DIM1]; // Information read in
+ char * rdata[SPACE1_DIM1]; // Information read in
// Output message about test being performed.
SUBTEST("Special VL Strings");
@@ -346,7 +349,7 @@ static void test_vlstrings_special()
H5File file1(FILENAME, H5F_ACC_TRUNC);
// Create dataspace for datasets.
- hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims1[] = {SPACE1_DIM1};
DataSpace sid1(SPACE1_RANK, dims1);
// Create a datatype to refer to.
@@ -360,30 +363,29 @@ static void test_vlstrings_special()
// Check data read in.
hsize_t ii; // counting variable
- for (ii=0; ii<SPACE1_DIM1; ii++)
- if(rdata[ii]!=NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)ii,rdata[ii]);
+ for (ii = 0; ii < SPACE1_DIM1; ii++)
+ if (rdata[ii] != NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", (int)ii, rdata[ii]);
// Write dataset to disk, then read it back.
dataset.write(wdata, vlst);
dataset.read(rdata, vlst);
// Compare data read in.
- for (ii = 0; ii < SPACE1_DIM1; ii++)
- {
+ for (ii = 0; ii < SPACE1_DIM1; ii++) {
size_t wlen = HDstrlen(wdata[ii]);
size_t rlen = HDstrlen(rdata[ii]);
- if(wlen != rlen)
- {
- TestErrPrintf("VL data lengths don't match!, strlen(wdata[%d])=%u, strlen(rdata[%d])=%u\n", (int)ii, (unsigned)wlen, (int)ii, (unsigned)rlen);
+ if (wlen != rlen) {
+ TestErrPrintf("VL data lengths don't match!, strlen(wdata[%d])=%u, strlen(rdata[%d])=%u\n",
+ (int)ii, (unsigned)wlen, (int)ii, (unsigned)rlen);
continue;
} // end if
- if(HDstrcmp(wdata[ii],rdata[ii]) != 0)
- {
- TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)ii, wdata[ii], (int)ii, rdata[ii]);
+ if (HDstrcmp(wdata[ii], rdata[ii]) != 0) {
+ TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)ii, wdata[ii],
+ (int)ii, rdata[ii]);
continue;
} // end if
- } // end for
+ } // end for
// Reclaim the read VL data.
DataSet::vlenReclaim((void *)rdata, vlst, sid1);
@@ -398,7 +400,7 @@ static void test_vlstrings_special()
// Create the property list and set the fill value for the second
// dataset.
DSetCreatPropList dcpl;
- char *fill = NULL; // Fill value
+ char * fill = NULL; // Fill value
dcpl.setFillValue(vlst, &fill);
dataset = file1.createDataSet("Dataset4", vlst, sid1, dcpl);
@@ -409,9 +411,9 @@ static void test_vlstrings_special()
dataset.read(rdata, vlst);
// Check data read in.
- for (ii=0; ii<SPACE1_DIM1; ii++)
- if(rdata[ii]!=NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)ii,rdata[ii]);
+ for (ii = 0; ii < SPACE1_DIM1; ii++)
+ if (rdata[ii] != NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", (int)ii, rdata[ii]);
// Try to write nil strings to disk.
dataset.write(wdata2, vlst);
@@ -420,9 +422,9 @@ static void test_vlstrings_special()
dataset.read(rdata, vlst);
// Check data read in.
- for (ii=0; ii<SPACE1_DIM1; ii++)
- if(rdata[ii]!=NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)ii,rdata[ii]);
+ for (ii = 0; ii < SPACE1_DIM1; ii++)
+ if (rdata[ii] != NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n", (int)ii, rdata[ii]);
// Close objects and file.
dataset.close();
@@ -434,8 +436,7 @@ static void test_vlstrings_special()
} // end try
// Catch all exceptions.
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_vlstrings_special()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_vlstrings_special
@@ -452,14 +453,15 @@ static void test_vlstrings_special()
*
*-------------------------------------------------------------------------
*/
-const H5std_string VLSTR_TYPE("vl_string_type");
+const H5std_string VLSTR_TYPE("vl_string_type");
-static void test_vlstring_type()
+static void
+test_vlstring_type()
{
// Output message about test being performed.
SUBTEST("VL String Type");
- H5File* file1 = NULL;
+ H5File *file1 = NULL;
try {
// Open file.
file1 = new H5File(FILENAME, H5F_ACC_RDWR);
@@ -525,12 +527,11 @@ static void test_vlstring_type()
} // end try block
// Catch all exceptions.
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_vlstring_type()", __LINE__, __FILE__, E.getCDetailMsg());
}
- if(file1)
+ if (file1)
delete file1;
} // end test_vlstring_type()
@@ -546,7 +547,8 @@ static void test_vlstring_type()
*
*-------------------------------------------------------------------------
*/
-static void test_compact_vlstring()
+static void
+test_compact_vlstring()
{
// Output message about test being performed
SUBTEST("VL Strings on Compact Dataset");
@@ -556,7 +558,7 @@ static void test_compact_vlstring()
H5File file1(FILENAME, H5F_ACC_TRUNC);
// Create dataspace for datasets
- hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims1[] = {SPACE1_DIM1};
DataSpace sid1(SPACE1_RANK, dims1);
// Create a datatype to refer to
@@ -574,21 +576,23 @@ static void test_compact_vlstring()
dataset.write(wdata, vlst);
// Read dataset from disk
- char *rdata[SPACE1_DIM1]; // Information read in
+ char *rdata[SPACE1_DIM1]; // Information read in
dataset.read(rdata, vlst);
// Compare data read in
hsize_t i;
- for (i=0; i<SPACE1_DIM1; i++) {
- if (HDstrlen(wdata[i])!=strlen(rdata[i])) {
- TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i]));
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ if (HDstrlen(wdata[i]) != strlen(rdata[i])) {
+ TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",
+ (int)i, (int)strlen(wdata[i]), (int)i, (int)strlen(rdata[i]));
continue;
} // end if
- if (HDstrcmp(wdata[i],rdata[i]) != 0) {
- TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]);
+ if (HDstrcmp(wdata[i], rdata[i]) != 0) {
+ TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)i, wdata[i],
+ (int)i, rdata[i]);
continue;
} // end if
- } // end for
+ } // end for
// Reclaim the read VL data
DataSet::vlenReclaim((void *)rdata, vlst, sid1);
@@ -604,11 +608,10 @@ static void test_compact_vlstring()
} // end try
// Catch all exceptions.
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_compact_vlstrings()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_compact_vlstrings
+} // test_compact_vlstrings
/*-------------------------------------------------------------------------
* Function: test_vlstring_attribute
@@ -622,11 +625,12 @@ static void test_compact_vlstring()
*
*-------------------------------------------------------------------------
*/
-static char *string_att_write=NULL;
+static char * string_att_write = NULL;
const H5std_string ATTRSTR_NAME("String_attr");
const H5std_string ATTRSTR_DATA("String Attribute");
-static void test_vlstring_attribute()
+static void
+test_vlstring_attribute()
{
// Output message about test being performed
SUBTEST("VL String on Attributes");
@@ -642,7 +646,7 @@ static void test_vlstring_attribute()
Group root = file1.openGroup("/");
// Create dataspace for the attribute.
- DataSpace att_space (H5S_SCALAR);
+ DataSpace att_space(H5S_SCALAR);
// Create an attribute for the root group.
Attribute gr_attr = root.createAttribute(ATTRSTR_NAME, vlst, att_space);
@@ -653,16 +657,18 @@ static void test_vlstring_attribute()
// Read and verify the attribute string as a string of chars.
char *string_att_check;
gr_attr.read(vlst, &string_att_check);
- if(HDstrcmp(string_att_check, ATTRSTR_DATA.c_str())!=0)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,string_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), string_att_check);
+ if (HDstrcmp(string_att_check, ATTRSTR_DATA.c_str()) != 0)
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,string_att_check=%s\n",
+ __LINE__, ATTRSTR_DATA.c_str(), string_att_check);
- HDfree(string_att_check); // note: no need for std::string test
+ HDfree(string_att_check); // note: no need for std::string test
// Read and verify the attribute string as an std::string.
H5std_string read_str;
gr_attr.read(vlst, read_str);
if (read_str != ATTRSTR_DATA)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_str=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_str.c_str());
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_str=%s\n", __LINE__,
+ ATTRSTR_DATA.c_str(), read_str.c_str());
// Close group's attribute.
gr_attr.close();
@@ -670,7 +676,7 @@ static void test_vlstring_attribute()
// Test creating a "large" sized string attribute
gr_attr = root.createAttribute("test_scalar_large", vlst, att_space);
- string_att_write = (char*)HDcalloc(8192, sizeof(char));
+ string_att_write = (char *)HDcalloc(8192, sizeof(char));
HDmemset(string_att_write, 'A', 8191);
// Write data to the attribute, then read it back.
@@ -678,8 +684,9 @@ static void test_vlstring_attribute()
gr_attr.read(vlst, &string_att_check);
// Verify data read.
- if(HDstrcmp(string_att_check,string_att_write)!=0)
- TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
+ if (HDstrcmp(string_att_check, string_att_write) != 0)
+ TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",
+ string_att_write, string_att_check);
// Release resources.
HDfree(string_att_check);
@@ -691,11 +698,10 @@ static void test_vlstring_attribute()
} // end try block
// Catch all exceptions.
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_vlstring_attribute()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_vlstring_attribute()
+} // test_vlstring_attribute()
#if 0
/*-------------------------------------------------------------------------
@@ -774,11 +780,11 @@ static void test_read_vl_string_attribute()
*/
const H5std_string ATTRSTRARR_NAME("StringArray_attr");
-static void test_vlstring_array_attribute()
+static void
+test_vlstring_array_attribute()
{
- const char *string_att_array[SPACE1_DIM1]= {
- "Line 1", "Line 2", "Line 3", "Line 4"
- }; // Information to write
+ const char *string_att_array[SPACE1_DIM1] = {"Line 1", "Line 2", "Line 3",
+ "Line 4"}; // Information to write
// Output message about test being performed
SUBTEST("VL String Array on Attributes");
@@ -794,7 +800,7 @@ static void test_vlstring_array_attribute()
Group root = file1.openGroup("/");
// Create dataspace for datasets.
- hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims1[] = {SPACE1_DIM1};
DataSpace att_space(SPACE1_RANK, dims1);
// Create an attribute for the root group.
@@ -809,12 +815,12 @@ static void test_vlstring_array_attribute()
gr_attr.read(vlst, &string_att_check);
hsize_t ii;
- for (ii = 0; ii < SPACE1_DIM1; ii++)
- {
- if(HDstrcmp(string_att_check[ii], string_att_array[ii])!=0)
- TestErrPrintf("Line %d: Attribute data different: written=%s,read=%s\n",__LINE__, string_att_check[ii], string_att_check[ii]);
+ for (ii = 0; ii < SPACE1_DIM1; ii++) {
+ if (HDstrcmp(string_att_check[ii], string_att_array[ii]) != 0)
+ TestErrPrintf("Line %d: Attribute data different: written=%s,read=%s\n", __LINE__,
+ string_att_check[ii], string_att_check[ii]);
- HDfree(string_att_check[ii]); // note: no need for std::string test
+ HDfree(string_att_check[ii]); // note: no need for std::string test
}
// Close group's attribute.
@@ -825,15 +831,14 @@ static void test_vlstring_array_attribute()
} // end try block
// Catch all exceptions.
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_vlstring_array_attribute()", __LINE__, __FILE__, E.getCDetailMsg());
}
-} // test_vlstring_array_attribute()
+} // test_vlstring_array_attribute()
/* Helper routine for test_vl_rewrite() */
-static void write_scalar_dset(H5File& file, DataType& type, DataSpace& space,
- char *name, char *data)
+static void
+write_scalar_dset(H5File &file, DataType &type, DataSpace &space, char *name, char *data)
{
DataSet dset;
try {
@@ -841,34 +846,34 @@ static void write_scalar_dset(H5File& file, DataType& type, DataSpace& space,
dset.write(&data, type, space, space);
dset.close();
} // end try
- catch (FileIException& ferr) {
+ catch (FileIException &ferr) {
throw;
}
- catch (DataSetIException& derr) {
+ catch (DataSetIException &derr) {
throw;
}
}
/* Helper routine for test_vl_rewrite() */
-static void read_scalar_dset(H5File& file, DataType& type, DataSpace& space,
- char *name, char *data)
+static void
+read_scalar_dset(H5File &file, DataType &type, DataSpace &space, char *name, char *data)
{
- char *data_read;
+ char * data_read;
DataSet dset;
try {
dset = file.openDataSet(name);
dset.read(&data_read, type, space, space);
dset.close();
- if(HDstrcmp(data, data_read))
+ if (HDstrcmp(data, data_read))
TestErrPrintf("Expected %s for dataset %s but read %s\n", data, name, data_read);
HDfree(data_read);
} // end try
- catch (FileIException& ferr) {
+ catch (FileIException &ferr) {
throw;
}
- catch (DataSetIException& derr) {
+ catch (DataSetIException &derr) {
throw;
}
}
@@ -887,9 +892,10 @@ static void read_scalar_dset(H5File& file, DataType& type, DataSpace& space,
*-------------------------------------------------------------------------
*/
const H5std_string FILENAME2("tvlstr2.h5");
-const int REWRITE_NDATASETS = 32;
+const int REWRITE_NDATASETS = 32;
-static void test_vl_rewrite()
+static void
+test_vl_rewrite()
{
// Output message about test being performed
SUBTEST("I/O on VL strings with link/unlink");
@@ -903,37 +909,37 @@ static void test_vl_rewrite()
StrType type(0, H5T_VARIABLE);
// Create dataspace for the attribute.
- DataSpace space (H5S_SCALAR);
+ DataSpace space(H5S_SCALAR);
// Create in file 1.
- int i;
+ int i;
char name[256]; // Buffer for names & data
- for (i=0; i<REWRITE_NDATASETS; i++) {
+ for (i = 0; i < REWRITE_NDATASETS; i++) {
sprintf(name, "/set_%d", i);
write_scalar_dset(file1, type, space, name, name);
}
// Effectively copy data from file 1 to 2.
- for (i=0; i<REWRITE_NDATASETS; i++) {
+ for (i = 0; i < REWRITE_NDATASETS; i++) {
sprintf(name, "/set_%d", i);
read_scalar_dset(file1, type, space, name, name);
write_scalar_dset(file2, type, space, name, name);
}
// Read back from file 2.
- for (i=0; i<REWRITE_NDATASETS; i++) {
+ for (i = 0; i < REWRITE_NDATASETS; i++) {
sprintf(name, "/set_%d", i);
read_scalar_dset(file2, type, space, name, name);
}
// Remove from file 2.
- for (i=0; i<REWRITE_NDATASETS; i++) {
+ for (i = 0; i < REWRITE_NDATASETS; i++) {
sprintf(name, "/set_%d", i);
file2.unlink(name);
}
// Effectively copy from file 1 to file 2.
- for (i=0; i<REWRITE_NDATASETS; i++) {
+ for (i = 0; i < REWRITE_NDATASETS; i++) {
sprintf(name, "/set_%d", i);
read_scalar_dset(file1, type, space, name, name);
write_scalar_dset(file2, type, space, name, name);
@@ -949,8 +955,7 @@ static void test_vl_rewrite()
} // end try
// Catch all exceptions.
- catch (Exception& E)
- {
+ catch (Exception &E) {
issue_fail_msg("test_vl_rewrite()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // end test_vl_rewrite()
@@ -967,8 +972,8 @@ static void test_vl_rewrite()
*
*-------------------------------------------------------------------------
*/
-extern "C"
-void test_vlstrings()
+extern "C" void
+test_vlstrings()
{
// Output message about test being performed
MESSAGE(5, ("Testing Variable-Length Strings"));
@@ -990,9 +995,8 @@ void test_vlstrings()
// Test writing VL datasets in files with lots of unlinking
test_vl_rewrite();
-} // test_vlstrings()
+} // test_vlstrings()
-
/*-------------------------------------------------------------------------
* Function: cleanup_vlstrings
*
@@ -1001,10 +1005,9 @@ void test_vlstrings()
* Return none
*-------------------------------------------------------------------------
*/
-extern "C"
-void cleanup_vlstrings()
+extern "C" void
+cleanup_vlstrings()
{
HDremove(FILENAME.c_str());
HDremove(FILENAME2.c_str());
}
-