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

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

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

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

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

示例1: luaC_h5_open_group

int luaC_h5_open_group(lua_State *L){  const char *gname = luaL_checkstring(L, 1);  const char *mode  = luaL_checkstring(L, 2);  hid_t grp = 0;  if (PresentFile < 0) {    luaL_error(L, "need an open file to open group/n");  }  else if (strcmp(mode, "w") == 0) {    if (H5Lexists(PresentFile, gname, H5P_DEFAULT)) {      H5Ldelete(PresentFile, gname, H5P_DEFAULT);    }    grp = H5Gcreate(PresentFile, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);  }  else if (strcmp(mode, "r+") == 0) {    if (H5Lexists(PresentFile, gname, H5P_DEFAULT)) {      grp = H5Gopen(PresentFile, gname, H5P_DEFAULT);    }    else {      grp = H5Gcreate(PresentFile, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);    }  }  else {    luaL_error(L, "invalid group access mode '%s'/n", mode);  }  lua_pushnumber(L, grp);  return 1;}
开发者ID:jzrake,项目名称:luview,代码行数:31,


示例2: cxi_open_data

CXI_Data * cxi_open_data(CXI_Data_Reference * ref){  cxi_debug("opening data");  char buffer[1024];  if(!ref){    return NULL;  }  CXI_Data * data = calloc(sizeof(CXI_Data),1);  if(!data){    return NULL;  }  data->handle = H5Gopen(ref->parent_handle,ref->group_name,H5P_DEFAULT);  if(data->handle < 0){    free(data);    return NULL;  }  ref->data = data;    if(H5Lexists(data->handle,"data",H5P_DEFAULT)){    data->data = calloc(sizeof(CXI_Dataset_Reference),1);    data->data->parent_handle = data->handle;    data->data->group_name = malloc(sizeof(char)*(strlen(buffer)+1));    strcpy(data->data->group_name,"data");            }  if(H5Lexists(data->handle,"errors",H5P_DEFAULT)){    data->errors = calloc(sizeof(CXI_Dataset_Reference),1);    data->errors->parent_handle = data->handle;    data->errors->group_name = malloc(sizeof(char)*(strlen(buffer)+1));    strcpy(data->errors->group_name,"errors");            }  return data;}
开发者ID:cxidb,项目名称:libcxi,代码行数:32,


示例3: read_nvnunrnl

/** read solution sizes */static int read_nvnunrnl (hid_t file_id, int *nv, int *nr, int *nl){  if (H5Lexists (file_id, "/fclib_global", H5P_DEFAULT))  {    IO (H5LTread_dataset_int (file_id, "/fclib_global/M/n", nv));    IO (H5LTread_dataset_int (file_id, "/fclib_global/H/n", nr));    if (H5Lexists (file_id, "/fclib_global/G", H5P_DEFAULT))    {      IO (H5LTread_dataset_int (file_id, "/fclib_global/G/n", nl));    }    else *nl = 0;  }  else if (H5Lexists (file_id, "/fclib_local", H5P_DEFAULT))  {    *nv = 0;    IO (H5LTread_dataset_int (file_id, "/fclib_local/W/n", nr));    if (H5Lexists (file_id, "/fclib_local/R", H5P_DEFAULT))    {      IO (H5LTread_dataset_int (file_id, "/fclib_local/R/n", nl));    }    else *nl = 0;  }  else  {    fprintf (stderr, "ERROR: neither global nor local problem has been stored. Global or local have to be stored before solutions or guesses/n");    return 0;  }  return 1;}
开发者ID:xhub,项目名称:fclib,代码行数:31,


示例4: cxi_open_image

