summaryrefslogtreecommitdiffstats
path: root/c++/examples
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2013-10-24 23:21:43 (GMT)
committerVailin Choi <vchoi@hdfgroup.org>2013-10-24 23:21:43 (GMT)
commit3d5aa0440f457cefec75fee5f3782a054b9a30e5 (patch)
tree6a945c7c1386802474261327e85e00c558610d56 /c++/examples
parent07a49f439fc44ddec27fd6a25ee0fd52de87ec3c (diff)
downloadhdf5-3d5aa0440f457cefec75fee5f3782a054b9a30e5.zip
hdf5-3d5aa0440f457cefec75fee5f3782a054b9a30e5.tar.gz
hdf5-3d5aa0440f457cefec75fee5f3782a054b9a30e5.tar.bz2
[svn-r24356] Bring revision #24337 from revise_chunks.
h5committested.
Diffstat (limited to 'c++/examples')
-rw-r--r--c++/examples/CMakeLists.txt20
-rw-r--r--c++/examples/CMakeTests.cmake32
-rw-r--r--c++/examples/Makefile.am3
-rw-r--r--c++/examples/Makefile.in3
-rw-r--r--c++/examples/h5tutr_cmprss.cpp2
-rw-r--r--c++/examples/h5tutr_crtatt.cpp2
-rw-r--r--c++/examples/h5tutr_crtdat.cpp2
-rw-r--r--c++/examples/h5tutr_crtgrp.cpp2
-rw-r--r--c++/examples/h5tutr_crtgrpar.cpp2
-rw-r--r--c++/examples/h5tutr_crtgrpd.cpp2
-rw-r--r--c++/examples/h5tutr_extend.cpp3
-rw-r--r--c++/examples/h5tutr_rdwt.cpp14
-rw-r--r--c++/examples/h5tutr_subset.cpp2
13 files changed, 74 insertions, 15 deletions
diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt
index c25b98c..c79f6c2 100644
--- a/c++/examples/CMakeLists.txt
+++ b/c++/examples/CMakeLists.txt
@@ -20,6 +20,18 @@ SET (examples
h5group
)
+SET (tutr_examples
+ h5tutr_cmprss
+ h5tutr_crtdat
+ h5tutr_crtatt
+ h5tutr_crtgrpar
+ h5tutr_crtgrp
+ h5tutr_crtgrpd
+ h5tutr_extend
+ h5tutr_rdwt
+ h5tutr_subset
+)
+
FOREACH (example ${examples})
ADD_EXECUTABLE (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp)
TARGET_NAMING (cpp_ex_${example} ${LIB_TYPE})
@@ -28,6 +40,14 @@ FOREACH (example ${examples})
SET_TARGET_PROPERTIES (cpp_ex_${example} PROPERTIES FOLDER examples/cpp)
ENDFOREACH (example ${examples})
+FOREACH (example ${tutr_examples})
+ ADD_EXECUTABLE (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp)
+ TARGET_NAMING (cpp_ex_${example} ${LIB_TYPE})
+ TARGET_C_PROPERTIES (cpp_ex_${example} " " " ")
+ TARGET_LINK_LIBRARIES (cpp_ex_${example} ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET})
+ SET_TARGET_PROPERTIES (cpp_ex_${example} PROPERTIES FOLDER examples/cpp)
+ENDFOREACH (example ${tutr_examples})
+
IF (BUILD_TESTING)
INCLUDE (CMakeTests.cmake)
ENDIF (BUILD_TESTING)
diff --git a/c++/examples/CMakeTests.cmake b/c++/examples/CMakeTests.cmake
index 47f8ffa..b39dcfe 100644
--- a/c++/examples/CMakeTests.cmake
+++ b/c++/examples/CMakeTests.cmake
@@ -27,3 +27,35 @@
ENDIF (NOT "${last_test}" STREQUAL "")
SET (last_test "cpp_ex_${example}")
ENDFOREACH (example ${examples})
+#the following dependicies are handled by the order of the files
+# SET_TESTS_PROPERTIES(cpp_ex_readdata PROPERTIES DEPENDS cpp_ex_create)
+# SET_TESTS_PROPERTIES(cpp_ex_chunks PROPERTIES DEPENDS cpp_ex_extend_ds)
+
+ ADD_TEST (
+ NAME cpp_ex_tutr-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ h5tutr_cmprss.h5
+ h5tutr_dset.h5
+ h5tutr_extend.h5
+ h5tutr_group.h5
+ h5tutr_groups.h5
+ h5tutr_subset.h5
+ )
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (cpp_ex_tutr-clear-objects PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ SET (last_test "cpp_ex_tutr-clear-objects")
+
+ FOREACH (example ${tutr_examples})
+ ADD_TEST (NAME cpp_ex_${example} COMMAND $<TARGET_FILE:cpp_ex_${example}>)
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (cpp_ex_${example} PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ SET (last_test "cpp_ex_${example}")
+ ENDFOREACH (example ${tutr_examples})
+#the following dependicies are handled by the order of the files
+# SET_TESTS_PROPERTIES(cpp_ex_h5tutr_crtatt PROPERTIES DEPENDS cpp_ex_h5tutr_crtdat)
+# SET_TESTS_PROPERTIES(cpp_ex_h5tutr_rdwt PROPERTIES DEPENDS cpp_ex_h5tutr_crtdat)
+# SET_TESTS_PROPERTIES(cpp_ex_h5tutr_crtgrpd PROPERTIES DEPENDS cpp_ex_h5tutr_crtgrpar)
+ \ No newline at end of file
diff --git a/c++/examples/Makefile.am b/c++/examples/Makefile.am
index f479776..9e616f7 100644
--- a/c++/examples/Makefile.am
+++ b/c++/examples/Makefile.am
@@ -40,6 +40,9 @@ INSTALL_SCRIPT_FILES = run-c++-ex.sh
# Some of the examples depend on files created by running other examples
readdata.chkexe_: create.chkexe_
chunks.chkexe_: extend_ds.chkexe_
+h5tutr_rdwt.chkexe_: h5tutrcrtdat.chkexe
+h5tutrcrtatt.chkexe_: h5tutrcrtdat.chkexe
+h5tutr_crtgrpd.chkexe_: h5tutr_crtgrpar.chkexe
# Tell conclude.am that these are C++ tests.
CXX_API=yes
diff --git a/c++/examples/Makefile.in b/c++/examples/Makefile.in
index f392787..dee7c11 100644
--- a/c++/examples/Makefile.in
+++ b/c++/examples/Makefile.in
@@ -659,6 +659,9 @@ help:
# Some of the examples depend on files created by running other examples
readdata.chkexe_: create.chkexe_
chunks.chkexe_: extend_ds.chkexe_
+h5tutr_rdwt.chkexe_: h5tutrcrtdat.chkexe
+h5tutrcrtatt.chkexe_: h5tutrcrtdat.chkexe
+h5tutr_crtgrpd.chkexe_: h5tutr_crtgrpar.chkexe
# How to build programs using h5c++
$(EXTRA_PROG): $(H5CPP)
diff --git a/c++/examples/h5tutr_cmprss.cpp b/c++/examples/h5tutr_cmprss.cpp
index 7db73c4..e9c87f1 100644
--- a/c++/examples/h5tutr_cmprss.cpp
+++ b/c++/examples/h5tutr_cmprss.cpp
@@ -31,7 +31,7 @@
#endif // H5_NO_STD
#endif
-const H5std_string FILE_NAME("cmprss.h5");
+const H5std_string FILE_NAME("h5tutr_cmprss.h5");
const H5std_string DATASET_NAME("Compressed_Data");
const int DIM0 = 100;
const int DIM1 = 20;
diff --git a/c++/examples/h5tutr_crtatt.cpp b/c++/examples/h5tutr_crtatt.cpp
index 651dc69..df8ca5a 100644
--- a/c++/examples/h5tutr_crtatt.cpp
+++ b/c++/examples/h5tutr_crtatt.cpp
@@ -27,7 +27,7 @@
using namespace H5;
#endif
-const H5std_string FILE_NAME( "dset.h5" );
+const H5std_string FILE_NAME( "h5tutr_dset.h5" );
const H5std_string DATASET_NAME( "dset" );
const H5std_string ATTR_NAME( "Units" );
diff --git a/c++/examples/h5tutr_crtdat.cpp b/c++/examples/h5tutr_crtdat.cpp
index d7f887e..c767f72 100644
--- a/c++/examples/h5tutr_crtdat.cpp
+++ b/c++/examples/h5tutr_crtdat.cpp
@@ -27,7 +27,7 @@
using namespace H5;
#endif
-const H5std_string FILE_NAME("dset.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;
diff --git a/c++/examples/h5tutr_crtgrp.cpp b/c++/examples/h5tutr_crtgrp.cpp
index bbafd10..3db4e72 100644
--- a/c++/examples/h5tutr_crtgrp.cpp
+++ b/c++/examples/h5tutr_crtgrp.cpp
@@ -31,7 +31,7 @@
#endif // H5_NO_STD
#endif
-const H5std_string FILE_NAME("group.h5");
+const H5std_string FILE_NAME("h5tutr_group.h5");
int main(void)
{
diff --git a/c++/examples/h5tutr_crtgrpar.cpp b/c++/examples/h5tutr_crtgrpar.cpp
index d58dff6..f6e031f 100644
--- a/c++/examples/h5tutr_crtgrpar.cpp
+++ b/c++/examples/h5tutr_crtgrpar.cpp
@@ -31,7 +31,7 @@
#endif // H5_NO_STD
#endif
-const H5std_string FILE_NAME("groups.h5");
+const H5std_string FILE_NAME("h5tutr_groups.h5");
int main(void)
{
diff --git a/c++/examples/h5tutr_crtgrpd.cpp b/c++/examples/h5tutr_crtgrpd.cpp
index fdb9108..f0bde52 100644
--- a/c++/examples/h5tutr_crtgrpd.cpp
+++ b/c++/examples/h5tutr_crtgrpd.cpp
@@ -31,7 +31,7 @@
#endif // H5_NO_STD
#endif
-const H5std_string FILE_NAME("groups.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;
diff --git a/c++/examples/h5tutr_extend.cpp b/c++/examples/h5tutr_extend.cpp
index c3a18d7..432ca5e 100644
--- a/c++/examples/h5tutr_extend.cpp
+++ b/c++/examples/h5tutr_extend.cpp
@@ -31,7 +31,7 @@
#endif // H5_NO_STD
#endif
-const H5std_string FILE_NAME("extend.h5");
+const H5std_string FILE_NAME("h5tutr_extend.h5");
const H5std_string DATASETNAME("ExtendibleArray");
int main (void)
@@ -130,6 +130,7 @@ int main (void)
if (H5D_CHUNKED == prop.getLayout())
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);
diff --git a/c++/examples/h5tutr_rdwt.cpp b/c++/examples/h5tutr_rdwt.cpp
index e6e45b7..68c28ca 100644
--- a/c++/examples/h5tutr_rdwt.cpp
+++ b/c++/examples/h5tutr_rdwt.cpp
@@ -27,8 +27,8 @@
using namespace H5;
#endif
-const H5std_string FILE_NAME( "dset.h5" );
-const H5std_string DATASET_NAME( "dset" );
+const H5std_string FILE_NAME("h5tutr_dset.h5");
+const H5std_string DATASET_NAME("dset");
const int DIM0 = 4; // dataset dimensions
const int DIM1 = 6;
@@ -52,24 +52,24 @@ int main (void)
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);
// Write the data to the dataset using default memory space, file
// space, and transfer properties.
- dataset.write( data, PredType::NATIVE_INT );
+ dataset.write(data, PredType::NATIVE_INT);
} // end of try block
// catch failure caused by the H5File operations
- catch( FileIException error )
+ catch(FileIException error)
{
error.printError();
return -1;
}
// catch failure caused by the DataSet operations
- catch( DataSetIException error )
+ catch(DataSetIException error)
{
error.printError();
return -1;
diff --git a/c++/examples/h5tutr_subset.cpp b/c++/examples/h5tutr_subset.cpp
index 77174ab..ad52747 100644
--- a/c++/examples/h5tutr_subset.cpp
+++ b/c++/examples/h5tutr_subset.cpp
@@ -31,7 +31,7 @@
#endif // H5_NO_STD
#endif
-const H5std_string FILE_NAME("subset.h5");
+const H5std_string FILE_NAME("h5tutr_subset.h5");
const H5std_string DATASET_NAME("IntArray");
const int RANK = 2;