本文整理汇总了C++中DataSpace::getId方法的典型用法代码示例。如果您正苦于以下问题:C++ DataSpace::getId方法的具体用法?C++ DataSpace::getId怎么用?C++ DataSpace::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataSpace
的用法示例。
在下文中一共展示了DataSpace::getId方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
//--------------------------------------------------------------------------
// Function: DataSet::read
///\brief This is an overloaded member function, provided for convenience.
/// It takes a reference to a \c H5std_string for the buffer.
///\param buf - IN: Buffer for read data
///\param mem_type - IN: Memory datatype
///\param mem_space - IN: Memory dataspace
///\param file_space - IN: Dataset's dataspace in the file
///\param xfer_plist - IN: Transfer property list for this I/O operation
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
// Modification
// Jul 2009
// Follow the change to Attribute::read and use the following
// private functions to read datasets with fixed- and
// variable-length string:
// DataSet::p_read_fixed_len and
// DataSet::p_read_variable_len
//--------------------------------------------------------------------------
void DataSet::read(H5std_string& strg, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist) const
{
// Check if this dataset has variable-len string or fixed-len string and
// proceed appropriately.
htri_t is_variable_len = H5Tis_variable_str(mem_type.getId());
if (is_variable_len < 0)
{
throw DataSetIException("DataSet::read", "H5Tis_variable_str failed");
}
// Obtain identifiers for C API
hid_t mem_type_id = mem_type.getId();
hid_t mem_space_id = mem_space.getId();
hid_t file_space_id = file_space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
if (!is_variable_len) // only allocate for fixed-len string
{
p_read_fixed_len(mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg);
}
else
{
p_read_variable_len(mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg);
}
}
示例2: write
//--------------------------------------------------------------------------
// Function: DataSet::write
///\brief Writes raw data from an application buffer to a dataset.
///\param buf - IN: Buffer containing data to be written
///\param mem_type - IN: Memory datatype
///\param mem_space - IN: Memory dataspace
///\param file_space - IN: Dataset's dataspace in the file
///\param xfer_plist - IN: Transfer property list for this I/O operation
///\exception H5::DataSetIException
///\par Description
/// This function writes raw data from an application buffer
/// \a buf to a dataset, converting from memory datatype
/// \a mem_type and dataspace \a mem_space to file datatype
/// and dataspace.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSet::write( const void* buf, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist ) const
{
// Obtain identifiers for C API
hid_t mem_type_id = mem_type.getId();
hid_t mem_space_id = mem_space.getId();
hid_t file_space_id = file_space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
herr_t ret_value = H5Dwrite( id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf );
if( ret_value < 0 )
{
throw DataSetIException("DataSet::write", "H5Dwrite failed");
}
}
示例3: extentCopy
//--------------------------------------------------------------------------
// Function: DataSpace::extentCopy
///\brief Copies the extent of a dataspace.
///\param dest_space - IN: Dataspace to copy from
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
// Modification
// Replaced the version without const parameter - Apr, 2014
//--------------------------------------------------------------------------
void DataSpace::extentCopy (const DataSpace& dest_space) const
{
hid_t dest_space_id = dest_space.getId();
herr_t ret_value = H5Sextent_copy( dest_space_id, id );
if( ret_value < 0 )
{
throw DataSpaceIException("DataSpace::extentCopy", "H5Sextent_copy failed");
}
}
示例4: IdComponentException
//--------------------------------------------------------------------------
// Function: H5Object::reference
///\brief Creates a reference to an HDF5 object or a dataset region.
///\param ref - IN: Reference pointer
///\param name - IN: Name of the object to be referenced
///\param dataspace - IN: Dataspace with selection
///\param ref_type - IN: Type of reference to query, valid values are:
/// \li \c H5R_OBJECT - Reference is an object reference.
/// \li \c H5R_DATASET_REGION - Reference is a dataset region
/// reference. - this is the default
///\exception H5::IdComponentException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
void H5Object::reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type) const
{
try {
p_reference(ref, name, dataspace.getId(), ref_type);
}
catch (IdComponentException E) {
throw IdComponentException("H5Object::reference", E.getDetailMsg());
}
}
示例5: ReferenceException
//--------------------------------------------------------------------------
// Function: H5Location::reference
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function in that it takes an
/// \c H5std_string for \a name.
///\param ref - IN: Reference pointer
///\param name - IN: Name of the object to be referenced
///\param dataspace - IN: Dataspace with selection
///\param ref_type - IN: Type of reference to query, valid values are:
/// \li \c H5R_OBJECT - Reference is an object reference.
/// \li \c H5R_DATASET_REGION - Reference is a dataset region
/// reference. (default)
///\exception H5::ReferenceException
///\note This method is more suitable for a dataset region reference.
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
void H5Location::reference(void* ref, const H5std_string& name, const DataSpace& dataspace, H5R_type_t ref_type) const
{
try {
p_reference(ref, name.c_str(), dataspace.getId(), ref_type);
}
catch (ReferenceException E) {
throw ReferenceException(inMemFunc("reference"), E.getDetailMsg());
}
}
示例6: fillMemBuf
//--------------------------------------------------------------------------
// Function: DataSet::fillMemBuf
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function in that it only takes the
/// the last three arguments.
///\param buf - IN/OUT: Memory buffer to fill selection within
///\param buf_type - IN: Datatype of the elements in buffer
///\param space - IN: Dataspace describing memory buffer & containing selection to use
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space)
{
hid_t buf_type_id = buf_type.getId();
hid_t space_id = space.getId();
herr_t ret_value = H5Dfill(NULL, buf_type_id, buf, buf_type_id, space_id);
if( ret_value < 0 )
{
throw DataSetIException("DataSet::fillMemBuf", "H5Dfill failed");
}
}
示例7: fillMemBuf
//--------------------------------------------------------------------------
// Function: DataSet::fillMemBuf
///\brief Fills a selection in memory with a value.
///\param fill - IN: Pointer to fill value to use - default NULL
///\param fill_type - IN: Datatype of the fill value
///\param buf - IN/OUT: Memory buffer to fill selection within
///\param buf_type - IN: Datatype of the elements in buffer
///\param space - IN: Dataspace describing memory buffer & containing selection to use
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2014
// Modification
// Used the non-const version.
//--------------------------------------------------------------------------
void DataSet::fillMemBuf(const void *fill, const DataType& fill_type, void *buf, const DataType& buf_type, const DataSpace& space) const
{
hid_t fill_type_id = fill_type.getId();
hid_t buf_type_id = buf_type.getId();
hid_t space_id = space.getId();
herr_t ret_value = H5Dfill(fill, fill_type_id, buf, buf_type_id, space_id);
if( ret_value < 0 )
{
throw DataSetIException("DataSet::fillMemBuf", "H5Dfill failed");
}
}
示例8: iterateElems
//--------------------------------------------------------------------------
// Function: DataSet::iterateElems
///\brief Iterates over all selected elements in a dataspace.
///\param buf - IN/OUT: Pointer to the buffer in memory containing the
/// elements to iterate over
///\param type - IN: Datatype for the elements stored in \a buf
///\param space - IN: Dataspace for \a buf. Also contains the selection
/// to iterate over.
///\param op - IN: Function pointer to the routine to be called for
/// each element in \a buf iterated over
///\param op_data - IN/OUT: Pointer to any user-defined data associated
/// with the operation
///\exception H5::DataSetIException
///\note This function may not work correctly yet - it's still
/// under development.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
int DataSet::iterateElems( void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data )
{
// Obtain identifiers for C API
hid_t type_id = type.getId();
hid_t space_id = space.getId();
herr_t ret_value = H5Diterate( buf, type_id, space_id, op, op_data );
if( ret_value >= 0 )
return( ret_value );
else // raise exception when H5Diterate returns a negative value
{
throw DataSetIException("DataSet::iterateElems", "H5Diterate failed");
}
}
示例9: vlenReclaim
//--------------------------------------------------------------------------
// Function: DataSet::vlenReclaim
///\brief Reclaims VL datatype memory buffers.
///\param type - IN: Datatype, which is the datatype stored in the buffer
///\param space - IN: Selection for the memory buffer to free the
/// VL datatypes within
///\param xfer_plist - IN: Property list used to create the buffer
///\param buf - IN: Pointer to the buffer to be reclaimed
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//\parDescription
// This function has better prototype for the users than the
// other, which might be removed at some point. BMR - 2006/12/20
//--------------------------------------------------------------------------
void DataSet::vlenReclaim(void* buf, const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist)
{
// Obtain identifiers for C API
hid_t type_id = type.getId();
hid_t space_id = space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
herr_t ret_value = H5Dvlen_reclaim(type_id, space_id, xfer_plist_id, buf);
if (ret_value < 0)
{
throw DataSetIException("DataSet::vlenReclaim", "H5Dvlen_reclaim failed");
}
}
示例10: getVlenBufSize
//--------------------------------------------------------------------------
// Function: DataSet::getVlenBufSize
///\brief Returns the number of bytes required to store VL data.
///\return Amount of storage
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
hsize_t DataSet::getVlenBufSize( DataType& type, DataSpace& space ) const
{
// Obtain identifiers for C API
hid_t type_id = type.getId();
hid_t space_id = space.getId();
hsize_t size; // for amount of storage
herr_t ret_value = H5Dvlen_get_buf_size( id, type_id, space_id, &size );
if( ret_value < 0 )
{
throw DataSetIException("DataSet::getVlenBufSize", "H5Dvlen_get_buf_size failed");
}
return( size );
}
示例11: attr
//--------------------------------------------------------------------------
// Function: H5Object::createAttribute
///\brief Creates an attribute for a group, dataset, or named datatype.
///\param name - IN: Name of the attribute
///\param data_type - IN: Datatype for the attribute
///\param data_space - IN: Dataspace for the attribute - only simple
/// dataspaces are allowed at this time
///\param create_plist - IN: Creation property list - default to
/// PropList::DEFAULT
///\return Attribute instance
///\exception H5::AttributeIException
///\par Description
/// The attribute name specified in \a name must be unique.
/// Attempting to create an attribute with the same name as an
/// existing attribute will raise an exception, leaving the
/// pre-existing attribute intact. To overwrite an existing
/// attribute with a new attribute of the same name, first
/// delete the existing one with \c H5Object::removeAttr, then
/// recreate it with this function.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
Attribute H5Object::createAttribute( const char* name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const
{
hid_t type_id = data_type.getId();
hid_t space_id = data_space.getId();
hid_t plist_id = create_plist.getId();
hid_t attr_id = H5Acreate2(getId(), name, type_id, space_id, plist_id, H5P_DEFAULT );
// If the attribute id is valid, create and return the Attribute object
if( attr_id > 0 )
{
Attribute attr( attr_id );
return( attr );
}
else
throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate2 failed");
}
示例12: copy
//--------------------------------------------------------------------------
// Function: DataSpace::copy
///\brief Makes a copy of an existing dataspace.
///\param like_space - IN: Dataspace to be copied
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
// Modification
// - Replaced resetIdComponent() with decRefCount() to use C
// library ID reference counting mechanism - BMR, Jun 1, 2004
// - Replaced decRefCount with close() to let the C library
// handle the reference counting - BMR, Jun 1, 2006
//--------------------------------------------------------------------------
void DataSpace::copy( const DataSpace& like_space )
{
// If this object has an hdf5 valid id, close it
if( id != H5S_ALL ) {
try {
close();
}
catch (Exception& close_error) {
throw DataSpaceIException("DataSpace::copy", close_error.getDetailMsg());
}
} // end if
// call C routine to copy the dataspace
id = H5Scopy( like_space.getId() );
if( id < 0 )
throw DataSpaceIException("DataSpace::copy", "H5Scopy failed");
}
示例13: createDataSet
//--------------------------------------------------------------------------
// Function: CommonFG::createDataSet
///\brief Creates a new dataset at this location.
///\param name - IN: Name of the dataset to create
///\param data_type - IN: Datatype of the dataset
///\param data_space - IN: Dataspace for the dataset
///\param create_plist - IN: Creation properly list for the dataset
///\return DataSet instance
///\exception H5::FileIException or H5::GroupIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSet CommonFG::createDataSet( const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist ) const
{
// Obtain identifiers for C API
hid_t type_id = data_type.getId();
hid_t space_id = data_space.getId();
hid_t create_plist_id = create_plist.getId();
// Call C routine H5Dcreate2 to create the named dataset
hid_t dataset_id = H5Dcreate2( getLocId(), name, type_id, space_id, H5P_DEFAULT, create_plist_id, H5P_DEFAULT );
// If the creation of the dataset failed, throw an exception
if( dataset_id < 0 )
{
throwException("createDataSet", "H5Dcreate2 failed");
}
// No failure, create and return the DataSet object
DataSet dataset( dataset_id );
return( dataset );
}
示例14: IdComponent
//--------------------------------------------------------------------------
// Function: DataSpace copy constructor
///\brief Copy constructor: makes a copy of the original DataSpace object.
///\param original - IN: DataSpace object to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSpace::DataSpace(const DataSpace& original) : IdComponent(original)
{
id = original.getId();
incRefCount(); // increment number of references to this id
}