• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ H5Tget_size函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中H5Tget_size函数的典型用法代码示例。如果您正苦于以下问题:C++ H5Tget_size函数的具体用法?C++ H5Tget_size怎么用?C++ H5Tget_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了H5Tget_size函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: AH5_H5Tcreate_cpx_filetype

hid_t AH5_H5Tcreate_cpx_filetype(void)
{
    hid_t cpx_filetype;

    cpx_filetype = H5Tcreate(H5T_COMPOUND, H5Tget_size(AH5_NATIVE_FLOAT) * 2);
    H5Tinsert(cpx_filetype, "r", 0, AH5_NATIVE_FLOAT);
    H5Tinsert(cpx_filetype, "i", H5Tget_size(AH5_NATIVE_FLOAT), AH5_NATIVE_FLOAT);

    return cpx_filetype;
}
开发者ID:ThinkManhattan,项目名称:amelet-hdf,代码行数:10,代码来源:ah5_general.c


示例2: main

int
main(int argc, char **argv)
{
    char file_name[256], dset_name[256];
    hid_t file_id, dataset_id, space_id, plist_id, type_id;
    hsize_t dims[1], dims_chunk[1];
    hsize_t maxdims[1] = { H5S_UNLIMITED };
    size_t disk_type_size, computed_type_size, packed_type_size;

    if (argc < 3) {
        printf("Pass the name of the file and dataset to check as arguments\n");
        return(0);
    }

    strcpy(file_name, argv[1]);
    strcpy(dset_name, argv[2]);
    
    dims[0] = 20;  // Create 20 records
    dims_chunk[0] = 10;

    // Create a new file
    file_id = H5Fcreate(file_name, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
    // Create a simple data space with unlimited size
    space_id = H5Screate_simple(1, dims, maxdims);
    // Modify dataset creation properties, i.e. enable chunking
    plist_id = H5Pcreate (H5P_DATASET_CREATE);
    H5Pset_chunk(plist_id, 1, dims_chunk);
    // Get the nested type
    type_id = createNestedType();
    // Create the dataset
    dataset_id = H5Dcreate(file_id, dset_name, type_id, space_id, plist_id);
    // Free resources
    H5Sclose(space_id);
    H5Pclose(plist_id);
    H5Dclose(dataset_id);
    H5Fclose(file_id);

    // Compute type sizes for native and packed
    disk_type_size = H5Tget_size(type_id);
    computed_type_size = getNestedSizeType(type_id);
    H5Tpack(type_id);  // pack type
    packed_type_size = H5Tget_size(type_id);
    printf("Disk type size: %d\n", disk_type_size);
    printf("Packed type size: %d (should be %d)\n",
           packed_type_size, computed_type_size);

    H5Tclose(type_id);

    return(1);
}
开发者ID:87,项目名称:PyTables,代码行数:50,代码来源:create-nested-type.c


示例3: get_attribute_float

static herr_t get_attribute_float(hid_t input, const char *name, float *val)
{
    hid_t attr_id;
    hid_t type_id;
    H5T_class_t type_class;
    size_t type_size;

    herr_t status;

    char *strval;

    attr_id = H5Aopen_name(input, name);
    type_id = H5Aget_type(attr_id);
    type_class = H5Tget_class(type_id);
    type_size = H5Tget_size(type_id);

    H5Tclose(type_id);
    H5Aclose(attr_id);

    switch(type_class)
    {
        case H5T_STRING:
            status = get_attribute_str(input, name, &strval);
            if (status < 0) return -1;
                *val = atof(strval);
            free(strval);
            return 0;
        case H5T_FLOAT:
            status = get_attribute(input, name, H5T_NATIVE_FLOAT, val);
            if (status < 0) return -1;
            return 0;
    }
    return -1;
}
开发者ID:QuLogic,项目名称:citcoms,代码行数:34,代码来源:Citcoms_Hdf2Vtk.c


示例4: read_vector

void read_vector(
    hid_t dataset_id,
    hid_t datatype_id,
    hid_t dataspace_id,
    std::vector<std::string>& out) {

  hsize_t size;
  hsize_t dims[1];

  H5Sget_simple_extent_dims(dataspace_id, dims, NULL);

  size = H5Tget_size(datatype_id);

  char *pool = new char[ size * dims[0] ];
  char *ptr = pool;
  char *buf = new char[size];

  H5Dread(dataset_id, datatype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, pool);
  out.reserve(dims[0]);

  for (size_t i = 0; i < dims[0]; ++i, ptr += size) {
    memcpy(buf, ptr, size);
    out.push_back( buf );
  }

  delete [] pool;
  delete [] buf;
}
开发者ID:Al3n70rn,项目名称:clustering_on_transcript_compatibility_counts,代码行数:28,代码来源:h5utils.cpp


示例5: AH5_read_str_attr

// Read string attribute <attr_name> given by address <path>
char AH5_read_str_attr(hid_t loc_id, const char *path, char *attr_name, char **rdata)
{
    hid_t attr_id, filetype, memtype;
    size_t sdim;
    char success = AH5_FALSE;

    if (AH5_path_valid(loc_id, path) || strcmp(path, ".") == 0)
        if (H5Aexists_by_name(loc_id, path, attr_name, H5P_DEFAULT) > 0)
        {
            attr_id = H5Aopen_by_name(loc_id, path, attr_name, H5P_DEFAULT, H5P_DEFAULT);
            filetype = H5Aget_type(attr_id);
            sdim = H5Tget_size(filetype);
            sdim++;  // make a space for null terminator
            *rdata = (char *) malloc(sdim * sizeof(char));
            memtype = H5Tcopy(H5T_C_S1);
            H5Tset_size(memtype, sdim);
            if (H5Aread(attr_id, memtype, *rdata) >= 0)
                success = AH5_TRUE;
            else
                free(*rdata);
            H5Tclose(memtype);
            H5Tclose(filetype);
            H5Aclose(attr_id);
        }
    if (!success)
        *rdata = NULL;
    return success;
}
开发者ID:ThinkManhattan,项目名称:amelet-hdf,代码行数:29,代码来源:ah5_attribute.c


示例6: print_dset_dtype_meta

/*-------------------------------------------------------------------------
 * 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() */
开发者ID:ArielleBassanelli,项目名称:gempak,代码行数:39,代码来源:h5stat.c


示例7: h5_value_doubles

void h5_value_doubles(hid_t file_id, char *group, char *name, double **values,
	int *numValues)
{
  int kk;
  hid_t group_id = H5Gopen(file_id, group, H5P_DEFAULT);
  hid_t data_id = H5Dopen(group_id, name, H5P_DEFAULT);
  hid_t data_space = H5Dget_space(data_id);
  int rank = H5Sget_simple_extent_ndims(data_space);
  hsize_t dims[H5S_MAX_RANK], maxdim[H5S_MAX_RANK];
  H5Sget_simple_extent_dims(data_space, dims, maxdim);
  hid_t data_type = H5Dget_type(data_id);
  H5T_class_t data_class = H5Tget_native_type(data_type, H5T_DIR_DEFAULT);
  size_t data_size = H5Tget_size(data_class);  
  hsize_t elements = 1;
  for (kk=0; kk<rank; kk++)
    elements *= dims[kk];
  void *buf = (void *) MALLOC((size_t)(elements*data_size));
  H5Dread(data_id, data_class, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
  *values = buf;
  *numValues = elements;
  H5Tclose(data_type);
  H5Tclose(data_class);
  H5Sclose(data_space);
  H5Dclose(data_id);
  H5Gclose(group_id); 
}
开发者ID:khogenso,项目名称:ASF_MapReady,代码行数:26,代码来源:measures_hdf2csv.c


示例8: luaC_h5_read_string

int luaC_h5_read_string(lua_State *L)
{
  const char *dsetnm = luaL_checkstring(L, 1);
  if (PresentFile < 0) {
    luaL_error(L, "no open file");
  }
  hid_t dset = H5Dopen(PresentFile, dsetnm, H5P_DEFAULT);
  if (dset < 0) {
    luaL_error(L, "no data set named %s", dsetnm);
  }
  hid_t fspc = H5Dget_space(dset);
  hid_t strn = H5Dget_type(dset);
  hsize_t msize = H5Tget_size(strn);

  char *string = (char*) malloc((msize+1)*sizeof(char));

  H5Dread(dset, strn, fspc, fspc, H5P_DEFAULT, string);
  string[msize] = '\0'; // Make sure to null-terminate the string
  lua_pushstring(L, string);

  H5Tclose(strn);
  H5Sclose(fspc);
  H5Dclose(dset);
  free(string);

  return 1;
}
开发者ID:jzrake,项目名称:luview,代码行数:27,代码来源:h5lua.c


示例9: miget_data_type_size

/** Return the byte size of the voxel datatytpe
 */
int miget_data_type_size ( mihandle_t volume, misize_t *voxel_size )
{
  hid_t grp_id;
  hid_t dset_id;
  hid_t type_id;
  hid_t file_id = volume->hdf_id;

  grp_id = midescend_path ( file_id, MI_FULLIMAGE_PATH );

  if ( grp_id < 0 ) {
    return ( MI_ERROR );
  }

  dset_id = H5Dopen1 ( grp_id, "image" );

  if ( dset_id < 0 ) {
    return ( MI_ERROR );
  }

  type_id = H5Dget_type ( dset_id );

  if ( type_id < 0 ) {
    return ( MI_ERROR );
  }

  *voxel_size = H5Tget_size ( type_id );

  H5Tclose ( type_id );
  H5Dclose ( dset_id );
  H5Gclose ( grp_id );

  return ( MI_NOERROR );
}
开发者ID:SiyaSher,项目名称:libminc,代码行数:35,代码来源:datatype.c


示例10: getNestedSizeType

size_t
getNestedSizeType(hid_t type_id) {
    hid_t member_type_id;
    H5T_class_t class_id;
    hsize_t i, nfields;
    size_t itemsize, offset;

    nfields = H5Tget_nmembers(type_id);
    offset = 0;
    // Iterate thru the members
    for (i=0; i < nfields; i++) {
        // Get the member type
        member_type_id = H5Tget_member_type(type_id, i);
        // Get the HDF5 class
        class_id = H5Tget_class(member_type_id);
        if (class_id == H5T_COMPOUND) {
            // Get the member size for compound type
            itemsize = getNestedSizeType(member_type_id);
        }
        else {
            // Get the atomic member size
            itemsize = H5Tget_size(member_type_id);
        }
        // Update the offset
        offset = offset + itemsize;
    }
    return(offset);
}      
开发者ID:87,项目名称:PyTables,代码行数:28,代码来源:create-nested-type.c


示例11: H5Dataset_read_attr_value

/* read attribute value */
char* H5Dataset_read_attr_value(hid_t aid)
{
    hid_t asid=-1, atid=-1;
    int i, rank;
    hsize_t *dims;
    size_t size=1;
    char *attr_buf=NULL;
  
    asid = H5Aget_space(aid);
    atid = H5Aget_type(aid);
    rank = H5Sget_simple_extent_ndims(asid);

    if (rank > 0) {
        dims = (hsize_t *)malloc(rank * sizeof(hsize_t));
        H5Sget_simple_extent_dims(asid, dims, NULL);
        for (i=0; i<rank; i++) {
            size *= (size_t)dims[i];
            free(dims);
        }
        size *= H5Tget_size(atid);
        attr_buf = (char *)malloc(size);

        if (H5Aread( aid, atid, attr_buf) < 0) {
            free(attr_buf);
            attr_buf = NULL;
        }

    }
    
    if( atid > 0) H5Tclose(atid);
    if (asid > 0) H5Sclose(asid);
 
    return attr_buf;
}
开发者ID:DICE-UNC,项目名称:iRODS-FUSE-Mod,代码行数:35,代码来源:h5Dataset.c


示例12: get_cols

/* fetch num_cols and the col for a particular trackname */
void get_cols(chromosome_t *chromosome, char *trackname, hsize_t *num_cols,
              hsize_t *col) {
  hid_t attr, root, dataspace, datatype;
  hsize_t data_size, cell_size, num_cells;
  char *attr_data;

  /* Tracknames are stored in the attributes of the root group of each file */
  root = H5Gopen(chromosome->h5group, "/", H5P_DEFAULT);
  assert(root >= 0);

  attr = H5Aopen_name(root, "tracknames");
  assert(attr >= 0);

  dataspace = H5Aget_space(attr);
  assert(dataspace >= 0);

  assert(H5Sget_simple_extent_dims(dataspace, num_cols, NULL) == 1);
  assert(H5Sclose(dataspace) >= 0);

  if (trackname && col) {
    datatype = H5Aget_type(attr);
    assert(datatype >= 0);
    assert(H5Tget_class(datatype) == H5T_STRING);

    cell_size = H5Tget_size(datatype);
    assert(cell_size > 0);

    data_size = H5Aget_storage_size(attr);
    assert(data_size > 0);

    num_cells = data_size / cell_size;

    /* allocate room for tracknames */
    attr_data = xmalloc(data_size);
    assert(attr_data);

    assert(H5Aread(attr, datatype, attr_data) >= 0);

    *col = 0;
    for (*col = 0; *col <= num_cells; (*col)++) {
      if (*col == num_cells) {
        fprintf(stderr, "can't find trackname: %s\n", trackname);
        free(attr_data);
        exit(EXIT_FAILURE);
      } else {
        if (!strncmp(attr_data + (*col * cell_size), trackname, cell_size)) {
          break;
        }
      }
    }

    /* clean up read tracknames */
    free(attr_data);
  }

  assert(H5Aclose(attr) >= 0);
}
开发者ID:weallen,项目名称:Seqwill,代码行数:58,代码来源:genomedata_load_data.c


示例13: AH5_auto_test_file

char *test_read_complex_dataset()
{

    int i,rank = 1;
    hsize_t dims[1];
    hid_t dataspace_id, dset_id, dtr_id, dti_id, file_id;
    size_t type_size;
    hid_t type_id;
    herr_t status, status_2;
    float *real_part, *imag_part;
    const char* path = "dataset_name";
    AH5_complex_t cplx[2];
    AH5_complex_t * rdata;

    file_id = AH5_auto_test_file();

    cplx[0].re=10.;
    cplx[0].im=20.;
    cplx[1].re=10.5;
    cplx[1].im=20.5;
    //first write complex array set with hdf5 lib
	real_part = (float *)malloc(2 * sizeof(float));
    imag_part = (float *)malloc(2 * sizeof(float));
    for( i=0;i<2;i++)
    {
        real_part[i] = cplx[i].re;
        imag_part[i] = cplx[i].im;
    }
    type_id = create_type_id(H5T_NATIVE_FLOAT);
    dims[0] = 2;
    dataspace_id = H5Screate_simple(rank, dims, NULL);
    dset_id = H5Dcreate(file_id,path,type_id,dataspace_id,
                H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
    type_size = H5Tget_size(H5T_NATIVE_FLOAT);
    dtr_id = H5Tcreate(H5T_COMPOUND,type_size);
    status = H5Tinsert(dtr_id,"r",0, H5T_NATIVE_FLOAT);
    dti_id = H5Tcreate(H5T_COMPOUND,type_size);
    status = H5Tinsert(dti_id,"i",0, H5T_NATIVE_FLOAT);
    status = H5Dwrite(dset_id,dtr_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,real_part);
    status = H5Dwrite(dset_id,dti_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,imag_part);
    status = H5Tclose(dtr_id);
    status = H5Tclose(dti_id);
    free(real_part);
    free(imag_part);
    mu_assert("Read complex dataset.",
        		AH5_read_cpx_dataset(file_id,"dataset_name", 2, &rdata));

    for (i = 0; i < 2; i++)
    {
      	printf("Real parts : %f %f\n", cplx[i].re, rdata[i].re);
       	printf("Imaginary parts : %f %f\n", cplx[i].im, rdata[i].im);
       	mu_assert_equal("Check the real values.", cplx[i].re, rdata[i].re);
       	mu_assert_equal("Check the imaginary value.", cplx[i].im, rdata[i].im);
    }

    return MU_FINISHED_WITHOUT_ERRORS;
}
开发者ID:ThinkManhattan,项目名称:amelet-hdf,代码行数:57,代码来源:dataset.c


示例14: print_sizes

void print_sizes( const char *obj1,
                  const char *obj2,
                  hid_t f_tid1,
                  hid_t f_tid2,
                  hid_t m_tid1,
                  hid_t m_tid2 )
{
    size_t  f_size1, f_size2;       /* size of type in file */
    size_t  m_size1, m_size2;       /* size of type in memory */

    f_size1 = H5Tget_size( f_tid1 );
    f_size2 = H5Tget_size( f_tid2 );
    m_size1 = H5Tget_size( m_tid1 );
    m_size2 = H5Tget_size( m_tid2 );

    parallel_print("\n");
    parallel_print("------------------\n");
    parallel_print("sizeof(char)   %u\n", sizeof(char) );
    parallel_print("sizeof(short)  %u\n", sizeof(short) );
    parallel_print("sizeof(int)    %u\n", sizeof(int) );
    parallel_print("sizeof(long)   %u\n", sizeof(long) );
    parallel_print("<%s> ------------------\n", obj1);
    parallel_print("type on file   ");
    print_type(f_tid1);
    parallel_print("\n");
    parallel_print("size on file   %u\n", f_size1 );

    parallel_print("type on memory ");
    print_type(m_tid1);
    parallel_print("\n");
    parallel_print("size on memory %u\n", m_size1 );

    parallel_print("<%s> ------------------\n", obj2);
    parallel_print("type on file   ");
    print_type(f_tid2);
    parallel_print("\n");
    parallel_print("size on file   %u\n", f_size2 );

    parallel_print("type on memory ");
    print_type(m_tid2);
    parallel_print("\n");
    parallel_print("size on memory %u\n", m_size2 );
    parallel_print("\n");
}
开发者ID:lsubigdata,项目名称:hdf5ssh,代码行数:44,代码来源:h5diff_dset.c


示例15: H5Tget_sign

DataType ImageBase::datatypeH5(hid_t h5datatype)
{
    H5T_sign_t h5sign = H5Tget_sign(h5datatype);

    //    if (h5sign == H5T_SGN_ERROR)
    //        REPORT_ERROR(ERR_IO, "datatypeHDF5: Integer sign error in dataset.");
    bool sign = (h5sign > H5T_SGN_NONE);
    size_t size = H5Tget_size(h5datatype);

    DataType dt;
    switch(H5Tget_class(h5datatype))
    {
    case H5T_FLOAT:
        {
            switch(size)
            {
            case 4:
                dt = DT_Float;
                break;
            case 8:
                dt = DT_Double;
                break;
            default:
                REPORT_ERROR(ERR_IO_SIZE, "datatypeHDF5: bad datatype size");
            }
        }
        break;
    case H5T_INTEGER:
        {
            switch(size)
            {
            case 1:
                dt = (sign)? DT_SChar : DT_UChar;
                break;
            case 2:
                dt = (sign)? DT_Short : DT_UShort;
                break;
            case 4:
                dt = (sign)? DT_Int : DT_UInt;
                break;
            case 8:
                dt = (sign)? DT_Long : DT_ULong;
                break;
            default:
                REPORT_ERROR(ERR_IO_SIZE, "datatypeHDF5: bad datatype size");
            }
        }
        break;
    case H5T_NO_CLASS:
    default:
        dt = DT_Unknown;
        break;
    }
    return dt;
}
开发者ID:I2PC,项目名称:scipion,代码行数:55,代码来源:rwHDF5.cpp


示例16: getSize

        size_t getSize() const
        {
            size_t myElements = H5Tget_size(this->type);

            /* for variable length string the size is first known after reading
             * the actual data or attribute, so we forward HDF5's behaviour */
            if( H5Tis_variable_str(this->type) )
               return myElements; /* == sizeof(char*) see H5Tget_size description */
            else
               return sizeof(char) * (myElements - 1); /* just as strlen() */
        }
开发者ID:Flamefire,项目名称:libSplash,代码行数:11,代码来源:ColTypeString.hpp


示例17: H5Tget_size

size_t hdf5_datatype::get_size() const
{
    size_t size = H5Tget_size(get_id());
    if(!size) {
        boost::serialization::throw_exception(
            hdf5_archive_exception(
                hdf5_archive_exception::hdf5_archive_datatype_access_error
            )
        );
    }
    return size;
}
开发者ID:christoph-weinrich,项目名称:serialization,代码行数:12,代码来源:hdf5_datatype.cpp


示例18: get_attribute_str

static herr_t get_attribute_str(hid_t obj_id,
                                const char *attr_name,
                                char **data)
{
    hid_t attr_id;
    hid_t attr_type;
    size_t type_size;
    herr_t status;

    *data = NULL;

    attr_id = H5Aopen_name(obj_id, attr_name);
    if (attr_id < 0)
        return -1;

    attr_type = H5Aget_type(attr_id);
    if (attr_type < 0)
        goto out;

    /* Get the size */
    type_size = H5Tget_size(attr_type);
    if (type_size < 0)
        goto out;

    /* malloc enough space for the string, plus 1 for trailing '\0' */
    *data = (char *)malloc(type_size + 1);

    status = H5Aread(attr_id, attr_type, *data);
    if (status < 0)
        goto out;

    /* Set the last character to '\0' in case we are dealing with
     * null padded or space padded strings
     */
    (*data)[type_size] = '\0';

    status = H5Tclose(attr_type);
    if (status < 0)
        goto out;

    status = H5Aclose(attr_id);
    if (status < 0)
        return -1;

    return 0;

out:
    H5Tclose(attr_type);
    H5Aclose(attr_id);
    if (*data)
        free(*data);
    return -1;
}
开发者ID:QuLogic,项目名称:citcoms,代码行数:53,代码来源:Citcoms_Hdf2Vtk.c


示例19: throw

    size_t DCDataSet::getDataTypeSize()
    throw (DCException)
    {
        if (!opened)
            throw DCException(getExceptionString("getDataTypeSize: dataset is not opened"));

        size_t size = H5Tget_size(this->datatype);
        if (size == 0)
            throw DCException(getExceptionString("getDataTypeSize: could not get size of datatype"));

        return size;
    }
开发者ID:c-schumann-zih,项目名称:libSplash,代码行数:12,代码来源:DCDataSet.cpp


示例20: get_attribute_info

static herr_t get_attribute_info(hid_t obj_id,
                                 const char *attr_name,
                                 hsize_t *dims,
                                 H5T_class_t *type_class,
                                 size_t *type_size,
                                 hid_t *type_id)
{
    hid_t attr_id;
    hid_t space_id;
    herr_t status;
    int rank;

    /* Open the attribute. */
    attr_id = H5Aopen_name(obj_id, attr_name);
    if (attr_id < 0)
        return -1;

    /* Get an identifier for the datatype. */
    *type_id = H5Aget_type(attr_id);

    /* Get the class. */
    *type_class = H5Tget_class(*type_id);

    /* Get the size. */
    *type_size = H5Tget_size(*type_id);

    /* Get the dataspace handle */
    space_id = H5Aget_space(attr_id);
    if (space_id < 0)
        goto out;

    /* Get dimensions */
    rank = H5Sget_simple_extent_dims(space_id, dims, NULL);
    if (rank < 0)
        goto out;

    /* Terminate access to the dataspace */
    status = H5Sclose(space_id);
    if (status < 0)
        goto out;

    /* End access to the attribute */
    status = H5Aclose(attr_id);
    if (status < 0)
        goto out;

    return 0;
out:
    H5Tclose(*type_id);
    H5Aclose(attr_id);
    return -1;
}
开发者ID:QuLogic,项目名称:citcoms,代码行数:52,代码来源:Citcoms_Hdf2Vtk.c



注:本文中的H5Tget_size函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ H5Tinsert函数代码示例发布时间:2022-05-30
下一篇:
C++ H5Tget_class函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap