您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ HDfree函数代码示例

51自学网 2021-06-01 21:22:49
  C++
这篇教程C++ HDfree函数代码示例写得很实用,希望能帮到您。

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

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

示例1: h5dread_vl_real_c

int_fh5dread_vl_real_c ( hid_t_f *dset_id ,  hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, real_f *buf, hsize_t_f *dims, size_t_f *len)/******/{  int ret_value = -1;  hid_t c_dset_id;  hid_t c_mem_type_id;  hid_t c_mem_space_id;  hid_t c_file_space_id;  hid_t c_xfer_prp;  herr_t status;  size_t max_len;  hvl_t *c_buf;  hsize_t i;  hssize_t num_elem;  c_dset_id       = (hid_t)*dset_id;  c_mem_type_id   = (hid_t)*mem_type_id;  c_mem_space_id  = (hid_t)*mem_space_id;  c_file_space_id = (hid_t)*file_space_id;  c_xfer_prp      = (hid_t)*xfer_prp;  max_len = (size_t)dims[0];  num_elem = H5Sget_select_npoints(c_mem_space_id);  if(num_elem != (hssize_t)dims[1]) return ret_value;  c_buf = (hvl_t *)HDmalloc((size_t)num_elem * sizeof(hvl_t));  if (c_buf == NULL) return ret_value;  /*   * Call H5Dread function.   */   status = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, c_buf); if ( status <0  )  goto DONE;  for (i=0; i < (hsize_t)num_elem; i++) {       len[i] = (size_t_f)c_buf[i].len;       memcpy(&buf[i*max_len], c_buf[i].p, c_buf[i].len*sizeof(real_f));  }  H5Dvlen_reclaim(c_mem_type_id, c_mem_space_id, H5P_DEFAULT, c_buf);  ret_value = 0;DONE:  HDfree(c_buf);  return ret_value;}
开发者ID:ElaraFX,项目名称:hdf5,代码行数:45,


示例2: named_datatype_free

