std::vector<uint8_t> DataType::encode () const { size_t size = 0; Exception::check ("H5Tencode", H5Tencode (handle (), NULL, &size)); std::vector<uint8_t> data (size); size_t size1 = size; Exception::check ("H5Tencode", H5Tencode (handle (), data.data (), &size)); ASSERT (size1 == size); return data; }
/*------------------------------------------------------------------------- * Function: print_dset_dtype_meta * * Purpose: Prints datasets' datatype information * * Return: Success: 0 * * Failure: Never fails * * Programmer: Vailin Choi; October 2009 * *------------------------------------------------------------------------- */ static herr_t print_dset_dtype_meta(const iter_t *iter) { unsigned long total; /* Total count for various statistics */ size_t dtype_size; /* Size of encoded datatype */ unsigned u; /* Local index variable */ if(iter->dset_ntypes) { printf("Dataset datatype information:\n"); printf("\t# of unique datatypes used by datasets: %lu\n", iter->dset_ntypes); total = 0; for(u = 0; u < iter->dset_ntypes; u++) { H5Tencode(iter->dset_type_info[u].tid, NULL, &dtype_size); printf("\tDataset datatype #%u:\n", u); printf("\t\tCount (total/named) = (%lu/%lu)\n", iter->dset_type_info[u].count, iter->dset_type_info[u].named); printf("\t\tSize (desc./elmt) = (%lu/%lu)\n", (unsigned long)dtype_size, (unsigned long)H5Tget_size(iter->dset_type_info[u].tid)); H5Tclose(iter->dset_type_info[u].tid); total += iter->dset_type_info[u].count; } /* end for */ printf("\tTotal dataset datatype count: %lu\n", total); } /* end if */ return 0; } /* print_dset_dtype_meta() */
/*------------------------------------------------------------------------- * Function: print_dataset_info * * Purpose: Prints information about datasets in the file * * Return: Success: 0 * * Failure: Never fails * * Programmer: Elena Pourmal * Saturday, August 12, 2006 * * Modifications: * *------------------------------------------------------------------------- */ static herr_t print_dataset_info(const iter_t *iter) { unsigned long power; /* Temporary "power" for bins */ unsigned long total; /* Total count for various statistics */ size_t dtype_size; /* Size of encoded datatype */ unsigned u; /* Local index variable */ if(iter->uniq_dsets > 0) { printf("Dataset dimension information:\n"); printf("\tMax. rank of datasets: %u\n", iter->max_dset_rank); printf("\tDataset ranks:\n"); for(u = 0; u < H5S_MAX_RANK; u++) if(iter->dset_rank_count[u] > 0) printf("\t\t# of dataset with rank %u: %lu\n", u, iter->dset_rank_count[u]); printf("1-D Dataset information:\n"); HDfprintf(stdout, "\tMax. dimension size of 1-D datasets: %Hu\n", iter->max_dset_dims); printf("\tSmall 1-D datasets:\n"); total = 0; for(u = 0; u < SIZE_SMALL_DSETS; u++) { if(iter->small_dset_dims[u] > 0) { printf("\t\t# of dataset dimensions of size %u: %lu\n", u, iter->small_dset_dims[u]); total += iter->small_dset_dims[u]; } /* end if */ } /* end for */ printf("\t\tTotal small datasets: %lu\n", total); /* Protect against no datasets in file */ if(iter->dset_dim_nbins > 0) { printf("\t1-D Dataset dimension bins:\n"); total = 0; if(iter->dset_dim_bins[0] > 0) { printf("\t\t# of datasets of size 0: %lu\n", iter->dset_dim_bins[0]); total = iter->dset_dim_bins[0]; } /* end if */ power = 1; for(u = 1; u < iter->dset_dim_nbins; u++) { if(iter->dset_dim_bins[u] > 0) { printf("\t\t# of datasets of size %lu - %lu: %lu\n", power, (power * 10) - 1, iter->dset_dim_bins[u]); total += iter->dset_dim_bins[u]; } /* end if */ power *= 10; } /* end for */ printf("\t\tTotal # of datasets: %lu\n", total); } /* end if */ printf("Dataset storage information:\n"); HDfprintf(stdout, "\tTotal raw data size: %Hu\n", iter->dset_storage_size); printf("Dataset layout information:\n"); for(u = 0; u < H5D_NLAYOUTS; u++) printf("\tDataset layout counts[%s]: %lu\n", (u == 0 ? "COMPACT" : (u == 1 ? "CONTIG" : "CHUNKED")), iter->dset_layouts[u]); printf("\tNumber of external files : %lu\n", iter->nexternal); printf("Dataset filters information:\n"); printf("\tNumber of datasets with:\n"); printf("\t\tNO filter: %lu\n", iter->dset_comptype[H5Z_FILTER_ERROR+1]); printf("\t\tGZIP filter: %lu\n", iter->dset_comptype[H5Z_FILTER_DEFLATE]); printf("\t\tSHUFFLE filter: %lu\n", iter->dset_comptype[H5Z_FILTER_SHUFFLE]); printf("\t\tFLETCHER32 filter: %lu\n", iter->dset_comptype[H5Z_FILTER_FLETCHER32]); printf("\t\tSZIP filter: %lu\n", iter->dset_comptype[H5Z_FILTER_SZIP]); printf("\t\tNBIT filter: %lu\n", iter->dset_comptype[H5Z_FILTER_NBIT]); printf("\t\tSCALEOFFSET filter: %lu\n", iter->dset_comptype[H5Z_FILTER_SCALEOFFSET]); printf("\t\tUSER-DEFINED filter: %lu\n", iter->dset_comptype[H5_NFILTERS_IMPL-1]); if(display_dtype_metadata) { printf("Dataset datatype information:\n"); printf("\t# of unique datatypes used by datasets: %lu\n", iter->dset_ntypes); total = 0; for(u = 0; u < iter->dset_ntypes; u++) { H5Tencode(iter->dset_type_info[u].tid, NULL, &dtype_size); printf("\tDataset datatype #%u:\n", u); printf("\t\tCount (total/named) = (%lu/%lu)\n", iter->dset_type_info[u].count, iter->dset_type_info[u].named); printf("\t\tSize (desc./elmt) = (%lu/%lu)\n", (unsigned long)dtype_size, (unsigned long)H5Tget_size(iter->dset_type_info[u].tid)); H5Tclose(iter->dset_type_info[u].tid); total += iter->dset_type_info[u].count; } /* end for */ printf("\tTotal dataset datatype count: %lu\n", total); } } /* end if */ return 0; }