本文整理汇总了C++中H5Dget_type函数的典型用法代码示例。如果您正苦于以下问题:C++ H5Dget_type函数的具体用法?C++ H5Dget_type怎么用?C++ H5Dget_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了H5Dget_type函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: getHDF5ClassID
/****************************************************************
**
** getHDF5ClassID(): Returns class ID for loc_id.name. -1 if error.
**
****************************************************************/
H5T_class_t getHDF5ClassID(hid_t loc_id,
const char *name,
H5D_layout_t *layout,
hid_t *type_id,
hid_t *dataset_id) {
H5T_class_t class_id;
hid_t plist;
/* Open the dataset. */
if ( (*dataset_id = H5Dopen( loc_id, name, H5P_DEFAULT )) < 0 )
return -1;
/* Get an identifier for the datatype. */
*type_id = H5Dget_type( *dataset_id );
/* Get the class. */
class_id = H5Tget_class( *type_id );
/* Get the layout of the datatype */
plist = H5Dget_create_plist(*dataset_id);
*layout = H5Pget_layout(plist);
H5Pclose(plist);
return class_id;
}
示例3: 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;
}
示例4: 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 );
}
示例5: H5Dataset_readPalette
void H5Dataset_readPalette(H5Dataset *d, hid_t did)
{
hid_t pal_id=-1, tid=-1;
hobj_ref_t *refs;
if (!d || did<=0 ) return;
refs = H5Dataset_get_paletteRef(did);
if (refs) {
// use the fist palette
pal_id = H5Rdereference(d->fid, H5R_OBJECT, refs);
tid = H5Dget_type(pal_id);
if (H5Dget_storage_size(pal_id) <= 768)
{
H5Attribute *attr;
d->nattributes = 1;
d->attributes = (H5Attribute*)malloc(sizeof(H5Attribute));
attr = &(d->attributes[0]);
H5Attribute_ctor(attr);
attr->value = (unsigned char *)malloc(3*256);
memset(attr->value, 0, 768);
attr->nvalue = 768;
attr->name = (char*)malloc(20);
strcpy(attr->name, PALETTE_VALUE);
H5Dread( pal_id, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, attr->value);
}
if (tid > 0) H5Tclose(tid);
if (pal_id > 0) H5Dclose(pal_id);
free(refs);
}
}
示例6: H5Dget_type
H5T_class_t HdfDataset::type() const
{
hid_t tid = H5Dget_type( d->id );
H5T_class_t t_class = H5Tget_class( tid );
H5Tclose( tid );
return t_class;
}
示例7: PYTABLE_write_records
/*+++++++++++++++++++++++++
.IDENTifer PYTABLE_write_records
.PURPOSE Write records to an HDF5 array
.INPUT/OUTPUT
call as stat = PYTABLE_write_records( locID, dset_name, start, step,
count, buffer );
input:
hid_t locID : HDF5 identifier of file or group
char *dset_name : name of dataset
hsize_t *start : index of first row to overwrite
hsize_t *step :
hsize_t *count : number of rows to write
void *buffer : data to write
.RETURNS A negative value is returned on failure.
.COMMENTS none
-------------------------*/
herr_t PYTABLE_write_records( hid_t locID, const char *dset_name,
hsize_t *start, hsize_t *step,
hsize_t *count, const void *buffer )
{
int rank;
hid_t dataID;
hid_t spaceID = -1;
hid_t mem_spaceID = -1;
hid_t typeID = -1;
/* open the dataset. */
if ( (dataID = H5Dopen( locID, dset_name, H5P_DEFAULT )) < 0 )
return -1;
/* get the dataspace handle */
if ( (spaceID = H5Dget_space( dataID )) < 0 )
goto done;
/* get rank */
if ( (rank = H5Sget_simple_extent_ndims( spaceID )) <= 0 )
goto done;
/* create a simple memory data space */
if ( (mem_spaceID = H5Screate_simple( rank, count, NULL )) < 0 )
goto done;
/* define a hyperslab in the dataset */
if ( H5Sselect_hyperslab( spaceID, H5S_SELECT_SET, start,
step, count, NULL ) < 0 )
goto done;
/* get an identifier for the datatype. */
if ( (typeID = H5Dget_type( dataID )) < 0 ) goto done;
/* write data to hyperslap */
if ( H5Dwrite( dataID, typeID, mem_spaceID, spaceID,
H5P_DEFAULT, buffer ) < 0 )
goto done;
/* terminate access to the datatype */
if ( H5Tclose( typeID ) < 0 ) goto done;
/* end access to the dataset */
if ( H5Dclose( dataID ) ) goto done;
/* terminate access to the dataspace */
if ( H5Sclose( mem_spaceID ) < 0 ) goto done;
if ( H5Sclose( spaceID ) < 0 ) goto done;
return 0;
done:
if ( typeID > 0 ) (void) H5Tclose( typeID );
if ( spaceID > 0 ) (void) H5Sclose( spaceID );
if ( mem_spaceID > 0 ) (void) H5Sclose( mem_spaceID );
if ( dataID > 0 ) (void) H5Dclose( dataID );
return -1;
}
示例8: VsObject
VsDataset::VsDataset(VsRegistry* r, VsObject* parentObject,
const std::string& datasetName, hid_t id):
VsObject(r, parentObject, datasetName, id) {
dataType = H5Tget_native_type(H5Dget_type(id), H5T_DIR_DEFAULT);
loadDims();
registry->add(this);
}
示例9: _hfile
hdf5dataset::hdf5dataset(hdf5file& hfile, const std::string& pname) : _hfile(hfile), _name(pname)
{
_dataset_id = H5Dopen(_hfile.handle(), _name.c_str(), H5P_DEFAULT);
if(_dataset_id < 0)
throw std::runtime_error("Failed to open dataset (" + _hfile.filename() + ") in file (" + _name + ")");
_type_id = H5Dget_type(_dataset_id);
_own_type_id = true;
}
示例10: AtomType
//--------------------------------------------------------------------------
// Function: IntType overloaded constructor
///\brief Gets the integer datatype of the specified dataset.
///\param dataset - IN: Dataset that this integer datatype associates with
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
IntType::IntType( const DataSet& dataset ) : AtomType()
{
// Calls C function H5Dget_type to get the id of the datatype
id = H5Dget_type( dataset.getId() );
if( id < 0 )
{
throw DataSetIException("IntType constructor", "H5Dget_type failed");
}
}
示例11: H5Dget_type
H5Type & H5Dataset::getDataType()
{
hid_t type = H5Dget_type(dataset);
if (type < 0)
{
throw H5Exception(__LINE__, __FILE__, _("Cannot get the dataspace associated with dataset named %s."), name.c_str());
}
return *new H5Type(*this, type);
}
示例12: validateDependsOn
/*--------------------------------------------------------------*/
static void validateDependsOn(pNXVcontext self, hid_t groupID,
hid_t fieldID)
{
char fname[512], dpData[1024];
hid_t h5type, dpfieldID;
H5T_class_t h5class;
memset(fname,0,sizeof(fname));
memset(dpData,0,sizeof(dpData));
H5Iget_name(fieldID,fname,sizeof(fname));
NXVsetLog(self,"dataPath",fname);
NXVsetLog(self,"sev","debug");
NXVprintLog(self,"message","Validating depends_on chain starting at %s",
fname);
NXVlog(self);
/*
test that the depends_on field is of the right type
*/
h5type = H5Dget_type(fieldID);
h5class = H5Tget_class(h5type);
H5Tclose(h5type);
if(h5class != H5T_STRING){
NXVsetLog(self,"sev","error");
NXVsetLog(self,"message",
"depends_on field is of wrong type, expect string");
NXVlog(self);
self->errCount++;
return;
}
/*
read the field
*/
H5LTread_dataset_string(groupID,"depends_on",dpData);
/*
find the field and start iterating through the chain
*/
dpfieldID = findDependentField(self,fieldID,dpData);
if(dpfieldID < 0){
NXVsetLog(self,"sev","error");
NXVprintLog(self,"message",
"Cannot even find the starting point of the depends_on chain, %s",
dpData);
NXVlog(self);
self->errCount++;
return;
} else {
validateDependsOnField(self,groupID,dpfieldID);
H5Dclose(dpfieldID);
}
}
示例13: DataType
//--------------------------------------------------------------------------
// Function: CompType overloaded constructor
///\brief Gets the compound datatype of the specified dataset.
///\param dataset - IN: Dataset that this enum datatype associates with
///\return CompType instance
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
CompType::CompType( const DataSet& dataset ) : DataType()
{
// Calls C function H5Dget_type to get the id of the datatype
id = H5Dget_type( dataset.getId() );
// If the datatype id is invalid, throw exception
if( id < 0 )
{
throw DataSetIException("CompType constructor", "H5Dget_type failed");
}
}
示例14: getDatasetByFrame
asynStatus hdf5Driver::getFrameData (int frame, void *pData)
{
const char *functionName = "getFrameData";
asynStatus status = asynSuccess;
struct dsetInfo *pDSet;
hid_t dSpace, dType, mSpace;
pDSet = getDatasetByFrame(frame);
if(!pDSet)
return asynError;
hsize_t offset[3] = {(hsize_t)(frame - pDSet->imageNrLow), 0, 0};
hsize_t count[3] = {1, pDSet->height, pDSet->width};
if((dSpace = H5Dget_space(pDSet->id)) < 0)
{
asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
"%s:%s couldn't get dataspace\n",
driverName, functionName);
return asynError;
}
dType = H5Dget_type(pDSet->id);
mSpace = H5Screate_simple(3, count, NULL);
// Select the hyperslab
if(H5Sselect_hyperslab(dSpace, H5S_SELECT_SET, offset, NULL, count,
NULL) < 0)
{
asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
"%s:%s couldn't select hyperslab\n",
driverName, functionName);
status = asynError;
goto end;
}
// and finally read the image
if(H5Dread(pDSet->id, dType, mSpace, dSpace, H5P_DEFAULT, pData) < 0)
{
asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
"%s:%s couldn't read image\n",
driverName, functionName);
status = asynError;
}
end:
H5Tclose(dType);
H5Sclose(mSpace);
return status;
}
示例15: H5Dget_type
void Fast5Files::getFastq(hid_t dataset){
hid_t dt;
size_t size;
char *data;
dt = H5Dget_type(dataset);
size = H5Tget_size(dt);
data = (char*)malloc(size);
H5Dread(dataset, H5T_C_S1, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
qDebug() << data;
free(data);
H5Dclose(dataset);
}