CXI_Image * cxi_open_image(CXI_Image_Reference * ref){  cxi_debug("opening image");  char buffer[1024];  if(!ref){    return NULL;  }  CXI_Image * image = calloc(sizeof(CXI_Image),1);  if(!image){    return NULL;  }  image->handle = H5Gopen(ref->parent_handle,ref->group_name,H5P_DEFAULT);  if(image->handle < 0){    free(image);    return NULL;  }  /* Search for Detector groups */  int n = find_max_suffix(image->handle, "detector");  image->detector_count = n;  image->detectors = calloc(sizeof(CXI_Detector_Reference *),n);  for(int i = 0;i<n;i++){    image->detectors[i] = calloc(sizeof(CXI_Detector_Reference),1);    sprintf(buffer,"detector_%d",i+1);    image->detectors[i]->parent_handle = image->handle;    image->detectors[i]->group_name = malloc(sizeof(char)*(strlen(buffer)+1));    strcpy(image->detectors[i]->group_name,buffer);        }  ref->image = image;    if(H5Lexists(image->handle,"data",H5P_DEFAULT)){    image->data = calloc(sizeof(CXI_Dataset_Reference),1);    image->data->parent_handle = image->handle;    image->data->group_name = malloc(sizeof(char)*(strlen(buffer)+1));    strcpy(image->data->group_name,"data");            }  if(H5Lexists(image->handle,"data_error",H5P_DEFAULT)){    image->data_error = calloc(sizeof(CXI_Dataset_Reference),1);    image->data_error->parent_handle = image->handle;    image->data_error->group_name = malloc(sizeof(char)*(strlen(buffer)+1));    strcpy(image->data_error->group_name,"data_error");            }  if(H5Lexists(image->handle,"mask",H5P_DEFAULT)){    image->mask = calloc(sizeof(CXI_Dataset_Reference),1);    image->mask->parent_handle = image->handle;    image->mask->group_name = malloc(sizeof(char)*(strlen(buffer)+1));    strcpy(image->mask->group_name,"mask");            }  //  try_read_string(image->handle, "data_space",&image->data_space);  //  try_read_string(image->handle, "data_type",&image->data_type);  image->dimensionality_valid = try_read_int(image->handle, "dimensionality",&image->dimensionality);  image->image_center_valid = try_read_float_array(image->handle, "image_center",image->image_center,3);  return image;}
开发者ID:cxidb,项目名称:libcxi,代码行数:60,


示例5: H5Eset_auto2

/**   Traverse the path of an object in HDF5 file, checking existence of   groups in the path and creating them if required.  */hid_t HDF5DataWriter::getDataset(string path){    if (filehandle_ < 0){        return -1;    }    herr_t status = H5Eset_auto2(H5E_DEFAULT, NULL, NULL);    // Create the groups corresponding to this path    string::size_type lastslash = path.find_last_of("/");    vector<string> pathTokens;    moose::tokenize(path, "/", pathTokens);    hid_t prev_id = filehandle_;    hid_t id = -1;    for ( unsigned int ii = 0; ii < pathTokens.size()-1; ++ii ){        // check if object exists        htri_t exists = H5Lexists(prev_id, pathTokens[ii].c_str(),                                  H5P_DEFAULT);        if (exists > 0){            // try to open existing group            id = H5Gopen2(prev_id, pathTokens[ii].c_str(), H5P_DEFAULT);        } else if (exists == 0) {            // If that fails, try to create a group            id = H5Gcreate2(prev_id, pathTokens[ii].c_str(),                            H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);        }        if ((exists < 0) || (id < 0)){            // Failed to open/create a group, print the            // offending path (for debugging; the error is            // perhaps at the level of hdf5 or file system).            cerr << "Error: failed to open/create group: ";            for (unsigned int jj = 0; jj <= ii; ++jj){                cerr << "/" << pathTokens[jj];            }            cerr << endl;            prev_id = -1;        }        if (prev_id >= 0  && prev_id != filehandle_){            // Successfully opened/created new group, close the old group            status = H5Gclose(prev_id);            assert( status >= 0 );        }        prev_id = id;    }    string name = pathTokens[pathTokens.size()-1];    htri_t exists = H5Lexists(prev_id, name.c_str(), H5P_DEFAULT);    hid_t dataset_id = -1;    if (exists > 0){        dataset_id = H5Dopen2(prev_id, name.c_str(), H5P_DEFAULT);    } else if (exists == 0){        dataset_id = createDoubleDataset(prev_id, name);    } else {        cerr << "Error: H5Lexists returned "             << exists << " for path /""             << path << "/"" << endl;    }    return dataset_id;}
开发者ID:hrani,项目名称:moose-core,代码行数:59,


示例6: regn_writes_all

int regn_writes_all() {  OPEN_WRITE_TEST_FILE;  int **regions = fixture_regions(5);    int result = (ch5m_regn_set_all(file, 5, regions[0]) == 0);    htri_t exists = H5Lexists(file, CH5_REGN_GROUP_NAME, H5P_DEFAULT);  if (exists < 1) {    fprintf(stderr, "Could not find regions main group/n");    result = 0;  }    hid_t main_group_id = H5Gopen(file, CH5_REGN_GROUP_NAME, H5P_DEFAULT);  exists = H5Lexists(main_group_id, CH5_REGN_DSET_NAME, H5P_DEFAULT);  if (exists < 1) {    fprintf(stderr, "Could not find regions dataset/n");    result = 0;  }    hid_t dset_id = H5Dopen(main_group_id, CH5_REGN_DSET_NAME, H5P_DEFAULT);  if (dset_id < 0) {    fprintf(stderr, "Error opening regions dataset/n");    result = 0;  }    ch5_dataset dset_info;  result &= (ch5_gnrc_get_dset_info(file, CH5_REGN_DSET_FULL_PATH, &dset_info) == 0);  if ((dset_info.count != 5) || (dset_info.width != 2)) {    fprintf(stderr, "Regions dataset dimensions incorrect (%d,%d)/n",      dset_info.count, dset_info.width);    result = 0;  }    int read_regions[5 * 2];  herr_t status = H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,    H5P_DEFAULT, read_regions);  if (status < 0) {    fprintf(stderr, "Regions reading failed/n");    result = 0;  }    if (int_arrays_same(regions[0], read_regions, 5 * 2) == 0) {    fprintf(stderr, "Regions data incorrect/n");    result = 0;  }    H5Dclose(dset_id);  H5Gclose(main_group_id);  fixture_free_regions(regions);    CLOSE_WRITE_TEST_FILE;    return result;}
开发者ID:cardiosolv,项目名称:meshalyzer,代码行数:54,


示例7: fclib_read_local

/** read local problem; * return problem on success; NULL on failure */struct fclib_local* fclib_read_local (const char *path){  struct fclib_local *problem;  hid_t  file_id, main_id, id;  if ((file_id = H5Fopen (path, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)  {    fprintf (stderr, "ERROR: opening file failed/n");    return NULL;  }  if (!H5Lexists (file_id, "/fclib_local", H5P_DEFAULT))  {    fprintf (stderr, "ERROR: spurious input file %s :: fclib_local group does not exists", path);    return NULL;  }  MM (problem = calloc (1, sizeof (struct fclib_local)));  IO (main_id = H5Gopen (file_id, "/fclib_local", H5P_DEFAULT));  IO (H5LTread_dataset_int (file_id, "/fclib_local/spacedim", &problem->spacedim));  IO (id = H5Gopen (file_id, "/fclib_local/W", H5P_DEFAULT));  problem->W = read_matrix (id);  IO (H5Gclose (id));  if (H5Lexists (file_id, "/fclib_local/V", H5P_DEFAULT))  {    IO (id = H5Gopen (file_id, "/fclib_local/V", H5P_DEFAULT));    problem->V = read_matrix (id);    IO (H5Gclose (id));    IO (id = H5Gopen (file_id, "/fclib_local/R", H5P_DEFAULT));    problem->R = read_matrix (id);    IO (H5Gclose (id));  }  IO (id = H5Gopen (file_id, "/fclib_local/vectors", H5P_DEFAULT));  read_local_vectors (id, problem);  IO (H5Gclose (id));  if (H5Lexists (file_id, "/fclib_local/info", H5P_DEFAULT))  {    IO (id = H5Gopen (file_id, "/fclib_local/info", H5P_DEFAULT));    problem->info = read_problem_info (id);    IO (H5Gclose (id));  }  IO (H5Gclose (main_id));  IO (H5Fclose (file_id));  return problem;}
开发者ID:xhub,项目名称:fclib,代码行数:55,


示例8: AH5_path_valid

// Check for path validitychar AH5_path_valid(hid_t loc_id, const char *path){  char *temp;  int i, slashes = 0;  temp = strdup(path);  for (i = (int) strlen(path); i > 0; i--)  {    if (temp[i] == '/')    {      temp[i] = '/0';      slashes++;  /* count number of slashes excluding the first one */    }  }  if (strcmp(path, ".") == 0)  {    if (!H5Iis_valid(loc_id))    {      free(temp);      return AH5_FALSE;    }  }  else  {    if(H5Lexists(loc_id, temp, H5P_DEFAULT) != AH5_TRUE)    {      free(temp);      return AH5_FALSE;    }  }  i = 1;  while (slashes > 0)  {    while (temp[i] != '/0')      i++;    temp[i] = '/';    slashes--;    if(H5Lexists(loc_id, temp, H5P_DEFAULT) != AH5_TRUE)    {      free(temp);      return AH5_FALSE;    }  }  free(temp);  return AH5_TRUE;}
开发者ID:axessim,项目名称:amelethdf-c,代码行数:49,


示例9: checkExist

char HDocument::checkExist(const std::string & path){	if(!H5Lexists(fFileId, path.c_str(), H5P_DEFAULT))		return 0;			return 1;}
开发者ID:spinos,项目名称:aphid,代码行数:7,


示例10: H5Lexists_safe

int H5Lexists_safe(hid_t base, char *path)// -----------------------------------------------------------------------------// The HDF5 specification only allows H5Lexists to be called on an immediate// child of the current object. However, you may wish to see whether a whole// relative path exists, returning false if any of the intermediate links are// not present. This function does that.// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-Exists// -----------------------------------------------------------------------------{  hid_t last = base, next;  char *pch;  char pathc[2048];  strcpy(pathc, path);  pch = strtok(pathc, "/");  while (pch != NULL) {    int exists = H5Lexists(last, pch, H5P_DEFAULT);    if (!exists) {      if (last != base) H5Gclose(last);      return 0;    }    else {      next = H5Gopen(last, pch, H5P_DEFAULT);      if (last != base) H5Gclose(last);      last = next;    }    pch = strtok(NULL, "/");  }  if (last != base) H5Gclose(last);  return 1;}
开发者ID:geoffryan,项目名称:calvis,代码行数:30,


示例11: ObjectExists

//-*****************************************************************************bool ObjectExists( H5Node& iParent, const std::string &iName ){    ABCA_ASSERT( iParent.isValidObject(),                 "Invalid parent node passed into HDF5Util GroupExists: "                 << iName << std::endl );    HDF5Hierarchy* H5HPtr = iParent.getH5HPtr();    if ( H5HPtr )    {        return H5HPtr->childExists( iParent.getRef(), iName );    }    else    {        // First, check to make sure the link exists.        hid_t iParentObject = iParent.getObject();        htri_t exi = H5Lexists( iParentObject, iName.c_str(), H5P_DEFAULT );        if ( exi < 1 )        {            return false;        }        else        {            return true;        }    }}
开发者ID:AWhetter,项目名称:alembic,代码行数:29,


示例12: DatasetExists

//-*****************************************************************************bool DatasetExists( hid_t iParent, const std::string &iName ){    ABCA_ASSERT( iParent >= 0, "Invalid Parent in DatasetExists" );        // First, check to make sure the link exists.    htri_t exi = H5Lexists( iParent, iName.c_str(), H5P_DEFAULT );    if ( exi < 1 )    {        return false;    }        // Now make sure it is a group.    H5O_info_t oinfo;    herr_t status = H5Oget_info_by_name( iParent,                                         iName.c_str(), &oinfo,                                         H5P_DEFAULT );    if ( status < 0 )    {        return false;    }        if ( oinfo.type != H5O_TYPE_DATASET )    {        return false;    }    return true;}
开发者ID:ryutaro765,项目名称:Alembic,代码行数:29,


示例13: path_

hdf5_dataset::hdf5_dataset(    hdf5_file const& file,    std::string const& path)    :      path_(path){    // Check if name exists in this file.    htri_t status = H5Lexists(file.get_id(), path.c_str(), H5P_DEFAULT);    if(status > 0) { // Full path exists.        // Attempt to open it as a dataset        set_id(H5Dopen2(file.get_id(), path.c_str(), H5P_DEFAULT));        if(get_id() < 0) {            boost::serialization::throw_exception(                hdf5_archive_exception(                    hdf5_archive_exception::hdf5_archive_dataset_access_error,                    path.c_str()                )            );        }    }    else { // path does not exist, or other error        boost::serialization::throw_exception(            hdf5_archive_exception(                hdf5_archive_exception::hdf5_archive_bad_path_error,                path.c_str()            )        );    }}
开发者ID:warn-naught,项目名称:serialization,代码行数:30,


示例14: H5Object

H5Link::H5Link(H5Object & _parent, const std::string & _name) : H5Object(_parent, _name){    if (H5Lexists(_parent.getH5Id(), name.c_str(), H5P_DEFAULT) <= 0)    {        throw H5Exception(__LINE__, __FILE__, _("The link %s does not exist."), name.c_str());    }}
开发者ID:ZhanlinWang,项目名称:scilab,代码行数:7,


示例15: throw

    void DCDataSet::createReference(hid_t refGroup,            hid_t srcGroup,            DCDataSet &srcDataSet)    throw (DCException)    {        if (opened)            throw DCException(getExceptionString("createReference: dataset is already open"));        if (checkExistence && H5Lexists(refGroup, name.c_str(), H5P_LINK_ACCESS_DEFAULT))            throw DCException(getExceptionString("createReference: this reference already exists"));        getLogicalSize().set(srcDataSet.getLogicalSize());        this->ndims = srcDataSet.getNDims();        if (H5Rcreate(&regionRef, srcGroup, srcDataSet.getName().c_str(), H5R_OBJECT, -1) < 0)            throw DCException(getExceptionString("createReference: failed to create region reference"));        hsize_t ndims = 1;        dataspace = H5Screate_simple(1, &ndims, NULL);        if (dataspace < 0)            throw DCException(getExceptionString("createReference: failed to create dataspace for reference"));        dataset = H5Dcreate(refGroup, name.c_str(), H5T_STD_REF_OBJ,                dataspace, H5P_DEFAULT, dsetProperties, H5P_DEFAULT);        if (dataset < 0)            throw DCException(getExceptionString("createReference: failed to create dataset for reference"));        if (H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL,                dsetWriteProperties, &regionRef) < 0)            throw DCException(getExceptionString("createReference: failed to write reference"));        isReference = true;        opened = true;    }
开发者ID:c-schumann-zih,项目名称:libSplash,代码行数:35,


示例16: PetscViewerHDF5OpenGroup

PetscErrorCode PetscViewerHDF5OpenGroup(PetscViewer viewer, hid_t *fileId, hid_t *groupId){  hid_t          file_id, group;  const char     *groupName = NULL;  PetscErrorCode ierr;  PetscFunctionBegin;  ierr = PetscViewerHDF5GetFileId(viewer, &file_id);CHKERRQ(ierr);  ierr = PetscViewerHDF5GetGroup(viewer, &groupName);CHKERRQ(ierr);  /* Open group */  if (groupName) {    PetscBool root;    ierr = PetscStrcmp(groupName, "/", &root);CHKERRQ(ierr);    if (!root && !H5Lexists(file_id, groupName, H5P_DEFAULT)) {#if (H5_VERS_MAJOR * 10000 + H5_VERS_MINOR * 100 + H5_VERS_RELEASE >= 10800)      group = H5Gcreate2(file_id, groupName, 0, H5P_DEFAULT, H5P_DEFAULT);#else /* deprecated HDF5 1.6 API */      group = H5Gcreate(file_id, groupName, 0);#endif      if (group < 0) SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_LIB, "Could not create group %s", groupName);      ierr = H5Gclose(group);CHKERRQ(ierr);    }#if (H5_VERS_MAJOR * 10000 + H5_VERS_MINOR * 100 + H5_VERS_RELEASE >= 10800)    group = H5Gopen2(file_id, groupName, H5P_DEFAULT);#else    group = H5Gopen(file_id, groupName);#endif    if (group < 0) SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_LIB, "Could not open group %s", groupName);  } else group = file_id;  *fileId  = file_id;  *groupId = group;  PetscFunctionReturn(0);}
开发者ID:feelpp,项目名称:debian-petsc,代码行数:35,


示例17: fclib_read_global

/** read global problem; * return problem on success; NULL on failure */struct fclib_global* fclib_read_global (const char *path){  struct fclib_global *problem;  hid_t  file_id, main_id, id;  if ((file_id = H5Fopen (path, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)  {    fprintf (stderr, "ERROR: opening file failed/n");    return NULL;  }  MM (problem = calloc (1, sizeof (struct fclib_global)));  IO (main_id = H5Gopen (file_id, "/fclib_global", H5P_DEFAULT));  IO (H5LTread_dataset_int (file_id, "/fclib_global/spacedim", &problem->spacedim));  IO (id = H5Gopen (file_id, "/fclib_global/M", H5P_DEFAULT));  problem->M = read_matrix (id);  IO (H5Gclose (id));  IO (id = H5Gopen (file_id, "/fclib_global/H", H5P_DEFAULT));  problem->H = read_matrix (id);  IO (H5Gclose (id));  if (H5Lexists (file_id, "/fclib_global/G", H5P_DEFAULT))  {    IO (id = H5Gopen (file_id, "/fclib_global/G", H5P_DEFAULT));    problem->G = read_matrix (id);    IO (H5Gclose (id));  }  IO (id = H5Gopen (file_id, "/fclib_global/vectors", H5P_DEFAULT));  read_global_vectors (id, problem);  IO (H5Gclose (id));  if (H5Lexists (file_id, "/fclib_global/info", H5P_DEFAULT))  {    IO (id = H5Gopen (file_id, "/fclib_global/info", H5P_DEFAULT));    problem->info = read_problem_info (id);    IO (H5Gclose (id));  }  IO (H5Gclose (main_id));  IO (H5Fclose (file_id));  return problem;}
开发者ID:xhub,项目名称:fclib,代码行数:49,


示例18: handle

void hdf5file::touch_group(const std::string& name){	//std::cout << "touch: " << name << std::endl;	hid_t location_id = handle();	hid_t result = -1;	if(! H5Lexists(location_id, name.c_str(), H5P_DEFAULT))		result = H5Gcreate(location_id, name.c_str(), H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);	else		result = H5Gopen(location_id, name.c_str(), H5P_DEFAULT);	H5Gclose(result);}
开发者ID:klindworth,项目名称:cvwidgets,代码行数:11,


示例19: utils_hdf5_check_present

bool utils_hdf5_check_present(hid_t loc_id, const char *name){    htri_t bool_id;    if ((bool_id = H5Lexists(loc_id, name, H5P_DEFAULT)) < 0 || !bool_id)        return false;    if ((bool_id = H5Oexists_by_name(loc_id, name, H5P_DEFAULT)) < 0 || !bool_id)        return false;    return true;}
开发者ID:thomas-ruh,项目名称:libescdf,代码行数:11,


示例20: find_max_suffix

static int find_max_suffix(hid_t loc, char *basename){  int n;  for(n = 1;;n++){    char buffer[1024];    sprintf(buffer,"%s_%d",basename,n);    if(!H5Lexists(loc,buffer,H5P_DEFAULT)){      break;    }  }  return n-1;}
开发者ID:cxidb,项目名称:libcxi,代码行数:11,


示例21: H5Gmake

/** make grourp */static hid_t H5Gmake (hid_t loc_id, const char *name){  hid_t id;  if (H5Lexists (loc_id, name, H5P_DEFAULT))  {    id = H5Gopen (loc_id, name, H5P_DEFAULT);  }  else return H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);  return id;}
开发者ID:xhub,项目名称:fclib,代码行数:13,


示例22: assertSuccess

// Fields }}}// Informational {{{bool Location::exists(optional<LinkAccessProperties const&> const& optional_link_access_properties) const {    string const& name = *(this->name);    if(name == "." || name == "/") return true;    return        assertSuccess(            "ascertaining location existence",            H5Lexists(                getParentId(),                name.c_str(),                getOptionalPropertiesId(optional_link_access_properties)            )        ) == 1;}
开发者ID:gcross,项目名称:HDF,代码行数:15,


示例23: fast5_open

fast5_file fast5_open(const std::string& filename){    fast5_file fh;    fh.hdf5_file = H5Fopen(filename.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);    // Check for attribute that indicates whether it is single or multi-fast5    // see: https://community.nanoporetech.com/posts/multi-fast5-format    const std::string indicator_p1 = "/UniqueGlobalKey/";    const std::string indicator_p2 = indicator_p1 + "tracking_id/";    bool has_indicator = H5Lexists(fh.hdf5_file, indicator_p1.c_str(), H5P_DEFAULT) && H5Lexists(fh.hdf5_file, indicator_p2.c_str(), H5P_DEFAULT);    fh.is_multi_fast5 = !has_indicator;    return fh;}
开发者ID:jts,项目名称:nanopolish,代码行数:13,


示例24: createDatasetIdentifier

//------------------------------------------------------------------------------xdm::RefPtr< DatasetIdentifier > createDatasetIdentifier(  const DatasetParameters& parameters ) {    // check if the dataset already exists within the given parent  htri_t exists = H5Lexists(    parameters.parent,    parameters.name.c_str(),    H5P_DEFAULT );    if ( exists ) {    if ( parameters.mode == xdm::Dataset::kCreate ) {      // the dataset exists and a create was requested, delete the existing one      H5Ldelete( parameters.parent, parameters.name.c_str(), H5P_DEFAULT );    } else {      // read or modify access, open and return the existing dataset      return openExistingDataset( parameters );    }  }  // the dataset doesn't exist. Read only access is an error.  if ( parameters.mode == xdm::Dataset::kRead ) {    XDM_THROW( xdm::DatasetNotFound( parameters.name ) );  }  // Determine the dataset access properties based off chunking and compression  // parameters.  xdm::RefPtr< PListIdentifier > createPList( new PListIdentifier( H5P_DEFAULT ) );  if ( parameters.chunked ) {    createPList->reset( H5Pcreate( H5P_DATASET_CREATE ) );    setupChunks( createPList->get(), parameters.chunkSize, parameters.dataspace );    // Chunking is enabled, so check for compression and enable it if possible.    if ( parameters.compress ) {      setupCompression( createPList->get(), parameters.compressionLevel );    }  }  // the mode is create or modify. In both cases we want to create it if it  // doesn't yet exist. It is safe to create the dataset here because we deleted  // the dataset earlier if it existed.  hid_t datasetId = H5Dcreate(    parameters.parent,    parameters.name.c_str(),    parameters.type,    parameters.dataspace,    H5P_DEFAULT,    createPList->get(),    H5P_DEFAULT );  return xdm::RefPtr< DatasetIdentifier >( new DatasetIdentifier( datasetId ) );}
开发者ID:hpcdev,项目名称:xdm,代码行数:52,



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


C++ H5Pclose函数代码示例
C++ H5Gopen2函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。