/*------------------------------------------------------------------------- * Function: named_datatype_free * * Purpose: Frees the stack of named datatypes. *------------------------------------------------------------------------- */int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) {    named_dt_t *dt = *named_dt_head_p;    int         ret_value = -1;    while (dt) {        /* Pop the datatype off the stack and free it */        if (H5Tclose(dt->id_out) < 0 && !ignore_err)            HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");        dt = dt->next;        HDfree(*named_dt_head_p);        *named_dt_head_p = dt;    } /* end while */    ret_value = 0;done:    return (ret_value);} /* end named_datatype_free */
开发者ID:ngcurrier,项目名称:ProteusCFD,代码行数:24,


示例3: test_vlstr_free_custom

/********************************************************************  test_vlstr_free_custom(): Test VL datatype custom memory**      allocation routines.  This routine just uses free to**      release the memory and decrements the amount of memory**      allocated.******************************************************************/void test_vlstr_free_custom(void *_mem, void *info){    unsigned char *mem;    size_t *mem_used=(size_t *)info;  /* Get the pointer to the memory used */    size_t extra;               /* Extra space needed */    /*     *  This weird contortion is required on the DEC Alpha to keep the     *  alignment correct - QAK     */    extra=MAX(sizeof(void *),sizeof(size_t));    if(_mem!=NULL) {        mem=((unsigned char *)_mem)-extra;        *mem_used-=*(size_t *)mem;        HDfree(mem);    } /* end if */}
开发者ID:ElaraFX,项目名称:hdf5,代码行数:26,


示例4: PIN_JAVA_STRING

/* * Class:     hdf_hdf5lib_H5 * Method:    H5Oget_comment_by_name * Signature: (JLjava/lang/String;J)Ljava/lang/String; */JNIEXPORT jstring JNICALLJava_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name    (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id){    char       *oComment;    const char *oName;    ssize_t     buf_size;    ssize_t     status;    jstring     str = NULL;    PIN_JAVA_STRING(name, oName);    if (oName != NULL) {        /* get the length of the comment */        buf_size = H5Oget_comment_by_name((hid_t)loc_id, oName, NULL, 0, (hid_t)access_id);        if (buf_size < 0) {            h5badArgument( env, "H5Oget_comment_by_name:  buf_size < 0");        } /* end if */        else if (buf_size > 0) {            buf_size++; /* add extra space for the null terminator */            oComment = (char *)HDmalloc(sizeof(char) * (size_t)buf_size);            if (oComment == NULL) {                h5outOfMemory( env, "H5Oget_comment_by_name:  malloc failed");            } /* end if */            else {                status = H5Oget_comment_by_name((hid_t)loc_id, oName, oComment, (size_t)buf_size, (hid_t)access_id);                if (status < 0) {                    h5libraryError(env);                } /* end if */                else {                    /*  may throw OutOfMemoryError */                    str = ENVPTR->NewStringUTF(ENVPAR oComment);                    if (str == NULL) {                        h5JNIFatalError( env, "H5Oget_comment_by_name:  return string not allocated");                    } /* end if */                } /* end else */                HDfree(oComment);            }        } /* end if */        UNPIN_JAVA_STRING(name, oName);    }    return (jstring)str;} /* end Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name */
开发者ID:ngcurrier,项目名称:ProteusCFD,代码行数:49,


示例5: h5dread_ref_reg_c

/****if* H5Df/h5dread_ref_reg_c * NAME *  h5dread_ref_reg_c * PURPOSE *  Call H5Dread to read a dataset of dataset region references * INPUTS *  dset_id - dataset identifier *  mem_type_id - memory datatype identifier *  mem_space_id - memory dataspace identifier *  file_space_id - memory dataspace identifier *  xfer_pr  - identifier of transfer property list *  buf      - data buffer to store references to the objects. *  n - number of references to be stored. * RETURNS *  0 on success, -1 on failure * AUTHOR *  Elena Pourmal *  Wednesday, May 15, 2002 * HISTORY *  This function was added to accomodate h5dread_f subroutine *  with the dims parameter being of INTEGER(HSIZE_T_F) size. * SOURCE*/int_fh5dread_ref_reg_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f * buf, hsize_t_f *dims)/******/{     int ret_value = -1;     herr_t ret = -1;     hid_t c_dset_id;     hid_t c_mem_type_id;     hid_t c_mem_space_id;     hid_t c_file_space_id;     hid_t c_xfer_prp;     hdset_reg_ref_t *buf_c = NULL;     hsize_t i, n;     n = (hsize_t)*dims;     /*      * Define transfer property      */     c_xfer_prp = (hid_t)*xfer_prp;     /*      * Allocate temporary buffer.      */     buf_c = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t)*(size_t)n);     if ( buf_c != NULL ) {         /*          * Call H5Dread function.          */         c_dset_id = (hid_t)*dset_id;         c_mem_type_id = (hid_t)*mem_type_id;         c_mem_space_id = (hid_t)*mem_space_id;         c_file_space_id = (hid_t)*file_space_id;         ret = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, buf_c);         if (ret >=0) {            for (i = 0; i < n; i++) {               HDmemcpy(buf, &buf_c[i], H5R_DSET_REG_REF_BUF_SIZE);               buf = buf + REF_REG_BUF_LEN_F;            }         }         if ( buf_c != NULL ) HDfree(buf_c);     }     if (ret < 0) return ret_value;     ret_value = 0;     return ret_value;}
开发者ID:ElaraFX,项目名称:hdf5,代码行数:67,


示例6: getR8

intgetR8(int xdim, int ydim, char *image, char *pal, int compress){    FILE       *fp;    int32       length;    char       *buf;    if (!fileOpen())      {          noFile();          return FAIL;      }    if (pal)        if (setPal(pal) < 0)            /* Error already signalled by setPal */            return FAIL;    length = xdim * ydim;    buf = (char *) HDmalloc(length);    if ((fp = fopen(image, "r")) == NULL)      {          fprintf(stderr, "Error opening image file: %s./n", image);          return FAIL;      }    if (fread(buf, (size_t)xdim, (size_t)ydim, fp) < (size_t)ydim)      {          fprintf(stderr, "Error reading image file: %s./n", image);          return FAIL;      }    fclose(fp);    if (DFR8addimage(he_file, buf, (int32) xdim, (int32) ydim, (uint16) compress) < 0)      {          HEprint(stderr, 0);          return FAIL;      }    HDfree(buf);    if (updateDesc() < 0)        return FAIL;    return HE_OK;}
开发者ID:schwehr,项目名称:hdf4,代码行数:44,


示例7: nh5fopen_c

