From 9998695a59c373046e5de90d15bc5e7b86cdda00 Mon Sep 17 00:00:00 2001 From: tradke Date: Fri, 21 May 2004 21:38:33 +0000 Subject: Patch by Erik Schnetter: Include system headers before local headers, so that #defines in local headers cannot confuse the system headers. git-svn-id: http://svn.cactuscode.org/arrangements/CactusExternal/FlexIO/trunk@65 21a6bef8-4479-4f54-8f8d-0db94a2919ef --- src/H5IO.cc | 86 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/src/H5IO.cc b/src/H5IO.cc index 1d1d859..117b17d 100644 --- a/src/H5IO.cc +++ b/src/H5IO.cc @@ -1,16 +1,16 @@ #include #include #include -//#include -#include "H5IO.hh" #include +#include "H5IO.hh" + hid_t H5IO::DataType2H5(IObase::DataType nt){ switch(nt){ case Int8: return H5T_NATIVE_CHAR; // means data case Char8: // distinct from INT8.. - return H5T_NATIVE_CHAR; // means string + return H5T_NATIVE_CHAR; // means string case Float32: return H5T_NATIVE_FLOAT; case Float64: @@ -30,7 +30,7 @@ hid_t H5IO::DataType2H5(IObase::DataType nt){ case uInt64: return H5T_NATIVE_ULLONG; case Char16: // unicode character type - return H5T_NATIVE_USHORT; + return H5T_NATIVE_USHORT; default: printf("H5IO::H52DataType(): Don't recognize type %d\n",(int)nt); return -1; @@ -59,7 +59,7 @@ IObase::DataType H5IO::H5DataType2DataType(hid_t nt){ return Int64; default: printf("Cannot convert type for integer with %d bytes\n", - typesize); + typesize); break; } break; @@ -72,7 +72,7 @@ IObase::DataType H5IO::H5DataType2DataType(hid_t nt){ return Float64; default: printf("Cannot convert type for floating point with %d bytes\n", - typesize); + typesize); } break; case H5T_TIME: @@ -110,7 +110,7 @@ IObase::DataType H5IO::H5DataType2DataType(hid_t nt){ IObase::DataType H5IO::H52DataType(hid_t &nt){ switch(nt){ case H5T_NATIVE_CHAR: - return Int8; + return Int8; case H5T_NATIVE_CHAR: return Char8; case H5T_NATIVE_FLOAT: @@ -201,8 +201,8 @@ int H5IO::selectdataset(int i){ } herr_t H5IOcounter(hid_t group_id, - const char *member_name, - void *operator_data){ + const char *member_name, + void *operator_data){ int *count = (int*)operator_data; /* typedef struct H5G_stat_t { unsigned long fileno[2]; @@ -215,9 +215,9 @@ herr_t H5IOcounter(hid_t group_id, H5G_stat_t objinfo; // request info about the type of objects in root group if(H5Gget_objinfo(group_id, - member_name, - 1 /* follow links */, - &objinfo)<0) { + member_name, + 1 /* follow links */, + &objinfo)<0) { //fprintf(stderr,"\tcounter: Bad Info [%s] count=%u\n",member_name,*count); return 0; // error (probably bad symlink) } @@ -236,16 +236,16 @@ struct H5IO_getname_t { char *name; }; herr_t H5IOgetname(hid_t group_id, - const char *member_name, - void *operator_data){ + const char *member_name, + void *operator_data){ H5IO_getname_t *getn = (H5IO_getname_t*)operator_data; // check type first (only respond if it is a dataset) H5G_stat_t objinfo; // request info about the type of objects in root group if(H5Gget_objinfo(group_id, - member_name, - 1 /* follow links */, - &objinfo)<0) return 0; // error (probably bad symlink) + member_name, + 1 /* follow links */, + &objinfo)<0) return 0; // error (probably bad symlink) // only count objects that are datasets (not subgroups) if(objinfo.type!=H5G_DATASET) return 0; // do not increment count if it isn't a dataset. @@ -261,13 +261,13 @@ int H5IO::getndatasets(){ int count=0; int idx=0; while(H5Giterate(file, /* hid_t loc_id, */ - "/", /*const char *name, */ - &idx, /* int *idx, */ - H5IOcounter, - &count)<0){} + "/", /*const char *name, */ + &idx, /* int *idx, */ + H5IOcounter, + &count)<0){} //if(nitems!=count){ //printf("getndatasets: nitems{%d}!=count{%d}\n", - // nitems,count); + // nitems,count); //} //fprintf(stderr,"getndatasets:=%u\n",count); nitems = count; // just for internal bookkeeping @@ -275,15 +275,15 @@ int H5IO::getndatasets(){ } void H5IO::getdatasetname(int _index, // in - char *name){ // out + char *name){ // out H5IO_getname_t getn; int idx=_index; getn.index=_index; getn.name=name; getn.count=_index; while(H5Giterate(file, /* hid_t loc_id, */ - "/", /*const char *name, */ - &idx, /* int *idx, */ - H5IOgetname, - &getn)<0){} + "/", /*const char *name, */ + &idx, /* int *idx, */ + H5IOgetname, + &getn)<0){} } void H5IO::enddataspace(){ @@ -311,7 +311,7 @@ int H5IO::createdataset(char *name,IObase::DataType nt,int rank,CONST int *dims) //printf("+++createdataset index=%u\n",index); // dump the old one and create a new one dataset = H5Dcreate(file, name, datatype, dataspace, - H5P_DEFAULT); + H5P_DEFAULT); datasetvalid=1; return 1; } @@ -326,7 +326,7 @@ int H5IO::createdataset(IObase::DataType nt,int rank,CONST int *dims){ sprintf(buffer,"H5IO-Dataset%09u",index); // current index in file //printf("Creating dataset [%s]\n",buffer); dataset = H5Dcreate(file,buffer, datatype, dataspace, - H5P_DEFAULT); + H5P_DEFAULT); datasetvalid=1; return 1; } @@ -441,12 +441,12 @@ int H5IO::read(void *data){ // set up memspace hid_t memspace = H5Screate_simple(rankf,dimsf,NULL); //printf("rankf=%u dimsf=%u:%u:%u\n",(int)rankf, - // (int)dimsf[0],(int)dimsf[1],(int)dimsf[2]); + // (int)dimsf[0],(int)dimsf[1],(int)dimsf[2]); // printf("Data = %u\n",data); // if(!memspace) puts("no memspace"); //if(!dataset) puts("no dataset"); status = H5Dread(dataset,DataType2H5(H5DataType2DataType(datatype)), - memspace,dataspace,H5P_DEFAULT,data); + memspace,dataspace,H5P_DEFAULT,data); // printf("H5Dread status = %d\n",status); hasread=1; return status; @@ -555,7 +555,7 @@ int H5IO::readAttributeInfo(int number,char *name,IObase::DataType &typeID,Long typeID = H5DataType2DataType(atype); nelem = arank ? adims : 1; // single-dimensional array for attributes if (H5Tget_class (atype) == H5T_STRING) - { + { nelem = H5Tget_size(atype); } @@ -570,8 +570,8 @@ struct H5IOatt_name2index_t { int count; }; herr_t H5IOattr_name2index(hid_t group_id, - const char *member_name, - void *operator_data){ + const char *member_name, + void *operator_data){ H5IOatt_name2index_t *s=(H5IOatt_name2index_t*)operator_data; s->count++; if(!strcmp(member_name,s->name)) @@ -582,8 +582,8 @@ herr_t H5IOattr_name2index(hid_t group_id, } herr_t H5IOattr_count(hid_t group_id, - const char *member_name, - void *operator_data){ + const char *member_name, + void *operator_data){ // cycle through all attribs as a dummy counter int *count = (int *)operator_data; (*count)++; @@ -693,13 +693,13 @@ Long8 f_h5_open (char *file,char *accessname,int flen,int alen){ if(*accessname=='R' || *accessname=='r') mode=IObase::Read; else if(*accessname=='W' || *accessname=='w' || - *accessname=='C' || *accessname=='c') + *accessname=='C' || *accessname=='c') mode=IObase::Write; else if(*accessname=='A' || *accessname=='a') mode=IObase::Append; else { fprintf(stderr,"IEEEopen(): Error unknown option [%s] to open file %s\n", - accessname,file); + accessname,file); return 0; } IObase *fid=new H5IO(file,mode); @@ -735,16 +735,16 @@ IOFile H5IOopen (char *file,char *accessname){ else if(*accessname=='a') mode=IObase::Append; else if(!strcmp(accessname,"write") || - !strcmp(accessname,"create") || - !strcmp(accessname,"wb")) + !strcmp(accessname,"create") || + !strcmp(accessname,"wb")) mode = IObase::Write; else if(!strcmp(accessname,"w+") || - !strcmp(accessname,"w+b") || - !strcmp(accessname,"wb+")) + !strcmp(accessname,"w+b") || + !strcmp(accessname,"wb+")) mode=IObase::Append; else{ fprintf(stderr,"IEEEopen(): Error unknown option [%s] to open file %s\n", - accessname,file); + accessname,file); return 0; } IObase *fid=new H5IO(file,mode); -- cgit v1.2.3