[svn-r12202] Purpose: Maintenance

Description:
    Changed to alias string instead of std, i.e. H5std_string instead
    of H5std, because the old way wasn't working when std didn't exist.

Platforms tested:
    Linux 2.4 (heping)
    SunOS 5.8 64-bit (sol)
    HPUX 11.00 (kelgia) - this was the problematic platform but I wasn't
                                able to test before.
This commit is contained in:
Binh-Minh Ribler 2006-04-05 11:50:56 -05:00
parent 69a959c55b
commit e36db373ef
6 changed files with 54 additions and 59 deletions

View File

@ -43,18 +43,17 @@
#ifndef H5_NO_NAMESPACE
using namespace H5;
using H5_std::string;
#endif
#include "h5cpputil.h" // C++ utilility header file
const string FILE1("dataset.h5");
const string DSET_DEFAULT_NAME("default");
const string DSET_CHUNKED_NAME("chunked");
const string DSET_SIMPLE_IO_NAME("simple_io");
const string DSET_TCONV_NAME ("tconv");
const string DSET_COMPRESS_NAME("compressed");
const string DSET_BOGUS_NAME ("bogus");
const H5std_string FILE1("dataset.h5");
const H5std_string DSET_DEFAULT_NAME("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 int H5Z_FILTER_BOGUS = 305;
@ -1039,7 +1038,7 @@ main(void)
}
catch (Exception E)
{
return(test_report(nerrors, string(" Dataset")));
return(test_report(nerrors, H5std_string(" Dataset")));
}
// Clean up data file
@ -1047,7 +1046,7 @@ main(void)
// Print out dsets test results
cerr << endl << endl;
return(test_report(nerrors, string(" Dataset")));
return(test_report(nerrors, H5std_string(" Dataset")));
} // main
/*-------------------------------------------------------------------------

View File

@ -39,7 +39,6 @@
#ifndef H5_NO_NAMESPACE
using namespace H5;
using H5_std::string;
#endif
#include "h5cpputil.h"
@ -63,7 +62,7 @@
*
*-------------------------------------------------------------------------
*/
int test_report( int nerrors, const string& testname )
int test_report( int nerrors, const H5std_string& testname )
{
if (nerrors)
{
@ -120,7 +119,7 @@ InvalidActionException::InvalidActionException():Exception(){}
// func_name - IN: Name of the function where failure should occur
// message - IN: Message
//--------------------------------------------------------------------------
InvalidActionException::InvalidActionException(const string func_name, const string message) : Exception(func_name, message) {}
InvalidActionException::InvalidActionException(const H5std_string func_name, const H5std_string message) : Exception(func_name, message) {}
//--------------------------------------------------------------------------
// Function: InvalidActionException destructor

View File

@ -34,7 +34,7 @@ using std::cerr;
using std::endl;
#endif
int test_report (int, const string&);
int test_report (int, const H5std_string&);
void issue_fail_msg(const char* where, int line, const char* file_name,
const char* message="");
@ -70,7 +70,7 @@ template <class Type1, class Type2>
class InvalidActionException : public Exception {
public:
InvalidActionException(const string func_name, const string message = DEFAULT_MSG);
InvalidActionException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG);
InvalidActionException();
virtual ~InvalidActionException();
};

View File

@ -38,59 +38,58 @@
#ifndef H5_NO_NAMESPACE
using namespace H5;
using H5_std::string;
#endif
#include "h5cpputil.h" // C++ utilility header file
const string FILENAME("tattr.h5");
const H5std_string FILENAME("tattr.h5");
const size_t ATTR_MAX_DIMS = 7;
const string ATTR_TMP_NAME("temp_name");
const H5std_string ATTR_TMP_NAME("temp_name");
/* 3-D dataset with fixed dimensions */
const string SPACE1_NAME("Space1");
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;
/* Dataset Information */
const string DSET1_NAME("Dataset1");
const string DSET2_NAME("Dataset2");
const H5std_string DSET1_NAME("Dataset1");
const H5std_string DSET2_NAME("Dataset2");
/* Group Information */
const string GROUP1_NAME("/Group1");
const H5std_string GROUP1_NAME("/Group1");
/* Named Datatype Information */
const string TYPE1_NAME("/Type");
const H5std_string TYPE1_NAME("/Type");
/* Attribute Rank & Dimensions */
const string ATTR1_NAME("Attr1");
const H5std_string ATTR1_NAME("Attr1");
const int ATTR1_RANK = 1;
const int ATTR1_DIM1 = 3;
int attr_data1[ATTR1_DIM1]={512,-234,98123}; /* Test data for 1st attribute */
const string ATTR2_NAME("Attr2");
const H5std_string ATTR2_NAME("Attr2");
const int ATTR2_RANK = 2;
const int ATTR2_DIM1 = 2;
const int ATTR2_DIM2 = 2;
int attr_data2[ATTR2_DIM1][ATTR2_DIM2]={{7614,-416},{197814,-3}}; /* Test data for 2nd attribute */
const string ATTR3_NAME("Attr3");
const H5std_string ATTR3_NAME("Attr3");
const int ATTR3_RANK = 3;
const int ATTR3_DIM1 = 2;
const int ATTR3_DIM2 = 2;
const int 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 string ATTR4_NAME("Attr4");
const H5std_string ATTR4_NAME("Attr4");
const int ATTR4_RANK = 2;
const int ATTR4_DIM1 = 2;
const int ATTR4_DIM2 = 2;
const string ATTR4_FIELDNAME1("i");
const string ATTR4_FIELDNAME2("d");
const string ATTR4_FIELDNAME3("c");
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;
@ -101,12 +100,12 @@ struct attr4_struct {
} 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 string ATTR5_NAME("Attr5");
const H5std_string ATTR5_NAME("Attr5");
const int ATTR5_RANK = 0;
float attr_data5 = (float)-5.123; // Test data for 5th attribute
/* Info for another attribute */
const string ATTR1A_NAME("Attr1_a");
const H5std_string ATTR1A_NAME("Attr1_a");
int attr_data1a[ATTR1_DIM1]={256,11945,-22107};
/****************************************************************
@ -257,7 +256,7 @@ test_attr_rename(void)
Attribute attr1(dataset.openAttribute(ATTR_TMP_NAME));
// Verify new attribute name
string attr_name = attr1.getName();
H5std_string attr_name = attr1.getName();
verify_val(attr_name, ATTR_TMP_NAME, "Attribute::getName", __LINE__, __FILE__);
// Read attribute information immediately, without closing attribute
@ -275,7 +274,7 @@ test_attr_rename(void)
Attribute attr2(dataset.openAttribute(ATTR1A_NAME));
// Verify second attribute name
string attr2_name = attr2.getName();
H5std_string attr2_name = attr2.getName();
verify_val(attr2_name, ATTR1A_NAME, "Attribute::getName", __LINE__, __FILE__);
// Read attribute information immediately, without closing attribute
@ -488,7 +487,7 @@ test_attr_compound_read(void)
// was created
for(i=0; i<fields; i++)
{
string fieldname = datatype.getMemberName(i);
H5std_string fieldname = datatype.getMemberName(i);
if(!((fieldname == ATTR4_FIELDNAME1) ||
(fieldname == ATTR4_FIELDNAME2) ||
(fieldname == ATTR4_FIELDNAME3)))
@ -551,7 +550,7 @@ test_attr_compound_read(void)
} /* end if */
// Verify name
string attr_name = attr.getName();
H5std_string attr_name = attr.getName();
verify_val(attr_name, ATTR4_NAME, "Attribute::getName", __LINE__, __FILE__);
} // end try block
@ -800,7 +799,7 @@ test_attr_mult_read(void)
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
string attr_name = attr.getName();
H5std_string attr_name = attr.getName();
verify_val(attr_name, ATTR1_NAME, "DataType::getName", __LINE__, __FILE__);
attr.close();
@ -926,7 +925,7 @@ test_attr_mult_read(void)
static void
test_attr_delete(void)
{
string attr_name; // Buffer for attribute names
H5std_string attr_name; // Buffer for attribute names
// Output message about test being performed
MESSAGE(5, ("Testing Removing Attribute Function\n"));

View File

@ -41,7 +41,6 @@
#ifndef H5_NO_NAMESPACE
using namespace H5;
using H5_std::string;
#endif
#include "h5cpputil.h" // C++ utilility header file
@ -51,24 +50,24 @@ 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 string FILE1("tfile1.h5");
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 string FILE2("tfile2.h5");
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 string FILE3("tfile3.h5");
const H5std_string FILE3("tfile3.h5");
const int KB = 1024;
const string FILE4("tfile4.h5");
const H5std_string FILE4("tfile4.h5");
/*-------------------------------------------------------------------------
@ -404,10 +403,10 @@ test_file_size(void)
const int RANK = 2;
const int NX = 4;
const int NY = 5;
const string GROUPNAME ("group");
const string DSETNAME ("dataset");
const string ATTRNAME ("attribute");
const string DTYPENAME ("compound");
const H5std_string GROUPNAME ("group");
const H5std_string DSETNAME ("dataset");
const H5std_string ATTRNAME ("attribute");
const H5std_string DTYPENAME ("compound");
// Compound datatype
typedef struct s1_t {
@ -421,7 +420,7 @@ test_file_name()
// Output message about test being performed
MESSAGE(5, ("Testing File Name\n"));
string file_name;
H5std_string file_name;
try {
// Create a file using default properties.
H5File file4(FILE4, H5F_ACC_TRUNC);

View File

@ -40,23 +40,22 @@
#ifndef H5_NO_NAMESPACE
using namespace H5;
using H5_std::string;
#endif
#include "h5cpputil.h" // C++ utilility header file
const string TESTFILE("th5s.h5");
const string DATAFILE("th5s1.h5");
const H5std_string TESTFILE("th5s.h5");
const H5std_string DATAFILE("th5s1.h5");
/* 3-D dataset with fixed dimensions */
const string SPACE1_NAME("Space1");
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;
/* 4-D dataset with one unlimited dimension */
const string SPACE2_NAME("Space2");
const H5std_string SPACE2_NAME("Space2");
const int SPACE2_RANK = 4;
const int SPACE2_DIM1 = 0;
const int SPACE2_DIM2 = 15;
@ -68,16 +67,16 @@ const hsize_t SPACE2_MAX3 = 13;
const hsize_t SPACE2_MAX4 = 23;
/* Scalar dataset with simple datatype */
const string SPACE3_NAME("Scalar1");
const H5std_string SPACE3_NAME("Scalar1");
const int SPACE3_RANK = 0;
unsigned space3_data=65;
/* Scalar dataset with compound datatype */
const string SPACE4_NAME("Scalar2");
const string SPACE4_FIELDNAME1("c1");
const string SPACE4_FIELDNAME2("u");
const string SPACE4_FIELDNAME3("f");
const string SPACE4_FIELDNAME4("c2");
const H5std_string SPACE4_NAME("Scalar2");
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;