/****if* H5Ff/h5fopen_c * NAME *        h5fopen_c * PURPOSE *     Call H5Fopen to open the file * INPUTS *      name - name of the file *              namelen - name length *              access_flags - file access  flags *              acc_prp - identifier of access property list * OUTPUTS *     file_id - file identifier * RETURNS *     0 on success, -1 on failure * AUTHOR *  Elena Pourmal *              Tuesday, August 3, 1999 * SOURCE*/int_fnh5fopen_c (_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *acc_prp, hid_t_f *file_id)/******/{     int ret_value = -1;     char *c_name;     int_f c_namelen;     hid_t c_file_id;     unsigned c_access_flags;     hid_t c_acc_prp;     c_acc_prp = (hid_t)*acc_prp;     /*      * Define access flags      */     c_access_flags = (unsigned) *access_flags;     /*      * Define access property      */     c_acc_prp = *acc_prp;     /*      * Convert FORTRAN name to C name      */     c_namelen = *namelen;     c_name = (char *)HD5f2cstring(name, (size_t)c_namelen);     if(c_name == NULL)         return ret_value;     /*      * Call H5Fopen function.      */     c_file_id = H5Fopen(c_name, c_access_flags, c_acc_prp);     if(c_file_id >= 0) {         ret_value = 0;         *file_id = (hid_t_f)c_file_id;     } /* end if */     HDfree(c_name);     return ret_value;}
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:62,


示例8: initFile

intinitFile(char *file){    if (he_file)        HDfree(he_file);    he_file = copyStr(file);    if (updateDesc() < 0)        return FAIL;    /* if there are groups in this file, go to the first group tag */    /* otherwise, just go to the first element */    if (he_numGrp > 0)        he_currDesc = he_grp[0].desc;    else        he_currDesc = 0;    return resetPred();}
开发者ID:schwehr,项目名称:hdf4,代码行数:19,


示例9: nh5sget_select_elem_pointlist_c

int_fnh5sget_select_elem_pointlist_c( hid_t_f *space_id ,hsize_t_f * startpoint,                                  hsize_t_f * numpoints, hsize_t_f * buf){  int ret_value = -1;  hid_t c_space_id;  hsize_t c_num_points;  hsize_t c_startpoint,* c_buf;  hsize_t i, i1;  int rank;  int j,i2;  c_space_id = *space_id;  c_num_points = (hsize_t)* numpoints;  rank = H5Sget_simple_extent_ndims(c_space_id);  if (rank < 0 ) return ret_value;  c_startpoint = (hsize_t)*startpoint;  c_buf = (hsize_t*)malloc(sizeof(hsize_t)*(size_t)(c_num_points*rank));  if (!c_buf) return ret_value;  ret_value = H5Sget_select_elem_pointlist(c_space_id, c_startpoint,                                            c_num_points, c_buf);  /* re-arrange the return buffer to account for Fortran ordering of 2D arrays */  /* and add 1 to account for array's starting at one in Fortran */  i2 = 0;  for( i = 0; i < c_num_points; i++) {    i1 =  rank*(i+1);    for(j = 0; j < rank; j++) {      buf[i2] = (hsize_t_f)(c_buf[i1-1]+1);      i2 = i2 + 1;      i1 = i1 - 1;    }  }  if (ret_value  >= 0  ) ret_value = 0;  HDfree(c_buf);  return ret_value;}
开发者ID:MattNapsAlot,项目名称:rHDF5,代码行数:42,


示例10: DFclose

/*   ** NAME   **   DFclose -- close HDF file   ** USAGE   **   int DFclose(dfile)   **   DF *dfile;              IN: pointer to an open DF file   ** RETURNS   **   0 on success, -1 on failure with DFerror set   ** DESCRIPTION   **   Write out updated DDs; close DF file.   ** GLOBAL VARIABLES   ** COMMENTS, BUGS, ASSUMPTIONS   ** EXAMPLES   ** REVISION LOG */intDFclose(DF * dfile){    int         ret;    if (DFIcheck(dfile) != 0)      {          DFerror = DFE_NOTOPEN;          return (FAIL);      }    else        DFerror = DFE_NONE;    if (DFelstat == DFEL_RESIDENT)      {          Hputelement(DFid, acc_tag, acc_ref, (unsigned char *) DFelement, DFelsize);          HDfree(DFelement);      }    else        Hendaccess(DFaid);    if (search_stat == DFSRCH_OLD)      {          Hendaccess(search_aid);          search_aid = 0;      }    ret = Hclose(DFid);    if (ret == 0)      {          dfile = 0;          DFlist = (DF *) NULL;          DFid = 0;          DFaccmode = 0;      }    else      {          DFerror = (int)HEvalue(1);      }    return (ret);}
开发者ID:Higginbottom,项目名称:zeus_python,代码行数:57,


