summaryrefslogtreecommitdiffstats
path: root/c++
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2005-12-03 12:28:55 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2005-12-03 12:28:55 (GMT)
commit4620776d72dc398dd134f4b266a38350d6cb7f60 (patch)
tree202d9e4e301c78bd8dd5128c288a31d34adfba92 /c++
parent2b411792801f981a43701e390f072a37f8a81303 (diff)
downloadhdf5-4620776d72dc398dd134f4b266a38350d6cb7f60.zip
hdf5-4620776d72dc398dd134f4b266a38350d6cb7f60.tar.gz
hdf5-4620776d72dc398dd134f4b266a38350d6cb7f60.tar.bz2
[svn-r11757] Purpose: Example code improvement
Description: Improved the use of std members. Platforms tested: Linux 2.4 (heping) SunOS 5.8 64-bit (sol) Linux 2.4 w/PGI (colonelk)
Diffstat (limited to 'c++')
-rw-r--r--c++/examples/chunks.cpp12
-rw-r--r--c++/examples/compound.cpp12
-rw-r--r--c++/examples/create.cpp10
-rw-r--r--c++/examples/extend_ds.cpp12
-rw-r--r--c++/examples/h5group.cpp11
-rw-r--r--c++/examples/readdata.cpp12
-rw-r--r--c++/examples/writedata.cpp12
7 files changed, 56 insertions, 25 deletions
diff --git a/c++/examples/chunks.cpp b/c++/examples/chunks.cpp
index 19718ac..99f386b 100644
--- a/c++/examples/chunks.cpp
+++ b/c++/examples/chunks.cpp
@@ -17,23 +17,27 @@
* We will read from the file created by extend.C
*/
-#include <string>
-
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
-#include "H5Cpp.h"
+#include <string>
#ifndef H5_NO_NAMESPACE
-using namespace H5;
#ifndef H5_NO_STD
+ using std::string;
using std::cout;
using std::endl;
#endif // H5_NO_STD
#endif
+#include "H5Cpp.h"
+
+#ifndef H5_NO_NAMESPACE
+using namespace H5;
+#endif
+
const string FILE_NAME( "SDSextendible.h5" );
const string DATASET_NAME( "ExtendibleArray" );
const int NX = 10;
diff --git a/c++/examples/compound.cpp b/c++/examples/compound.cpp
index 741586a..37df231 100644
--- a/c++/examples/compound.cpp
+++ b/c++/examples/compound.cpp
@@ -18,23 +18,27 @@
* and read back fields' subsets.
*/
-#include <string>
-
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
-#include "H5Cpp.h"
+#include <string>
#ifndef H5_NO_NAMESPACE
-using namespace H5;
#ifndef H5_NO_STD
+ using std::string;
using std::cout;
using std::endl;
#endif // H5_NO_STD
#endif
+#include "H5Cpp.h"
+
+#ifndef H5_NO_NAMESPACE
+using namespace H5;
+#endif
+
const string FILE_NAME( "SDScompound.h5" );
const string DATASET_NAME( "ArrayOfStructures" );
const string MEMBER1( "a_name" );
diff --git a/c++/examples/create.cpp b/c++/examples/create.cpp
index de7dcc6..85afc89 100644
--- a/c++/examples/create.cpp
+++ b/c++/examples/create.cpp
@@ -16,13 +16,19 @@
* This example writes a dataset to a new HDF5 file.
*/
-#include <string>
-
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
+#include <string>
+
+#ifndef H5_NO_NAMESPACE
+#ifndef H5_NO_STD
+ using std::string;
+#endif // H5_NO_STD
+#endif
+
#include "H5Cpp.h"
#ifndef H5_NO_NAMESPACE
diff --git a/c++/examples/extend_ds.cpp b/c++/examples/extend_ds.cpp
index a4cd0e1..5ec6448 100644
--- a/c++/examples/extend_ds.cpp
+++ b/c++/examples/extend_ds.cpp
@@ -19,23 +19,27 @@
*
*/
-#include <string>
-
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
-#include "H5Cpp.h"
+#include <string>
#ifndef H5_NO_NAMESPACE
-using namespace H5;
#ifndef H5_NO_STD
+ using std::string;
using std::cout;
using std::endl;
#endif // H5_NO_STD
#endif
+#include "H5Cpp.h"
+
+#ifndef H5_NO_NAMESPACE
+using namespace H5;
+#endif
+
const string FILE_NAME( "SDSextendible.h5" );
const string DATASET_NAME( "ExtendibleArray" );
const int NX = 10;
diff --git a/c++/examples/h5group.cpp b/c++/examples/h5group.cpp
index bb798b2..437ba17 100644
--- a/c++/examples/h5group.cpp
+++ b/c++/examples/h5group.cpp
@@ -20,23 +20,28 @@
* Note that the C++ API iterator function is not completed yet, thus
* the C version is used in this example.
*/
-#include <string>
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
-#include "H5Cpp.h"
+#include <string>
#ifndef H5_NO_NAMESPACE
-using namespace H5;
#ifndef H5_NO_STD
+ using std::string;
using std::cout;
using std::endl;
#endif // H5_NO_STD
#endif
+#include "H5Cpp.h"
+
+#ifndef H5_NO_NAMESPACE
+using namespace H5;
+#endif
+
const string FILE_NAME( "Group.h5" );
const int RANK = 2;
diff --git a/c++/examples/readdata.cpp b/c++/examples/readdata.cpp
index 776c322..8f00e33 100644
--- a/c++/examples/readdata.cpp
+++ b/c++/examples/readdata.cpp
@@ -18,23 +18,27 @@
// information about the dataset in the SDS.h5 file is obtained.
//
-#include <string>
-
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
-#include "H5Cpp.h"
+#include <string>
#ifndef H5_NO_NAMESPACE
-using namespace H5;
#ifndef H5_NO_STD
+ using std::string;
using std::cout;
using std::endl;
#endif // H5_NO_STD
#endif
+#include "H5Cpp.h"
+
+#ifndef H5_NO_NAMESPACE
+using namespace H5;
+#endif
+
const string FILE_NAME( "SDS.h5" );
const string DATASET_NAME( "IntArray" );
const int NX_SUB = 3; // hyperslab dimensions
diff --git a/c++/examples/writedata.cpp b/c++/examples/writedata.cpp
index 89cf0b9..388939d 100644
--- a/c++/examples/writedata.cpp
+++ b/c++/examples/writedata.cpp
@@ -21,23 +21,27 @@
* file is closed. Program reopens the file and reads and displays the result.
*/
-#include <string>
-
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
-#include "H5Cpp.h"
+#include <string>
#ifndef H5_NO_NAMESPACE
-using namespace H5;
#ifndef H5_NO_STD
+ using std::string;
using std::cout;
using std::endl;
#endif // H5_NO_STD
#endif
+#include "H5Cpp.h"
+
+#ifndef H5_NO_NAMESPACE
+using namespace H5;
+#endif
+
const string FILE_NAME( "Select.h5" );
const string DATASET_NAME( "Matrix in file" );
const int MSPACE1_RANK = 1; // Rank of the first dataset in memory