示例11: HCIcszip_init

/*-------------------------------------------------------------------------- NAME    HCIcszip_init -- Initialize a SZIP compressed data element. USAGE    int32 HCIcszip_init(access_rec)    accrec_t *access_rec;   IN: the access record of the data element RETURNS    Returns SUCCEED or FAIL DESCRIPTION    Common code called by HCIcszip_staccess and HCIcszip_seek GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG--------------------------------------------------------------------------*/PRIVATE int32HCIcszip_init(accrec_t * access_rec){    CONSTR(FUNC, "HCIcszip_init");    compinfo_t *info;           /* special element information */    comp_coder_szip_info_t *szip_info;    /* ptr to SZIP info */    intn       ret_value = SUCCEED;#ifdef H4_HAVE_LIBSZ    /* Sanity check to make certain that we haven't drifted out of date with     * the mask options from the SZIP ricehdf.h header */    assert(H4_SZ_ALLOW_K13_OPTION_MASK==SZ_ALLOW_K13_OPTION_MASK);    assert(H4_SZ_CHIP_OPTION_MASK==SZ_CHIP_OPTION_MASK);    assert(H4_SZ_EC_OPTION_MASK==SZ_EC_OPTION_MASK);    assert(H4_SZ_LSB_OPTION_MASK==SZ_LSB_OPTION_MASK);    assert(H4_SZ_MSB_OPTION_MASK==SZ_MSB_OPTION_MASK);    assert(H4_SZ_NN_OPTION_MASK==SZ_NN_OPTION_MASK);    assert(H4_SZ_RAW_OPTION_MASK==SZ_RAW_OPTION_MASK);#endif    info = (compinfo_t *) access_rec->special_info;    if (Hseek(info->aid, 0, DF_START) == FAIL)  /* seek to beginning of element */        HGOTO_ERROR(DFE_SEEKERROR, FAIL);    szip_info = &(info->cinfo.coder_info.szip_info);    /* Initialize SZIP state information */    szip_info->szip_state = SZIP_INIT;     /* start in initial state */    if (szip_info->buffer_size != 0) {        szip_info->buffer_size = 0;   /* offset into the file */        if (szip_info->buffer != NULL) {		HDfree(szip_info->buffer);		szip_info->buffer = NULL;        }    }    szip_info->offset = 0;   /* offset into the file */    szip_info->szip_dirty=SZIP_CLEAN;done:    return(ret_value);}   /* end HCIcszip_init() */
开发者ID:Higginbottom,项目名称:zeus_python,代码行数:60,


示例12: UNUSED

/* * Class:     hdf_hdf5lib_H5 * Method:    H5Oget_comment_by_name * Signature: (JLjava/lang/String;J)Ljava/lang/String; */JNIEXPORT jstring JNICALLJava_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name    (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id){    const char *objName = NULL;    jstring     str = NULL;    ssize_t     buf_size;    ssize_t     status;    char       *objComment = NULL;    UNUSED(clss);    if (NULL == name)        H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oget_comment_by_name: object name is NULL");    PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oget_comment_by_name: object name not pinned");    /* Get the length of the comment */    if ((buf_size = H5Oget_comment_by_name((hid_t)loc_id, objName, NULL, 0, (hid_t)access_id)) < 0)        H5_LIBRARY_ERROR(ENVONLY);    if (buf_size) {        if (NULL == (objComment = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))            H5_JNI_FATAL_ERROR(ENVONLY, "H5Oget_comment_by_name: failed to allocate buffer for object comment");        if ((status = H5Oget_comment_by_name((hid_t)loc_id, objName, objComment, (size_t)buf_size + 1, (hid_t)access_id)) < 0)            H5_LIBRARY_ERROR(ENVONLY);        objComment[buf_size] = '/0';        if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, objComment)))            CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);    }done:    if (objComment)        HDfree(objComment);    if (objName)        UNPIN_JAVA_STRING(ENVONLY, name, objName);    return (jstring)str;} /* end Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name */
开发者ID:soumagne,项目名称:hdf5,代码行数:46,


示例13: symlink_visit_add

/*------------------------------------------------------------------------- * Function: symlink_visit_add * * Purpose: Add an symbolic link to visited data structure * * Return: 0 on success, -1 on failure * * Programmer: Neil Fortner, [email
C++ HDmalloc函数代码示例
C++ HDfprintf函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。