mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-24 15:25:00 +08:00
[svn-r8465] Purpose:
Add more C++ wrappers - incrementally check-in Description: Added wrapper for many C property list functions and added Doxygen documentation to existing C++ functions in these files. This is an incremental check-in to preserve the code, corresponding tests will follow in a few weeks. For H5PropList.h and H5PropList.cpp, added C++ wrappers for: H5Pexist H5Pclose_class H5Pget H5Pget_size H5Pget_class_name H5Pget_nprops H5Pset H5Pisa_class H5Premove H5Pequal H5Pget_class_parent For H5FaccProp.h and H5FaccProp.cpp, added C++ wrappers for: H5Ps[g]et_driver H5Ps[g]et_family_offset H5Ps[g]et_fapl_core H5Ps[g]et_fapl_family H5Ps[g]et_fapl_stream H5Ps[g]et_sieve_buf_size H5Ps[g]et_meta_block_size H5Ps[g]et_alignment H5Ps[g]et_multi_type H5Ps[g]et_fclose_degree H5Pset_fapl_stdio H5Pset_fapl_split H5Pset_fapl_log H5Pset_fapl_sec2 For H5FcreatProp.h and H5FcreatProp.cpp, added C++ wrappers for: H5Pfill_value_defined H5Premove_filter H5Pget_filter_by_id H5Pmodify_filter H5Pall_filters_avail H5Pset_shuffle H5Ps[g]et_alloc_time H5Ps[g]et_fill_time H5Pset_fletcher32 For H5DxferProp.h and H5DxferProp.cpp, added C++ wrappers for: H5Ps[g]et_dxpl_multi H5Ps[g]et_small_data_block_size H5Ps[g]et_hyper_vector_size H5Ps[g]et_edc_check Platforms: SunOS 5.7 (arabica) Linux 2.4 (eirene) SunOS 5.8-64 (sol)
This commit is contained in:
parent
51455f4282
commit
db8f63f552
@ -29,13 +29,33 @@ namespace H5 {
|
||||
|
||||
const DSetCreatPropList DSetCreatPropList::DEFAULT( H5P_DEFAULT );
|
||||
|
||||
// Creates a dataset creation property list
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Default Constructor
|
||||
///\brief Default Constructor: Creates a dataset creation property list
|
||||
//--------------------------------------------------------------------------
|
||||
DSetCreatPropList::DSetCreatPropList() : PropList( H5P_DATASET_CREATE) {}
|
||||
|
||||
// Copy constructor: makes a copy of the original DSetCreatPropList object;
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Copy Constructor
|
||||
///\brief Copy Constructor: Makes a copy of the original
|
||||
/// DSetCreatPropList object
|
||||
//--------------------------------------------------------------------------
|
||||
DSetCreatPropList::DSetCreatPropList( const DSetCreatPropList& orig ) : PropList( orig ) {}
|
||||
|
||||
// Sets the size of the chunks used to store a chunked layout dataset.
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::setChunk
|
||||
///\brief Sets the size of the chunks used to store a chunked layout
|
||||
/// dataset.
|
||||
///\param ndims - IN: Number of dimensions of each chunk
|
||||
///\param dim - IN: Array containing the size of each chunk
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// The \a ndims parameter currently must have the same value as
|
||||
/// the rank of the dataset. The values of the \a dim array
|
||||
/// define the size of the chunks to store the dataset's raw
|
||||
/// data. As a side-effect, the layout of the dataset will be
|
||||
/// changed to \c H5D_CHUNKED, if it is not so already.
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetCreatPropList::setChunk( int ndims, const hsize_t* dim ) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_chunk( id, ndims, dim );
|
||||
@ -45,20 +65,14 @@ void DSetCreatPropList::setChunk( int ndims, const hsize_t* dim ) const
|
||||
}
|
||||
}
|
||||
|
||||
// Gets the layout of the raw data storage of the data that uses this
|
||||
// property list
|
||||
H5D_layout_t DSetCreatPropList::getLayout() const
|
||||
{
|
||||
H5D_layout_t layout = H5Pget_layout( id );
|
||||
if( layout == H5D_LAYOUT_ERROR )
|
||||
{
|
||||
throw PropListIException("DSetCreatPropList::getLayout",
|
||||
"H5Pget_layout returns H5D_LAYOUT_ERROR");
|
||||
}
|
||||
return( layout );
|
||||
}
|
||||
|
||||
// Retrieves the size of the chunks used to store a chunked layout dataset.
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::getChunk
|
||||
///\brief Retrieves the size of the chunks used to store a chunked
|
||||
/// layout dataset.
|
||||
///\param max_ndims - IN: Size of \a dim array
|
||||
///\param dim - OUT: Array to store the chunk dimensions
|
||||
///\exception H5::PropListIException
|
||||
//--------------------------------------------------------------------------
|
||||
int DSetCreatPropList::getChunk( int max_ndims, hsize_t* dim ) const
|
||||
{
|
||||
int chunk_size = H5Pget_chunk( id, max_ndims, dim );
|
||||
@ -70,7 +84,16 @@ int DSetCreatPropList::getChunk( int max_ndims, hsize_t* dim ) const
|
||||
return( chunk_size );
|
||||
}
|
||||
|
||||
// Sets the type of storage used store the raw data for a dataset.
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::setLayout
|
||||
///\brief Sets the type of storage used store the raw data for a dataset.
|
||||
///\param plist - IN: Property list id, here by mistake, should be removed
|
||||
///\param layout - IN: Type of storage layout for raw data
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// For information on setting layout type, please refer to
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetLayout
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetCreatPropList::setLayout(hid_t plist, H5D_layout_t layout ) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_layout( id, layout );
|
||||
@ -81,7 +104,43 @@ void DSetCreatPropList::setLayout(hid_t plist, H5D_layout_t layout ) const
|
||||
}
|
||||
}
|
||||
|
||||
// Sets compression method and compression level
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::getLayout
|
||||
///\brief Retrieves the layout type of this property list
|
||||
///\return Layout type, which can be:
|
||||
/// \li \c H5D_COMPACT - raw data is stored in the object
|
||||
/// header in the file.
|
||||
/// \li \c H5D_CONTIGUOUS - raw data is stored separately from the
|
||||
/// object header in one contiguous chunk in
|
||||
/// the file.
|
||||
/// \li \c H5D_CHUNKED - raw data is stored separately from the
|
||||
/// object header in chunks in separate locations
|
||||
/// in the file.
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
//--------------------------------------------------------------------------
|
||||
H5D_layout_t DSetCreatPropList::getLayout() const
|
||||
{
|
||||
H5D_layout_t layout = H5Pget_layout( id );
|
||||
if( layout == H5D_LAYOUT_ERROR )
|
||||
{
|
||||
throw PropListIException("DSetCreatPropList::getLayout",
|
||||
"H5Pget_layout returns H5D_LAYOUT_ERROR");
|
||||
}
|
||||
return( layout );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::setDeflate
|
||||
///\brief Sets compression method and compression level
|
||||
///\param level - IN: Compression level, should [0..9], inclusive
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// The function sets the compression method for this property
|
||||
/// list to \c H5D_COMPRESS_DEFLATE and the compression level to
|
||||
/// \a level. Lower compression levels are faster but result in
|
||||
/// less compression.
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetCreatPropList::setDeflate( int level ) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_deflate( id, level );
|
||||
@ -92,7 +151,23 @@ void DSetCreatPropList::setDeflate( int level ) const
|
||||
}
|
||||
}
|
||||
|
||||
// Sets a dataset fill value
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::setFillValue
|
||||
///\brief Sets a dataset fill value
|
||||
///\param fvalue_type - IN: Data type for the value passed via \a value
|
||||
///\param value - IN: Pointer to buffer containing the fill value
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// The datatype may differ from that of the dataset, but it must
|
||||
/// be one that the HDF5 library is able to convert \a value to
|
||||
/// the dataset datatype when the dataset is created.
|
||||
/// The default fill value is 0 (zero,) which is interpreted
|
||||
/// according to the actual dataset datatype.
|
||||
///\par
|
||||
/// For information on setting fill value, please refer to the
|
||||
/// C layer Reference Manual at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetFillValue
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetCreatPropList::setFillValue( const DataType& fvalue_type, const void* value ) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_fill_value( id, fvalue_type.getId(), value );
|
||||
@ -103,7 +178,18 @@ void DSetCreatPropList::setFillValue( const DataType& fvalue_type, const void* v
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieves a dataset fill value
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::getFillValue
|
||||
///\brief Retrieves a dataset fill value
|
||||
///\param fvalue_type - IN: Data type for the value passed via \a value
|
||||
///\param value - OUT: Pointer to buffer to hold the retrieved fill value
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// The fill value is returned through \a value pointer
|
||||
/// and the memory is allocated by the caller. The fill
|
||||
/// value will be converted from its current data type to the
|
||||
/// specified by \a fvalue_type.
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetCreatPropList::getFillValue( const DataType& fvalue_type, void* value ) const
|
||||
{
|
||||
herr_t ret_value = H5Pget_fill_value( id, fvalue_type.getId(), value );
|
||||
@ -114,10 +200,50 @@ void DSetCreatPropList::getFillValue( const DataType& fvalue_type, void* value )
|
||||
}
|
||||
}
|
||||
|
||||
// Adds a filter to the filter pipeline
|
||||
void DSetCreatPropList::setFilter( H5Z_filter_t filter, unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[] ) const
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::isFillValueDefined
|
||||
///\brief Check if fill value has been defined for this property
|
||||
///\return
|
||||
/// \li \c H5D_FILL_VALUE_UNDEFINED =0,
|
||||
/// \li \c H5D_FILL_VALUE_DEFAULT =1,
|
||||
/// \li \c H5D_FILL_VALUE_USER_DEFINED =2
|
||||
///\exception H5::PropListIException
|
||||
//--------------------------------------------------------------------------
|
||||
H5D_fill_value_t DSetCreatPropList::isFillValueDefined()
|
||||
{
|
||||
herr_t ret_value = H5Pset_filter( id, filter, flags, cd_nelmts, cd_values );
|
||||
H5D_fill_value_t status;
|
||||
herr_t ret_value = H5Pfill_value_defined(id, &status);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("DSetCreatPropList::isFillValueDefined",
|
||||
"H5Pfill_value_defined returned H5D_FILL_VALUE_ERROR (-1)");
|
||||
}
|
||||
else
|
||||
return (status);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::setFilter
|
||||
///\brief Adds a filter to the filter pipeline
|
||||
///\param filter_id - IN: Filter to add
|
||||
///\param flags - IN: Specifies general properties of the filter
|
||||
///\param cd_nelmts - IN: Number of elements in cd_values
|
||||
///\param cd_values - IN: Auxiliary data for the filter
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// The \a flags argument is a bit vector of the field:
|
||||
/// \c H5Z_FLAG_OPTIONAL(0x0001)
|
||||
///\par
|
||||
/// If this bit is set then the filter is optional. If the filter
|
||||
/// fails during a \c DataSet::write() operation then the filter
|
||||
/// is just excluded from the pipeline for the chunk for which it
|
||||
/// failed; the filter will not participate in the pipeline
|
||||
/// during a \c DataSet::read() of the chunk. If this bit is clear
|
||||
/// and the filter fails then the entire I/O operation fails.
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetCreatPropList::setFilter( H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[] ) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_filter( id, filter_id, flags, cd_nelmts, cd_values );
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("DSetCreatPropList::setFilter",
|
||||
@ -125,10 +251,18 @@ void DSetCreatPropList::setFilter( H5Z_filter_t filter, unsigned int flags, size
|
||||
}
|
||||
}
|
||||
|
||||
// Removes one or more filters to the filter pipeline
|
||||
void DSetCreatPropList::removeFilter( H5Z_filter_t filter) const
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::removeFilter
|
||||
///\brief Removes one or more filters
|
||||
///\param filter_id - IN: Filter to remove
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// Deletes a filter from the dataset creation property list;
|
||||
/// deletes all filters if \a filter_id is \c H5Z_FILTER_NONE.
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetCreatPropList::removeFilter(H5Z_filter_t filter_id) const
|
||||
{
|
||||
herr_t ret_value = H5Premove_filter( id, filter);
|
||||
herr_t ret_value = H5Premove_filter( id, filter_id);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("DSetCreatPropList::removeFilter",
|
||||
@ -136,7 +270,12 @@ void DSetCreatPropList::removeFilter( H5Z_filter_t filter) const
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the number of filters in the pipeline
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::getNfilters
|
||||
///\brief Returns the number of filters in the pipeline
|
||||
///\return Number of filters
|
||||
///\exception H5::PropListIException
|
||||
//--------------------------------------------------------------------------
|
||||
int DSetCreatPropList::getNfilters() const
|
||||
{
|
||||
int num_filters = H5Pget_nfilters( id );
|
||||
@ -149,22 +288,251 @@ int DSetCreatPropList::getNfilters() const
|
||||
return( num_filters );
|
||||
}
|
||||
|
||||
// Returns information about a filter in a pipeline
|
||||
H5Z_filter_t DSetCreatPropList::getFilter( int filter_number, unsigned int& flags, size_t& cd_nelmts, unsigned int* cd_values, size_t namelen, char name[] ) const
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::getFilter
|
||||
///\brief Returns information about a filter in a pipeline
|
||||
///\param filter_number - IN: Filter to get, range [0..N-1], where
|
||||
/// N is returned by H5Pget_nfilters()
|
||||
///\param flags - OUT: General properties of the filter
|
||||
///\param cd_nelmts - IN/OUT: Number of elements in \a cd_values /Number
|
||||
/// of values defined by the filter
|
||||
///\param cd_values - OUT: Array to hold the data; allocated by the user
|
||||
///\param namelen - OUT: Length of \a name
|
||||
///\param name - OUT: Name of the filter
|
||||
///\return Filter id
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// Failure occurs when \a filter_number is out of range.
|
||||
//--------------------------------------------------------------------------
|
||||
H5Z_filter_t DSetCreatPropList::getFilter(int filter_number, unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values, size_t namelen, char name[]) const
|
||||
{
|
||||
H5Z_filter_t filter;
|
||||
filter = H5Pget_filter( id, filter_number, &flags, &cd_nelmts,
|
||||
H5Z_filter_t filter_id;
|
||||
filter_id = H5Pget_filter( id, filter_number, &flags, &cd_nelmts,
|
||||
cd_values, namelen, name );
|
||||
if( filter == H5Z_FILTER_ERROR )
|
||||
if( filter_id == H5Z_FILTER_ERROR )
|
||||
{
|
||||
throw PropListIException("DSetCreatPropList::getFilter",
|
||||
"H5Pget_filter returned H5Z_FILTER_ERROR");
|
||||
}
|
||||
else
|
||||
return( filter );
|
||||
return(filter_id);
|
||||
}
|
||||
|
||||
// Adds an external file to the list of external files
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::getFilterById
|
||||
///\brief Returns information about a filter in a pipeline given the
|
||||
/// filter id
|
||||
///\param filter_id - IN: Filter to get
|
||||
///\param flags - OUT: General properties of the filter
|
||||
///\param cd_nelmts - IN/OUT: Number of elements in \a cd_values /Number
|
||||
/// of values defined by the filter
|
||||
///\param cd_values - OUT: Array to hold the data; allocated by the user
|
||||
///\param namelen - IN: Length of \a name
|
||||
///\param name - OUT: Name of the filter
|
||||
///\exception H5::PropListIException
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetCreatPropList::getFilterById(H5Z_filter_t filter_id, unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values, size_t namelen, char name[]) const
|
||||
{
|
||||
herr_t ret_value = H5Pget_filter_by_id(id, filter_id, &flags, &cd_nelmts,
|
||||
cd_values, namelen, name );
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("DSetCreatPropList::getFilterById",
|
||||
"H5Pget_filter_by_id failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::modifyFilter
|
||||
///\brief Modifies the specified filter
|
||||
///\param filter_id - IN: Filter to get
|
||||
///\param flags - OUT: General properties of the filter
|
||||
///\param cd_nelmts - IN: Number of elements in \a cd_values
|
||||
/// \n OUT: Number of values defined by the filter
|
||||
///\param cd_values - OUT: Array to hold the data; allocated by the user
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// The \a flags argument is a bit vector of the field:
|
||||
/// \c H5Z_FLAG_OPTIONAL(0x0001)
|
||||
///\par
|
||||
/// If this bit is set then the filter is optional. If the filter
|
||||
/// fails during a DataSet::write() operation then the filter
|
||||
/// is just excluded from the pipeline for the chunk for which it
|
||||
/// failed; the filter will not participate in the pipeline
|
||||
/// during a DataSet::read() of the chunk. If this bit is clear
|
||||
/// and the filter fails then the entire I/O operation fails.
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetCreatPropList::modifyFilter( H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[] ) const
|
||||
{
|
||||
herr_t ret_value = H5Pmodify_filter(id, filter_id, flags, cd_nelmts, cd_values);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("DSetCreatPropList::modifyFilter",
|
||||
"H5Pmodify_filter failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::allFiltersAvail
|
||||
///\brief Queries whether all the filters set in this property list
|
||||
/// are available currently.
|
||||
///\return true if all filters available, and false if one or more
|
||||
/// filters not currently available
|
||||
///\exception H5::PropListIException
|
||||
//--------------------------------------------------------------------------
|
||||
bool DSetCreatPropList::allFiltersAvail()
|
||||
{
|
||||
htri_t ret_value = H5Pall_filters_avail(id);
|
||||
if( ret_value > 0 )
|
||||
return true;
|
||||
else if( ret_value == 0 )
|
||||
return false;
|
||||
else // Raise exception when H5Pall_filters_avail returns a negative value
|
||||
{
|
||||
throw PropListIException("DSetCreatPropList::allFiltersAvail", "H5Pall_filters_avail returned negative value");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::setShuffle
|
||||
///\brief Sets method of the shuffle filter
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// Please refer to the Reference Manual of \c H5Pset_shuffle for
|
||||
/// details.
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetShuffle
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetCreatPropList::setShuffle()
|
||||
{
|
||||
herr_t ret_value = H5Pset_shuffle(id);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("DSetCreatPropList::setShuffle",
|
||||
"H5Pset_shuffle failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::getAllocTime
|
||||
///\brief Get space allocation time for this property.
|
||||
///\return Space allocation time.
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// The values of space allocation time can be one of the
|
||||
/// followings:
|
||||
/// \li \c H5D_ALLOC_TIME_DEFAULT
|
||||
/// \li \c H5D_ALLOC_TIME_EARLY
|
||||
/// \li \c H5D_ALLOC_TIME_LATE
|
||||
/// \li \c H5D_ALLOC_TIME_INCR
|
||||
//--------------------------------------------------------------------------
|
||||
H5D_alloc_time_t DSetCreatPropList::getAllocTime()
|
||||
{
|
||||
H5D_alloc_time_t alloc_time;
|
||||
herr_t ret_value = H5Pget_alloc_time(id, &alloc_time);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("DSetCreatPropList::getAllocTime",
|
||||
"H5Pget_alloc_time failed");
|
||||
}
|
||||
else
|
||||
return (alloc_time);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::getFillTime
|
||||
///\brief Gets fill value writing time.
|
||||
///\return Fill value writing time
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// Valid values for fill value writing time include
|
||||
/// \li \c H5D_FILL_TIME_NEVER
|
||||
/// \li \c H5D_FILL_TIME_ALLOC.
|
||||
//--------------------------------------------------------------------------
|
||||
H5D_fill_time_t DSetCreatPropList::getFillTime()
|
||||
{
|
||||
H5D_fill_time_t fill_time;
|
||||
herr_t ret_value = H5Pget_fill_time(id, &fill_time);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("DSetCreatPropList::getFillTime",
|
||||
"H5Pget_fill_time failed");
|
||||
}
|
||||
else
|
||||
return (fill_time);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::setAllocTime
|
||||
///\brief Sets space allocation time for dataset during creation.
|
||||
///\param alloc_time - IN: Allocation time
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// Valid values for space allocation time include:
|
||||
/// \li \c H5D_ALLOC_TIME_DEFAULT
|
||||
/// \li \c H5D_ALLOC_TIME_EARLY
|
||||
/// \li \c H5D_ALLOC_TIME_LATE
|
||||
/// \li \c H5D_ALLOC_TIME_INCR
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetCreatPropList::setAllocTime(H5D_alloc_time_t alloc_time)
|
||||
{
|
||||
herr_t ret_value = H5Pset_alloc_time(id, alloc_time);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("DSetCreatPropList::setAllocTime",
|
||||
"H5Pset_alloc_time failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::setFillTime
|
||||
///\brief Sets fill value writing time for dataset.
|
||||
///\return Fill value writing time
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// Valid values for fill value writing time include
|
||||
/// \li \c H5D_FILL_TIME_NEVER
|
||||
/// \li \c H5D_FILL_TIME_ALLOC.
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetCreatPropList::setFillTime(H5D_fill_time_t fill_time)
|
||||
{
|
||||
herr_t ret_value = H5Pset_fill_time(id, fill_time);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("DSetCreatPropList::setFillTime",
|
||||
"H5Pset_fill_time failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::setFletcher32
|
||||
///\brief Sets Fletcher32 checksum of EDC for this property list.
|
||||
///\exception H5::PropListIException
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetCreatPropList::setFletcher32()
|
||||
{
|
||||
herr_t ret_value = H5Pset_fletcher32(id);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("DSetCreatPropList::setFletcher32",
|
||||
"H5Pset_fletcher32 failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::setExternal
|
||||
///\brief Adds an external file to the list of external files
|
||||
///\param name - IN: Name of the external file
|
||||
///\param offset - IN: Location where the data starts in the file
|
||||
///\param size - IN: Number of bytes reserved in the file for the data
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// If a dataset is splitted across multiple files then the files
|
||||
/// should be defined in order. The total size of the dataset is
|
||||
/// the sum of the \a size arguments for all the external files. If
|
||||
/// the total size is larger than the size of a dataset then the
|
||||
/// dataset can be extended (provided the data space also allows
|
||||
/// the extending).
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetCreatPropList::setExternal( const char* name, off_t offset, hsize_t size ) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_external( id, name, offset, size );
|
||||
@ -175,7 +543,12 @@ void DSetCreatPropList::setExternal( const char* name, off_t offset, hsize_t siz
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the number of external files for a dataset
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::getExternalCount
|
||||
///\brief Returns the number of external files for a dataset
|
||||
///\return Number of external files
|
||||
///\exception H5::PropListIException
|
||||
//--------------------------------------------------------------------------
|
||||
int DSetCreatPropList::getExternalCount() const
|
||||
{
|
||||
int num_ext_files = H5Pget_external_count( id );
|
||||
@ -188,7 +561,27 @@ int DSetCreatPropList::getExternalCount() const
|
||||
return( num_ext_files );
|
||||
}
|
||||
|
||||
// Returns information about an external file
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetCreatPropList::getExternal
|
||||
///\brief Returns information about an external file
|
||||
///\param idx - IN: Index of the external file, ranges [0-(N-1)] and
|
||||
/// returned by getExternalCount()
|
||||
///\param name_size - IN: Maximum length of \a name
|
||||
///\param name - IN: Name of the external file
|
||||
///\param offset - IN: Location to return an offset value
|
||||
///\param size - OUT: Location to return the size of the external file data
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// The parameter \a idx ranges [0..N-1] where N is returned by
|
||||
/// getExternalCount(). At most \a name_size characters are copied
|
||||
/// into the name array. If the external file name is longer than
|
||||
/// name_size with the null terminator, the return value is not
|
||||
/// null terminated (similar to strncpy()).
|
||||
/// If \a name_size is zero or \a name is a null pointer, the
|
||||
/// external file name will not be returned. If \a offset or
|
||||
/// \a size are null pointers then the corresponding information
|
||||
/// will not be returned.
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetCreatPropList::getExternal( int idx, size_t name_size, char* name, off_t& offset, hsize_t& size ) const
|
||||
{
|
||||
herr_t ret_value = H5Pget_external( id, idx, name_size, name, &offset, &size );
|
||||
|
@ -54,11 +54,14 @@ class H5_DLLCPP DSetCreatPropList : public PropList {
|
||||
// Retrieves a dataset fill value
|
||||
void getFillValue( const DataType& fvalue_type, void* value ) const;
|
||||
|
||||
// Checks if fill value has been defined for this property
|
||||
H5D_fill_value_t isFillValueDefined();
|
||||
|
||||
// Adds a filter to the filter pipeline
|
||||
void setFilter( H5Z_filter_t filter, unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[] ) const;
|
||||
|
||||
// Remove one or all filters from the filter pipeline
|
||||
void removeFilter( H5Z_filter_t filter) const;
|
||||
void removeFilter( H5Z_filter_t filter_id) const;
|
||||
|
||||
// Returns the number of filters in the pipeline
|
||||
int getNfilters() const;
|
||||
@ -66,6 +69,34 @@ class H5_DLLCPP DSetCreatPropList : public PropList {
|
||||
// Returns information about a filter in a pipeline
|
||||
H5Z_filter_t getFilter( int filter_number, unsigned int& flags, size_t& cd_nelmts, unsigned int* cd_values, size_t namelen, char name[] ) const;
|
||||
|
||||
// Returns information about a filter in a pipeline given the filter id
|
||||
void getFilterById(H5Z_filter_t filter_id, unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values, size_t namelen, char name[]) const;
|
||||
|
||||
// Modifies the specified filter
|
||||
void modifyFilter( H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[] ) const;
|
||||
|
||||
// Queries whether all the filters set in this property list are
|
||||
// available currently.
|
||||
bool allFiltersAvail();
|
||||
|
||||
// Sets method of the shuffle filter
|
||||
void setShuffle();
|
||||
|
||||
// Get space allocation time for this property
|
||||
H5D_alloc_time_t getAllocTime();
|
||||
|
||||
// Gets fill value writing time
|
||||
H5D_fill_time_t getFillTime();
|
||||
|
||||
// Set space allocation time for dataset during creation
|
||||
void setAllocTime(H5D_alloc_time_t alloc_time);
|
||||
|
||||
// Sets fill value writing time for dataset
|
||||
void setFillTime(H5D_fill_time_t fill_time);
|
||||
|
||||
// Sets Fletcher32 checksum of EDC for this property list
|
||||
void setFletcher32();
|
||||
|
||||
// Adds an external file to the list of external files
|
||||
void setExternal( const char* name, off_t offset, hsize_t size ) const;
|
||||
|
||||
|
@ -27,10 +27,22 @@ namespace H5 {
|
||||
|
||||
const DSetMemXferPropList DSetMemXferPropList::DEFAULT( H5P_DEFAULT );
|
||||
|
||||
// Creates a dataset memory and transfer property list
|
||||
DSetMemXferPropList::DSetMemXferPropList() : PropList( H5P_DATASET_XFER) {}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function Default constructor
|
||||
///\brief Default constructor - Creates a stub dataset memory and
|
||||
/// transfer property list object.
|
||||
// Programmer: Binh-Minh Ribler
|
||||
//--------------------------------------------------------------------------
|
||||
DSetMemXferPropList::DSetMemXferPropList() : PropList(H5P_DATASET_XFER) {}
|
||||
|
||||
// Copy constructor: makes a copy of the original DSetMemXferPropList object;
|
||||
//--------------------------------------------------------------------------
|
||||
// Function Copy constructor
|
||||
///\brief Copy constructor - makes a copy of the original
|
||||
/// DSetMemXferPropList object
|
||||
///\param orig - IN: The original dataset memory and transfer property
|
||||
/// list object to copy
|
||||
// Programmer: Binh-Minh Ribler
|
||||
//--------------------------------------------------------------------------
|
||||
DSetMemXferPropList::DSetMemXferPropList( const DSetMemXferPropList& orig ) : PropList( orig ) {}
|
||||
|
||||
// Sets type conversion and background buffers
|
||||
@ -104,30 +116,6 @@ void DSetMemXferPropList::getBtreeRatios( double& left, double& middle, double&
|
||||
}
|
||||
}
|
||||
|
||||
// Sets an exception handling callback for datatype conversion
|
||||
// for a dataset transfer property list
|
||||
void DSetMemXferPropList::setTypeConvCB( H5T_conv_except_func_t op, void *user_data) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_type_conv_cb( id, op, user_data);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("DSetMemXferPropList::setTypeConvCB",
|
||||
"H5Pset_type_conv_cb failed");
|
||||
}
|
||||
}
|
||||
|
||||
// Sets an exception handling callback for datatype conversion
|
||||
// for a dataset transfer property list
|
||||
void DSetMemXferPropList::getTypeConvCB( H5T_conv_except_func_t *op, void **user_data) const
|
||||
{
|
||||
herr_t ret_value = H5Pget_type_conv_cb( id, op, user_data);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("DSetMemXferPropList::getTypeConvCB",
|
||||
"H5Pget_type_conv_cb failed");
|
||||
}
|
||||
}
|
||||
|
||||
// Sets the memory manager for variable-length datatype allocation
|
||||
void DSetMemXferPropList::setVlenMemManager( H5MM_allocate_t alloc_func, void* alloc_info, H5MM_free_t free_func, void* free_info ) const
|
||||
{
|
||||
@ -164,34 +152,167 @@ void DSetMemXferPropList::getVlenMemManager( H5MM_allocate_t& alloc_func, void**
|
||||
}
|
||||
}
|
||||
|
||||
/* this function is in parallel mode only - not supported at this time.
|
||||
// Sets the transfer mode
|
||||
void DSetMemXferPropList::setXfer( H5D_transfer_t data_xfer_mode = H5D_XFER_INDEPENDENT ) const
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetMemXferPropList::setMulti
|
||||
///\brief Sets the data transfer property list for the multi-file driver.
|
||||
///\param memb_dxpl - OUT: Array of data access property lists
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// This function can only be used after the member map has
|
||||
/// been set with FileAccPropList::setMulti (not done - BMR.)
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetMemXferPropList::setMulti(const hid_t *memb_dxpl)
|
||||
{
|
||||
herr_t ret_value = H5Pset_xfer( ... );
|
||||
if( ret_value < 0 )
|
||||
herr_t ret_value = H5Pset_dxpl_multi(id, memb_dxpl);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("DSetMemXferPropList::setXfer",
|
||||
"H5Pset_xfer failed");
|
||||
throw PropListIException("DSetMemXferPropList::setMulti",
|
||||
"H5Pset_dxpl_multi failed");
|
||||
}
|
||||
}
|
||||
|
||||
// this function is in parallel mode only - not supported at this time.
|
||||
// Gets the transfer mode
|
||||
H5D_transfer_t DSetMemXferPropList::getXfer() const
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetMemXferPropList::getMulti
|
||||
///\brief Returns multi-file data transfer property list information.
|
||||
///\param memb_dxpl - OUT: Array of data access property lists
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetMemXferPropList::getMulti(hid_t *memb_dxpl)
|
||||
{
|
||||
H5D_transfer_t xfer = H5Pget_xfer( id );
|
||||
// BMR - need to find out what the value is for ?? when this function
|
||||
// is supported
|
||||
if( xfer == ?? )
|
||||
herr_t ret_value = H5Pget_dxpl_multi(id, memb_dxpl);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("DSetMemXferPropList::getXfer",
|
||||
"H5Pget_xfer failed");
|
||||
throw PropListIException("DSetMemXferPropList::getMulti",
|
||||
"H5Pget_dxpl_multi failed");
|
||||
}
|
||||
return( xfer );
|
||||
}
|
||||
|
||||
*/
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetMemXferPropList::setSmallDataBlockSize
|
||||
///\brief Sets the size of a contiguous block reserved for small data.
|
||||
///\param size - IN: Maximum size, in bytes, of the small data block.
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// For detail, please refer to the C layer Reference Manual at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetSmallData
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetMemXferPropList::setSmallDataBlockSize(hsize_t size)
|
||||
{
|
||||
herr_t ret_value = H5Pset_small_data_block_size(id, size);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("DSetMemXferPropList::setSmallDataBlockSize",
|
||||
"H5Pset_small_data_block_size failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetMemXferPropList::getSmallDataBlockSize
|
||||
///\brief Returns the current small data block size setting.
|
||||
///\return Size of the small data block, in bytes
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
hsize_t DSetMemXferPropList::getSmallDataBlockSize()
|
||||
{
|
||||
hsize_t size;
|
||||
herr_t ret_value = H5Pget_small_data_block_size(id, &size);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("DSetMemXferPropList::getSmallDataBlockSize",
|
||||
"H5Pget_small_data_block_size failed");
|
||||
}
|
||||
return(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetMemXferPropList::setHyperVectorSize
|
||||
///\brief Sets number of I/O vectors to be read/written in hyperslab I/O.
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// For information, please refer to the C layer Reference
|
||||
/// Manual at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetHyperVectorSize
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetMemXferPropList::setHyperVectorSize(size_t vector_size)
|
||||
{
|
||||
herr_t ret_value = H5Pset_hyper_vector_size(id, vector_size);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("DSetMemXferPropList::setHyperVectorSize",
|
||||
"H5Pset_hyper_vector_size failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetMemXferPropList::getSmallDataBlockSize
|
||||
///\brief Returns the number of I/O vectors to be read/written in
|
||||
/// hyperslab I/O.
|
||||
///\return Number of I/O vectors
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
size_t DSetMemXferPropList::getHyperVectorSize()
|
||||
{
|
||||
size_t vector_size;
|
||||
herr_t ret_value = H5Pget_hyper_vector_size(id, &vector_size);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("DSetMemXferPropList::getHyperVectorSize",
|
||||
"H5Pget_hyper_vector_size failed");
|
||||
}
|
||||
return(vector_size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetMemXferPropList::setEDCCheck
|
||||
///\brief Enables or disables error-detecting for a dataset reading
|
||||
/// process.
|
||||
///\param check - IN: Specifies whether error detection is enabled or
|
||||
/// disabled
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// The error detection algorithm used is the algorithm previously
|
||||
/// specified in the corresponding dataset creation property
|
||||
/// list. This function does not affect the use of error
|
||||
/// detection in the writing process.
|
||||
///\par
|
||||
/// Valid values are as follows:
|
||||
/// \li \c H5Z_ENABLE_EDC (default)
|
||||
/// \li \c H5Z_DISABLE_EDC
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetMemXferPropList::setEDCCheck(H5Z_EDC_t check)
|
||||
{
|
||||
herr_t ret_value = H5Pset_edc_check(id, check);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("DSetMemXferPropList::setEDCCheck",
|
||||
"H5Pset_edc_check failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetMemXferPropList::getEDCCheck
|
||||
///\brief Determines whether error-detection is enabled for dataset reads.
|
||||
///\return \c H5Z_ENABLE_EDC or \c H5Z_DISABLE_EDC
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
H5Z_EDC_t DSetMemXferPropList::getEDCCheck()
|
||||
{
|
||||
H5Z_EDC_t check = H5Pget_edc_check(id);
|
||||
if (check < 0)
|
||||
{
|
||||
throw PropListIException("DSetMemXferPropList::getEDCCheck",
|
||||
"H5Pget_edc_check failed");
|
||||
}
|
||||
return(check);
|
||||
}
|
||||
|
||||
// Default destructor
|
||||
DSetMemXferPropList::~DSetMemXferPropList() {}
|
||||
@ -199,3 +320,4 @@ DSetMemXferPropList::~DSetMemXferPropList() {}
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
} // end namespace
|
||||
#endif
|
||||
|
||||
|
@ -48,12 +48,6 @@ class H5_DLLCPP DSetMemXferPropList : public PropList {
|
||||
// Gets B-tree split ratios for a dataset transfer property list
|
||||
void getBtreeRatios( double& left, double& middle, double& right ) const;
|
||||
|
||||
// Sets an exception handling callback for datatype conversion
|
||||
void setTypeConvCB( H5T_conv_except_func_t op, void *user_data) const;
|
||||
|
||||
// Gets the exception handling callback for datatype conversion
|
||||
void getTypeConvCB( H5T_conv_except_func_t *op, void **user_data) const;
|
||||
|
||||
// Sets the memory manager for variable-length datatype
|
||||
// allocation in H5Dread and H5Dvlen_reclaim
|
||||
void setVlenMemManager( H5MM_allocate_t alloc, void* alloc_info,
|
||||
@ -68,11 +62,31 @@ class H5_DLLCPP DSetMemXferPropList : public PropList {
|
||||
void getVlenMemManager( H5MM_allocate_t& alloc, void** alloc_info,
|
||||
H5MM_free_t& free, void** free_info ) const;
|
||||
|
||||
// Sets the transfer mode - parallel mode, not currently supported
|
||||
//void setXfer( H5D_transfer_t data_xfer_mode = H5D_XFER_INDEPENDENT ) const;
|
||||
// Sets the data transfer property list for the multi-file driver.
|
||||
void setMulti(const hid_t *memb_dxpl);
|
||||
|
||||
// Gets the transfer mode - parallel mode, not currently supported
|
||||
//H5D_transfer_t getXfer() const;
|
||||
// Returns multi-file data transfer property list information.
|
||||
void getMulti(hid_t *memb_dxpl);
|
||||
|
||||
// Sets the size of a contiguous block reserved for small data.
|
||||
void setSmallDataBlockSize(hsize_t size);
|
||||
|
||||
// Returns the current small data block size setting.
|
||||
hsize_t getSmallDataBlockSize();
|
||||
|
||||
// Sets number of I/O vectors to be read/written in hyperslab I/O.
|
||||
void setHyperVectorSize(size_t vector_size);
|
||||
|
||||
// Returns the number of I/O vectors to be read/written in
|
||||
// hyperslab I/O.
|
||||
size_t getHyperVectorSize();
|
||||
|
||||
// Enables or disables error-detecting for a dataset reading
|
||||
// process.
|
||||
void setEDCCheck(H5Z_EDC_t check);
|
||||
|
||||
// Determines whether error-detection is enabled for dataset reads.
|
||||
H5Z_EDC_t getEDCCheck();
|
||||
|
||||
// Creates a copy of an existing dataset memory and transfer
|
||||
// property list using the property list id
|
||||
|
@ -27,143 +27,440 @@ namespace H5 {
|
||||
|
||||
const FileAccPropList FileAccPropList::DEFAULT( H5P_DEFAULT );
|
||||
|
||||
// Creates a file access property list
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Default Constructor
|
||||
///\brief Default constructor: Creates a file access property list
|
||||
//--------------------------------------------------------------------------
|
||||
FileAccPropList::FileAccPropList() : PropList( H5P_FILE_ACCESS ) {}
|
||||
|
||||
// Copy constructor: makes a copy of the original FileAccPropList object;
|
||||
FileAccPropList::FileAccPropList( const FileAccPropList& orig ) : PropList( orig ) {}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Copy Constructor
|
||||
///\brief Copy Constructor: Makes a copy of the original
|
||||
/// FileAccPropList object
|
||||
//--------------------------------------------------------------------------
|
||||
FileAccPropList::FileAccPropList(const FileAccPropList& orig) : PropList(orig) {}
|
||||
|
||||
/* commented out for 1.3.x, only in 1.2.x
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setStdio
|
||||
///\brief Modifies this property list to use the \c H5FD_STDIO driver
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setStdio() const
|
||||
{
|
||||
herr_t ret_value = H5Pset_stdio( id );
|
||||
herr_t ret_value = H5Pset_fapl_stdio(id);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("FileAccPropList::setStdio", "H5Pset_stdio failed");
|
||||
throw PropListIException("FileAccPropList::setStdio", "H5Pset_fapl_stdio failed");
|
||||
}
|
||||
}
|
||||
|
||||
bool FileAccPropList::getStdio() const
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::getDriver
|
||||
///\brief Return the ID of the low-level file driver.
|
||||
///\return A low-level driver ID which is the same ID used when the
|
||||
/// driver was set for the property list. The driver ID is
|
||||
/// only valid as long as the file driver remains registered.
|
||||
/// Valid driver identifiers can be found at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-GetDriver
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
hid_t FileAccPropList::getDriver() const
|
||||
{
|
||||
herr_t ret_value = H5Pget_stdio( id );
|
||||
if( ret_value < 0 )
|
||||
return( false );
|
||||
else
|
||||
return( true );
|
||||
}
|
||||
|
||||
H5F_driver_t FileAccPropList::getDriver() const
|
||||
{
|
||||
H5F_driver_t driver = H5Pget_driver( id );
|
||||
if( driver == H5F_LOW_ERROR )
|
||||
hid_t driver = H5Pget_driver(id);
|
||||
if (driver < 0)
|
||||
{
|
||||
throw PropListIException("FileAccPropList::getDriver", "H5Pget_driver failed");
|
||||
}
|
||||
return( driver );
|
||||
return(driver);
|
||||
}
|
||||
|
||||
void FileAccPropList::setSec2() const
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setDriver
|
||||
///\brief Set file driver for this property list
|
||||
///\param new_driver_id - IN: Name of property to check for
|
||||
///\param new_driver_info - IN: Struct containing the driver-specific properites
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// For a list of valid driver identifiers, please refer to
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-GetDriver
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setDriver(hid_t new_driver_id, const void *new_driver_info) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_sec2( id );
|
||||
if( ret_value < 0 )
|
||||
herr_t ret_value = H5Pset_driver(id, new_driver_id, new_driver_info);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("FileAccPropList::setSec2", "H5Pset_sec2 failed");
|
||||
throw PropListIException("FileAccPropList::setDriver", "H5Pset_driver failed");
|
||||
}
|
||||
}
|
||||
|
||||
bool FileAccPropList::getSec2() const
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setFamilyOffset
|
||||
///\brief Sets offset for family driver.
|
||||
///\param offset - IN: offset value
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setFamilyOffset(hsize_t offset) const
|
||||
{
|
||||
herr_t ret_value = H5Pget_sec2( id );
|
||||
if( ret_value < 0 )
|
||||
return( false );
|
||||
else
|
||||
return( true );
|
||||
}
|
||||
|
||||
void FileAccPropList::setCore( size_t increment ) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_core( id, increment );
|
||||
if( ret_value < 0 )
|
||||
herr_t ret_value = H5Pset_family_offset(id, offset);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("FileAccPropList::setCore", "H5Pset_core failed");
|
||||
throw PropListIException("FileAccPropList::setFamilyOffset", "H5Pset_family_offset failed");
|
||||
}
|
||||
}
|
||||
|
||||
bool FileAccPropList::getCore( size_t& increment) const
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::getFamilyOffset
|
||||
///\brief Get offset for family driver.
|
||||
///\return Offset for family driver
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
hsize_t FileAccPropList::getFamilyOffset() const
|
||||
{
|
||||
herr_t ret_value = H5Pget_core( id, &increment );
|
||||
if( ret_value < 0 )
|
||||
return( false );
|
||||
else
|
||||
return( true );
|
||||
hsize_t offset;
|
||||
herr_t ret_value = H5Pget_family_offset(id, &offset);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("FileAccPropList::getFamilyOffset", "H5Pget_family_offset failed");
|
||||
}
|
||||
return(offset);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setCore
|
||||
///\brief Modifies this file access property list to use the \c H5FD_CORE
|
||||
/// driver.
|
||||
///\param increment - IN: Specifies how much memory to increase each
|
||||
/// time more memory is needed, in bytes
|
||||
///\param backing_store - IN: Indicating whether to write the file
|
||||
/// contents to disk when the file is closed
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// For more details on the use of \c H5FD_CORE driver, please
|
||||
/// refer to
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetFaplCore
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setCore (size_t increment, hbool_t backing_store) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_fapl_core (id, increment, backing_store);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException ("FileAccPropList::setCore", "H5Pset_fapl_core failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::getCore
|
||||
///\brief Queries core file driver properties.
|
||||
///\param increment - OUT: Size of memory increment, in bytes
|
||||
///\param backing_store - OUT: Indicating whether to write the file
|
||||
/// contents to disk when the file is closed
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::getCore (size_t& increment, hbool_t& backing_store) const
|
||||
{
|
||||
herr_t ret_value = H5Pget_fapl_core(id, &increment, &backing_store);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("FileAccPropList::getCore", "H5Pget_fapl_core failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setFamily
|
||||
///\brief Sets this file access property list to use the family driver.
|
||||
///\param memb_size - IN: Size in bytes of each file member
|
||||
///\param memb_plist - IN: File access property list to be used for
|
||||
/// each family member
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// Note that \a memb_size is used only when creating a new file.
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setFamily( hsize_t memb_size, const FileAccPropList& memb_plist ) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_family( id, memb_size, memb_plist.getId() );
|
||||
herr_t ret_value = H5Pset_fapl_family (id, memb_size, memb_plist.getId() );
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("FileAccPropList::setFamily", "H5Pset_family failed");
|
||||
throw PropListIException("FileAccPropList::setFamily", "H5Pset_fapl_family failed");
|
||||
}
|
||||
}
|
||||
|
||||
//Note: working on this return value here. added copy constructor
|
||||
//that uses PropList copy const. but din't work
|
||||
// Determines whether the file access property list is set to the family
|
||||
// driver then retrieves the family member's property list and returns
|
||||
// true or false
|
||||
bool FileAccPropList::getFamily( hsize_t& memb_size, FileAccPropList& memb_plist ) const
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::getFamily
|
||||
///\brief Returns information about the family file access property
|
||||
/// list.
|
||||
///\param memb_size - OUT: Size in bytes of each file member
|
||||
///\param memb_plist - OUT: Retrieved file access property list for each
|
||||
/// file member
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::getFamily(hsize_t& memb_size, FileAccPropList& memb_plist) const
|
||||
{
|
||||
hid_t memb_plist_id;
|
||||
herr_t ret_value = H5Pget_family( id, &memb_size, &memb_plist_id );
|
||||
herr_t ret_value = H5Pget_fapl_family( id, &memb_size, &memb_plist_id );
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
memb_plist.setId( 0 );
|
||||
return( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
memb_plist.setId( memb_plist_id );
|
||||
return( true );
|
||||
throw PropListIException("FileAccPropList::getFamily", "H5Pget_fapl_family failed");
|
||||
}
|
||||
memb_plist.setId(memb_plist_id);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::getFamily
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It differs from the above function only in what arguments it
|
||||
/// accepts and its return value.
|
||||
///\param memb_size - OUT: Size in bytes of each file member
|
||||
///\return The file access property list for each file member
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
FileAccPropList FileAccPropList::getFamily(hsize_t& memb_size) const
|
||||
{
|
||||
hid_t memb_plist_id;
|
||||
herr_t ret_value = H5Pget_fapl_family( id, &memb_size, &memb_plist_id );
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("FileAccPropList::getFamily", "H5Pget_fapl_family failed");
|
||||
}
|
||||
FileAccPropList memb_plist(memb_plist_id);
|
||||
return(memb_plist);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setSplit
|
||||
///\brief Emulates the old split file driver, which stored meta data
|
||||
/// in one file and raw data in another file.
|
||||
///\param meta_plist - IN: File access plist for the metadata file
|
||||
///\param raw_plist - IN: File access plist for the raw data file
|
||||
///\param meta_ext - IN: Metadata filename extension as \c char*
|
||||
///\param raw_ext - IN: Raw data filename extension as \c char*
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// Temporary - For information, please refer to:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetFaplSplit
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setSplit( FileAccPropList& meta_plist, FileAccPropList& raw_plist, const char* meta_ext, const char* raw_ext ) const
|
||||
{
|
||||
hid_t meta_pid = meta_plist.getId();
|
||||
hid_t raw_pid = raw_plist.getId();
|
||||
herr_t ret_value = H5Pset_split( id, meta_ext, meta_pid, raw_ext, raw_pid );
|
||||
herr_t ret_value = H5Pset_fapl_split( id, meta_ext, meta_pid, raw_ext, raw_pid );
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("FileAccPropList::setSplit", "H5Pset_split failed");
|
||||
{
|
||||
throw PropListIException("FileAccPropList::setSplit", "H5Pset_fapl_split failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setSplit
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It differs from the above function only in what arguments it
|
||||
/// accepts.
|
||||
///\param meta_plist - IN: File access plist for the metadata file
|
||||
///\param raw_plist - IN: File access plist for the raw data file
|
||||
///\param meta_ext - IN: Metadata filename extension as \c string
|
||||
///\param raw_ext - IN: Raw data filename extension as \c string
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setSplit( FileAccPropList& meta_plist, FileAccPropList& raw_plist, const string& meta_ext, const string& raw_ext ) const
|
||||
{
|
||||
setSplit( meta_plist, raw_plist, meta_ext.c_str(), raw_ext.c_str() );
|
||||
}
|
||||
|
||||
void FileAccPropList::getSplit( size_t meta_ext_size, string& meta_ext, FileAccPropList& meta_plist, size_t raw_ext_size, string& raw_ext, FileAccPropList& raw_plist ) const
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::getStream
|
||||
///\brief Retrieves the streaming I/O driver settings
|
||||
///\return The streaming I/O file access property list structure
|
||||
/// For detail on this structure, please refer to
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetFaplStream
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
H5FD_stream_fapl_t FileAccPropList::getStream() const
|
||||
{
|
||||
hid_t meta_plist_id, raw_plist_id; // meta-data and raw-data plist ids
|
||||
char* meta_ext_C = new char[meta_ext_size]; // meta-data extension in C
|
||||
char* raw_ext_C = new char[raw_ext_size]; // raw-data extension in C
|
||||
herr_t ret_value = H5Pget_split( id, meta_ext_size, meta_ext_C,
|
||||
&meta_plist_id, raw_ext_size, raw_ext_C, &raw_plist_id );
|
||||
H5FD_stream_fapl_t fapl;
|
||||
herr_t ret_value = H5Pget_fapl_stream(id, &fapl);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("FileAccPropList::getSplit", "H5Pget_split failed");
|
||||
throw PropListIException("FileAccPropList::getStream", "H5Pget_fapl_stream failed");
|
||||
}
|
||||
meta_plist.setId( meta_plist_id );
|
||||
raw_plist.setId( raw_plist_id );
|
||||
raw_ext = string( raw_ext_C );
|
||||
meta_ext = string( raw_ext_C );
|
||||
delete [] raw_ext_C;
|
||||
delete [] meta_ext_C;
|
||||
return(fapl);
|
||||
}
|
||||
*/
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setStream
|
||||
///\brief Modifies this file access property list to use the Stream
|
||||
/// driver.
|
||||
///\param fapl - IN: The streaming I/O file access property list
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// For detail on \a fapl, please refer to
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetFaplStream
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setStream(H5FD_stream_fapl_t &fapl) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_fapl_stream (id, &fapl);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("FileAccPropList::setStream", "H5Pset_fapl_stream failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::getSieveBufSize
|
||||
///\brief Returns the current settings for the data sieve buffer size
|
||||
/// property from this property list.
|
||||
///\return Data sieve buffer size, in bytes
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
size_t FileAccPropList::getSieveBufSize() const
|
||||
{
|
||||
size_t bufsize;
|
||||
herr_t ret_value = H5Pget_sieve_buf_size(id, &bufsize);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("FileAccPropList::getSieveBufSize", "H5Pget_sieve_buf_size failed");
|
||||
}
|
||||
return(bufsize);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setSieveBufSize
|
||||
///\brief Sets the maximum size of the data sieve buffer.
|
||||
///\param bufsize - IN: Maximum size, in bytes, of data sieve buffer
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// For detail on data sieving, please refer to
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetSieveBufSize
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setSieveBufSize(size_t bufsize) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_sieve_buf_size(id, bufsize);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("FileAccPropList::getSieveBufSize", "H5Pget_sieve_buf_size failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setMetaBlockSize
|
||||
///\brief Sets the minimum size of metadata block allocations.
|
||||
///\param block_size - IN: Minimum size, in bytes, of metadata
|
||||
/// block allocations
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// For more detail, please refer to
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetMetaBlockSize
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setMetaBlockSize(hsize_t &block_size) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_meta_block_size(id, block_size);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("FileAccPropList::setMetaBlockSize", "H5Pset_meta_block_size failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::getMetaBlockSize
|
||||
///\brief Returns the current metadata block size setting.
|
||||
///\return Metadata block size
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
hsize_t FileAccPropList::getMetaBlockSize() const
|
||||
{
|
||||
hsize_t block_size;
|
||||
herr_t ret_value = H5Pget_meta_block_size(id, &block_size);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("FileAccPropList::getMetaBlockSize", "H5Pget_meta_block_size failed");
|
||||
}
|
||||
return(block_size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setLog
|
||||
///\brief Modifies this file access property list to use the logging
|
||||
/// driver.
|
||||
///\param logfile - IN: Name of the log file
|
||||
///\param flags - IN: Flags specifying the types of logging activity
|
||||
///\param buf_size - IN: Size of the logging buffer
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// For detail on \a flags, please refer to
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetFaplStream
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setLog(const char *logfile, unsigned flags, size_t buf_size) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_fapl_log(id, logfile, flags, buf_size);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("FileAccPropList::setLog", "H5Pset_fapl_log failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setLog
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It differs from the above function only in what arguments it
|
||||
/// accepts.
|
||||
///\param logfile - IN: Name of the log file - string
|
||||
///\param flags - IN: Flags specifying the types of logging activity
|
||||
///\param buf_size - IN: Size of the logging buffer
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setLog(const string& logfile, unsigned flags, size_t buf_size) const
|
||||
{
|
||||
setLog(logfile.c_str(), flags, buf_size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setSec2
|
||||
///\brief Modifies this file access property list to use the sec2
|
||||
/// driver.
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setSec2() const
|
||||
{
|
||||
herr_t ret_value = H5Pset_fapl_sec2(id);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("FileAccPropList::setSec2", "H5Pset_fapl_sec2 failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setAlignment
|
||||
///\brief Sets the alignment properties of this property list.
|
||||
///\param threshold - IN: Threshold value for file object size
|
||||
///\param alignment - IN: Alignment value
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// The parameter \a threshold must have a non-negative value.
|
||||
/// Note that setting the threshold value to 0 (zero) has the
|
||||
/// effect of a special case, forcing everything to be aligned.
|
||||
/// The parameter \a alignment must have a positive value.
|
||||
///
|
||||
/// For detail on \a setting alignment, please refer to
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetAlignment
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setAlignment( hsize_t threshold, hsize_t alignment ) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_alignment( id, threshold, alignment );
|
||||
@ -173,7 +470,15 @@ void FileAccPropList::setAlignment( hsize_t threshold, hsize_t alignment ) const
|
||||
}
|
||||
}
|
||||
|
||||
void FileAccPropList::getAlignment( hsize_t& threshold, hsize_t& alignment ) const
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::getAlignment
|
||||
///\brief Returns the current settings for alignment properties from
|
||||
/// this property list.
|
||||
///\param threshold - OUT: Retrieved threshold value for file object size
|
||||
///\param alignment - OUT: Retrieved alignment value
|
||||
///\exception H5::PropListIException
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::getAlignment( hsize_t &threshold, hsize_t &alignment ) const
|
||||
{
|
||||
herr_t ret_value = H5Pget_alignment( id, &threshold, &alignment );
|
||||
if( ret_value < 0 )
|
||||
@ -182,27 +487,62 @@ void FileAccPropList::getAlignment( hsize_t& threshold, hsize_t& alignment ) con
|
||||
}
|
||||
}
|
||||
|
||||
/* MPI_Comm and MPI_Info not declared in serial mode so leave these
|
||||
routines out until C++ API needs to deal with parallel
|
||||
void FileAccPropList::setMpi( MPI_Comm comm, MPI_Info info ) const
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setMultiType
|
||||
///\brief Sets data type for \c MULTI driver.
|
||||
///\param dtype - IN: Type of data
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// More details and valid values for \a dtype can be found at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetMultiType
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setMultiType(H5FD_mem_t dtype) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_mpi( id, comm, info );
|
||||
herr_t ret_value = H5Pset_multi_type(id, dtype);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("FileAccPropList::setMpi", "H5Pset_mpi failed");
|
||||
throw PropListIException("FileAccPropList::setMultiType", "H5Pset_multi_type failed");
|
||||
}
|
||||
}
|
||||
|
||||
void FileAccPropList::getMpi( MPI_Comm& comm, MPI_Info& info ) const
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::getMultiType
|
||||
///\brief Returns the data type property for \c MULTI driver.
|
||||
///\return The data type property
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// More details and possible returned values can be found at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-GetMultiType
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
H5FD_mem_t FileAccPropList::getMultiType() const
|
||||
{
|
||||
herr_t ret_value = H5Pget_mpi( id, &comm, &info );
|
||||
H5FD_mem_t dtype;
|
||||
herr_t ret_value = H5Pget_multi_type(id, &dtype);
|
||||
if( ret_value < 0 )
|
||||
return( false );
|
||||
else
|
||||
return( true );
|
||||
{
|
||||
throw PropListIException("FileAccPropList::getMultiType", "H5Pget_multi_type failed");
|
||||
}
|
||||
return(dtype);
|
||||
}
|
||||
*/
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setCache
|
||||
///\brief Sets the meta data cache and raw data chunk cache parameters.
|
||||
///\param mdc_nelmts - IN: Number of elements in the meta data cache
|
||||
///\param rdcc_nelmts - IN: Number of elements in the raw data chunk cache
|
||||
///\param rdcc_nbytes - IN: Total size of the raw data chunk cache, in bytes
|
||||
///\param rdcc_w0 - IN: Preemption policy
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// The argument \a rdcc_w0 should hold a value between 0 and 1
|
||||
/// inclusive. This value indicates how much chunks that have
|
||||
/// been fully read are favored for preemption. A value of zero
|
||||
/// means fully read chunks are treated no differently than other
|
||||
/// chunks (the preemption is strictly LRU) while a value of one
|
||||
/// means fully read chunks are always preempted before other chunks.
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setCache( int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0 ) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_cache( id, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0 );
|
||||
@ -212,6 +552,15 @@ void FileAccPropList::setCache( int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::getCache
|
||||
///\brief Queries the meta data cache and raw data chunk cache parameters.
|
||||
///\param mdc_nelmts - OUT: Number of elements in the meta data cache
|
||||
///\param rdcc_nelmts - OUT: Number of elements in the raw data chunk cache
|
||||
///\param rdcc_nbytes - OUT: Total size of the raw data chunk cache, in bytes
|
||||
///\param rdcc_w0 - OUT: Preemption policy
|
||||
///\exception H5::PropListIException
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::getCache( int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0 ) const
|
||||
{
|
||||
herr_t ret_value = H5Pget_cache( id, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0 );
|
||||
@ -221,6 +570,50 @@ void FileAccPropList::getCache( int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rd
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setFcloseDegree
|
||||
///\brief Sets the degree for the file close behavior.
|
||||
///\param degree - IN:
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setFcloseDegree(H5F_close_degree_t degree)
|
||||
{
|
||||
herr_t ret_value = H5Pset_fclose_degree(id, degree);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("FileAccPropList::setFcloseDegree", "H5Pset_fclose_degree failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::getFcloseDegree
|
||||
///\brief Returns the degree for the file close behavior.
|
||||
///\return The degree for the file close behavior
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
H5F_close_degree_t FileAccPropList::getFcloseDegree()
|
||||
{
|
||||
H5F_close_degree_t degree;
|
||||
herr_t ret_value = H5Pget_fclose_degree(id, °ree);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("FileAccPropList::getFcloseDegree", "H5Pget_fclose_degree failed");
|
||||
}
|
||||
return(degree);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setGcReferences
|
||||
///\brief Sets garbage collecting references flag.
|
||||
///\param gc_ref - IN: Flag setting reference garbage collection to
|
||||
/// on (1) or off (0).
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// For detail on \a fapl, please refer to
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetFaplStream
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setGcReferences( unsigned gc_ref ) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_gc_references( id, gc_ref );
|
||||
@ -230,6 +623,12 @@ void FileAccPropList::setGcReferences( unsigned gc_ref ) const
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::getGcReferences
|
||||
///\brief Returns the garbage collecting references setting.
|
||||
///\return Garbage collecting references setting, 0 (off) or 1 (on)
|
||||
///\exception H5::PropListIException
|
||||
//--------------------------------------------------------------------------
|
||||
unsigned FileAccPropList::getGcReferences() const
|
||||
{
|
||||
unsigned gc_ref;
|
||||
|
@ -29,75 +29,93 @@ class H5_DLLCPP FileAccPropList : public PropList {
|
||||
FileAccPropList();
|
||||
|
||||
// Copy constructor: creates a copy of a FileAccPropList object
|
||||
FileAccPropList( const FileAccPropList& orig );
|
||||
FileAccPropList( const FileAccPropList& original );
|
||||
|
||||
// Sets the low level file driver to use the functions
|
||||
// declared in the stdio.h
|
||||
// void setStdio() const;
|
||||
// Modifies this property list to use the H5FD_STDIO driver
|
||||
void setStdio() const;
|
||||
|
||||
// Determines whether the file access property list is set to the
|
||||
// stdio driver.
|
||||
// bool getStdio() const;
|
||||
// Set file driver for this property list
|
||||
void setDriver(hid_t new_driver_id, const void *new_driver_info) const;
|
||||
|
||||
// Returns a low-level file driver identifier.
|
||||
hid_t getDriver() const;
|
||||
|
||||
// Sets offset for family driver.
|
||||
void setFamilyOffset(hsize_t offset) const;
|
||||
|
||||
// Gets offset for family driver.
|
||||
hsize_t getFamilyOffset() const;
|
||||
|
||||
// Modifies this file access property list to use the sec2 driver.
|
||||
void setSec2() const;
|
||||
|
||||
// Modifies this file access property list to use the H5FD_CORE
|
||||
// driver.
|
||||
void setCore (size_t increment, hbool_t backing_store) const;
|
||||
|
||||
// Queries H5FD_CORE driver properties.
|
||||
void getCore (size_t& increment, hbool_t& backing_store) const;
|
||||
|
||||
// Sets this file access properties list to the family driver.
|
||||
void setFamily( hsize_t memb_size, const FileAccPropList& memb_plist ) const;
|
||||
|
||||
// Returns information about the family file access property list.
|
||||
void getFamily(hsize_t& memb_size, FileAccPropList& memb_plist) const;
|
||||
FileAccPropList getFamily(hsize_t& memb_size) const;
|
||||
|
||||
// Emulates the old split file driver,
|
||||
void setSplit( FileAccPropList& meta_plist, FileAccPropList& raw_plist,
|
||||
const char* meta_ext = ".meta", const char* raw_ext = ".raw" ) const;
|
||||
void setSplit( FileAccPropList& meta_plist, FileAccPropList& raw_plist,
|
||||
const string& meta_ext, const string& raw_ext ) const;
|
||||
|
||||
// Modifies this file access property list to use the Stream driver.
|
||||
void setStream(H5FD_stream_fapl_t &fapl) const;
|
||||
|
||||
// Retrieves the streaming I/O driver settings
|
||||
H5FD_stream_fapl_t getStream() const;
|
||||
|
||||
// Sets the maximum size of the data sieve buffer.
|
||||
void setSieveBufSize(size_t bufsize) const;
|
||||
|
||||
// Returns the current settings for the data sieve buffer size
|
||||
// property
|
||||
size_t getSieveBufSize() const;
|
||||
|
||||
// Sets the minimum size of metadata block allocations.
|
||||
void setMetaBlockSize(hsize_t &block_size) const;
|
||||
|
||||
// Returns the current metadata block size setting.
|
||||
hsize_t getMetaBlockSize() const;
|
||||
|
||||
// Modifies this file access property list to use the logging driver.
|
||||
void setLog(const char *logfile, unsigned flags, size_t buf_size) const;
|
||||
void setLog(const string& logfile, unsigned flags, size_t buf_size) const;
|
||||
|
||||
// Sets alignment properties of this file access property list
|
||||
void setAlignment( hsize_t threshold = 1, hsize_t alignment = 1 ) const;
|
||||
|
||||
// Retrieves the current settings for alignment properties from
|
||||
// this file access property list.
|
||||
// this property list.
|
||||
void getAlignment( hsize_t& threshold, hsize_t& alignment ) const;
|
||||
|
||||
/* MPI stuff not working in serial mode
|
||||
//void setMpi( MPI_Comm comm, MPI_Info info ) const;
|
||||
//void getMpi( MPI_Comm& comm, MPI_Info& info ) const;
|
||||
*/
|
||||
// Sets data type for multi driver.
|
||||
void setMultiType(H5FD_mem_t dtype) const;
|
||||
|
||||
// Returns a low-level file driver identifier.
|
||||
// H5F_driver_t getDriver() const;
|
||||
|
||||
// Sets the low-level file driver to use the declared functions.
|
||||
// void setSec2() const;
|
||||
|
||||
// Determines whether this file access property list is set to the
|
||||
// sec2 driver.
|
||||
// bool getSec2() const;
|
||||
|
||||
// Sets the low-level file driver to use malloc() and free().
|
||||
// void setCore( size_t increment ) const;
|
||||
|
||||
// Determines whether this file access property list is set to the
|
||||
// core driver and retrieves the increment.
|
||||
// bool getCore( size_t& increment ) const;
|
||||
|
||||
// Sets this file access properties list to the family driver.
|
||||
// void setFamily( hsize_t memb_size, const FileAccPropList& memb_plist ) const;
|
||||
|
||||
// Determines whether this file access property list is set to the
|
||||
// family driver and retrieves the member's file access property list.
|
||||
// bool getFamily( hsize_t& memb_size, FileAccPropList& memb_plist ) const;
|
||||
// Returns the data type property for MULTI driver.
|
||||
H5FD_mem_t getMultiType() const;
|
||||
|
||||
// Sets the meta data cache and raw data chunk cache parameters.
|
||||
void setCache( int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0 ) const;
|
||||
|
||||
// Retrieves maximum sizes of data caches and the preemption
|
||||
// policy value.
|
||||
// Queries the meta data cache and raw data chunk cache parameters.
|
||||
void getCache( int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0 ) const;
|
||||
|
||||
// Sets the low-level driver to split meta data from raw data.
|
||||
// void setSplit( FileAccPropList& meta_plist, FileAccPropList& raw_plist,
|
||||
// const char* meta_ext = ".meta", const char* raw_ext = ".raw" ) const;
|
||||
// Sets the degree for the file close behavior.
|
||||
void setFcloseDegree(H5F_close_degree_t degree);
|
||||
|
||||
// void setSplit( FileAccPropList& meta_plist, FileAccPropList& raw_plist,
|
||||
// const string& meta_ext, const string& raw_ext ) const;
|
||||
|
||||
// Determines whether this file access property list is set to the
|
||||
// split driver and retrieves the meta-data and raw-data property lists.
|
||||
// void getSplit( size_t meta_ext_size, string& meta_ext, FileAccPropList&
|
||||
// meta_plist, size_t raw_ext_size, string& raw_ext, FileAccPropList&
|
||||
// raw_plist ) const;
|
||||
|
||||
// Proposal: 2 separate functions
|
||||
//FileAccPropList getMetaPlist( size_t meta_ext_size, char* meta_ext );
|
||||
//FileAccPropList getRawPlist( size_t raw_ext_size, char* raw_ext );
|
||||
// Returns the degree for the file close behavior.
|
||||
H5F_close_degree_t getFcloseDegree();
|
||||
|
||||
// Sets garbage collecting references flag.
|
||||
void setGcReferences( unsigned gc_ref = 0 ) const;
|
||||
|
@ -32,21 +32,34 @@ namespace H5 {
|
||||
|
||||
const PropList PropList::DEFAULT( H5P_DEFAULT );
|
||||
|
||||
// Default constructor - set id to 0 by default here but may be set
|
||||
// to a valid one, if any, by a subclass constructor.
|
||||
//--------------------------------------------------------------------------
|
||||
// Function Default constructor
|
||||
///\brief Default constructor - Creates a stub property list object.
|
||||
///\par Description
|
||||
/// The id of this property list is set to 0.
|
||||
//--------------------------------------------------------------------------
|
||||
PropList::PropList() : IdComponent( 0 ) {}
|
||||
|
||||
// Copy constructor: makes a copy of the original object
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList copy constructor
|
||||
///\brief Copy constructor
|
||||
///\param original - IN: The original property list to copy
|
||||
//--------------------------------------------------------------------------
|
||||
PropList::PropList( const PropList& original ) : IdComponent( original ) {}
|
||||
|
||||
/* Constructor that takes an existing property list id.
|
||||
Description:
|
||||
Uses an HDF5 id to create a PropList identifier object. This id
|
||||
can be either an existing property list id or a default property
|
||||
list id. Design note: in the case of default property list,
|
||||
the identifier still has reference counter; the p_close function
|
||||
will take care of not to call H5Pclose on the default id.
|
||||
*/
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList overloaded constructor
|
||||
///\brief Creates a property list using the id of an existing property.
|
||||
///\param plist_id - IN: Id of the existing property list
|
||||
///\exception H5::PropListIException
|
||||
// Description
|
||||
// This function calls H5Pcreate to create a new property list
|
||||
// if the given id, plist_id, is that of a property class. If
|
||||
// the given id is equal to H5P_NO_CLASS, then set this
|
||||
// property's id to H5P_DEFAULT, otherwise, to the given id.
|
||||
// Note: someone else added this code without comments and this
|
||||
// description was what I came up with from reading the code.
|
||||
//--------------------------------------------------------------------------
|
||||
PropList::PropList( const hid_t plist_id ) : IdComponent(0)
|
||||
{
|
||||
if (H5I_GENPROP_CLS == H5Iget_type(plist_id)) {
|
||||
@ -65,7 +78,12 @@ PropList::PropList( const hid_t plist_id ) : IdComponent(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Makes a copy of an existing property list
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::copy
|
||||
///\brief Makes a copy of an existing property list
|
||||
///\param like_plist - IN: Reference to the existing property list
|
||||
///\exception H5::PropListIException
|
||||
//--------------------------------------------------------------------------
|
||||
void PropList::copy( const PropList& like_plist )
|
||||
{
|
||||
// reset the identifier of this PropList - send 'this' in so that
|
||||
@ -88,22 +106,29 @@ void PropList::copy( const PropList& like_plist )
|
||||
}
|
||||
}
|
||||
|
||||
// Makes a copy of the property list on the right hand side and stores
|
||||
// the new id in the left hand side object.
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::operator=
|
||||
///\brief Assignment operator
|
||||
///\param rhs - IN: Reference to the existing property list
|
||||
///
|
||||
// Description
|
||||
// Makes a copy of the property list on the right hand side
|
||||
// and stores the new id in the left hand side object.
|
||||
//--------------------------------------------------------------------------
|
||||
PropList& PropList::operator=( const PropList& rhs )
|
||||
{
|
||||
copy(rhs);
|
||||
return(*this);
|
||||
}
|
||||
|
||||
// Copies a property from one list or class to another
|
||||
void PropList::copyProp( PropList& dest, PropList& src, const string& name )
|
||||
{
|
||||
copyProp( dest, src, name.c_str());
|
||||
}
|
||||
|
||||
// Copies a property from one list or class to another
|
||||
void PropList::copyProp( PropList& dest, PropList& src, const char *name )
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::copyProp
|
||||
///\brief Copies a property from one list or class to another
|
||||
///\param dest - IN: Destination property list or class
|
||||
///\param src - IN: Source property list or class
|
||||
///\param name - IN: Name of the property to copy - \c char pointer
|
||||
//--------------------------------------------------------------------------
|
||||
void PropList::copyProp( PropList& dest, PropList& src, const char *name ) const
|
||||
{
|
||||
hid_t dst_id = dest.getId();
|
||||
hid_t src_id = src.getId();
|
||||
@ -115,7 +140,29 @@ void PropList::copyProp( PropList& dest, PropList& src, const char *name )
|
||||
|
||||
}
|
||||
|
||||
// Closes the property list if it is not a default one
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::copyProp
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It differs from the above function only in what arguments it
|
||||
/// accepts.
|
||||
///\param dest - IN: Destination property list or class
|
||||
///\param src - IN: Source property list or class
|
||||
///\param name - IN: Name of the property to copy - \c std::string
|
||||
//--------------------------------------------------------------------------
|
||||
void PropList::copyProp( PropList& dest, PropList& src, const string& name ) const
|
||||
{
|
||||
copyProp( dest, src, name.c_str());
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::p_close
|
||||
///\brief Closes the property list if it is not a default one
|
||||
///\note
|
||||
/// This function will be obsolete because its functionality is recently
|
||||
/// handled by the C library layer.
|
||||
///\exception H5::PropListIException
|
||||
//--------------------------------------------------------------------------
|
||||
void PropList::p_close() const
|
||||
{
|
||||
if( id != H5P_NO_CLASS ) // not a constant, should call H5Pclose
|
||||
@ -128,7 +175,12 @@ void PropList::p_close() const
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the class of this property list, i.e. H5P_FILE_CREATE...
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::getClass
|
||||
///\brief Returns the class of this property list, i.e. \c H5P_FILE_CREATE...
|
||||
///\return The property list class if it is not equal to \c H5P_NO_CLASS
|
||||
///\exception H5::PropListIException
|
||||
//--------------------------------------------------------------------------
|
||||
hid_t PropList::getClass() const
|
||||
{
|
||||
hid_t plist_class = H5Pget_class( id );
|
||||
@ -140,6 +192,379 @@ hid_t PropList::getClass() const
|
||||
return( plist_class );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::propExist
|
||||
///\brief Query the existance of a property in a property object.
|
||||
///\param name - IN: Name of property to check for - \c char pointer
|
||||
///\return true if the property exists in the property object, and
|
||||
/// false, otherwise.
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// This routine checks if a property exists within a property
|
||||
/// list or class.
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
bool PropList::propExist(const char* name ) const
|
||||
{
|
||||
// Calls C routine H5Pexist to determine whether a property exists
|
||||
// within a property list or class. It returns a positive value, 0,
|
||||
// or a negative value
|
||||
htri_t ret_value = H5Pexist(id, name);
|
||||
if( ret_value > 0 )
|
||||
return true;
|
||||
else if( ret_value == 0 )
|
||||
return false;
|
||||
else // Raise exception when H5Pexist returns a negative value
|
||||
{
|
||||
throw PropListIException("PropList::propExist", "H5Pexist failed");
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::propExist
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It differs from the above function only in what arguments it
|
||||
/// accepts.
|
||||
///\param name - IN: Name of property to check for - \c std::string
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
bool PropList::propExist(const string& name ) const
|
||||
{
|
||||
return( propExist( name.c_str()) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::closeClass
|
||||
///\brief Close a property list class.
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// Releases memory and de-attaches a class from the property
|
||||
/// list class hierarchy.
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void PropList::closeClass() const
|
||||
{
|
||||
herr_t ret_value = H5Pclose_class(id);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("PropList::closeClass", "H5Pclose_class failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::getProperty
|
||||
///\brief Query the value of a property in a property list.
|
||||
///\param name - IN: Name of property to query - \c char pointer
|
||||
///\param value - OUT: Pointer to the buffer for the property value
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// Retrieves a copy of the value for a property in a property list. The
|
||||
/// property name must exist or this routine will throw an exception.
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void PropList::getProperty(const char* name, void* value) const
|
||||
{
|
||||
herr_t ret_value = H5Pget(id, name, value);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("PropList::getProperty", "H5Pget failed");
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::getProperty
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It differs from the above function only in what arguments it
|
||||
/// accepts.
|
||||
///\param name - IN: Name of property to query - \c char pointer
|
||||
///\return The property that is a \c std::string.
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
string PropList::getProperty(const char* name) const
|
||||
{
|
||||
size_t size = getPropSize(name);
|
||||
char* prop_strg_C = new char[size+1]; // temporary C-string for C API
|
||||
herr_t ret_value = H5Pget(id, name, prop_strg_C); // call C API
|
||||
|
||||
// Throw exception if H5Pget returns failure
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("PropList::getProperty", "H5Pget failed");
|
||||
}
|
||||
|
||||
// Return propety value as a string after deleting temp C-string
|
||||
string prop_strg = string(prop_strg_C);
|
||||
delete prop_strg_C;
|
||||
return (prop_strg);
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::getProperty
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It differs from the above function only in what arguments it
|
||||
/// accepts.
|
||||
///\param name - IN: Name of property to query - \c str::string
|
||||
///\param value - OUT: Pointer to the buffer for the property value
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void PropList::getProperty(const string& name, void* value) const
|
||||
{
|
||||
getProperty(name.c_str(), value);
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::getProperty
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It differs from the above function only in what arguments it
|
||||
/// accepts.
|
||||
///\param name - IN: Name of property to query - \c std::string
|
||||
///\return The property that is a \c std::string.
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
string PropList::getProperty(const string& name) const
|
||||
{
|
||||
return (getProperty(name.c_str()));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::getPropSize
|
||||
///\brief Query the size of a property in a property list or class.
|
||||
///\param name - IN: Name of property to query
|
||||
///\return Size of the property
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// This routine retrieves the size of a property's value
|
||||
/// in bytes. Zero-sized properties are allowed and the return
|
||||
/// value will be of 0. This function works for both property
|
||||
/// lists and classes.
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
size_t PropList::getPropSize(const char *name) const
|
||||
{
|
||||
size_t prop_size;
|
||||
herr_t ret_value = H5Pget_size(id, name, &prop_size);
|
||||
if (prop_size < 0)
|
||||
{
|
||||
throw PropListIException("PropList::getPropSize", "H5Pget_size failed");
|
||||
}
|
||||
return(prop_size);
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::getPropSize
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It differs from the above function only in what arguments it
|
||||
/// accepts.
|
||||
///\param name - IN: Name of property to query - \c std::string
|
||||
///
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
size_t PropList::getPropSize(const string& name) const
|
||||
{
|
||||
return (getPropSize(name.c_str()));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::getClassName
|
||||
///\brief Return the name of a generic property list class
|
||||
///\return A string containing the class name, if success, otherwise,
|
||||
/// a NULL string.
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
string PropList::getClassName() const
|
||||
{
|
||||
char* temp_str;
|
||||
temp_str = H5Pget_class_name(id);
|
||||
|
||||
if (temp_str != NULL)
|
||||
{
|
||||
string class_name = string(temp_str);
|
||||
free(temp_str);
|
||||
return(class_name);
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::getNumProps
|
||||
///\brief Returns the number of properties in this property list or class.
|
||||
///\return Size of the property.
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
size_t PropList::getNumProps() const
|
||||
{
|
||||
size_t nprops;
|
||||
herr_t ret_value = H5Pget_nprops (id, &nprops);
|
||||
if( nprops < 0 )
|
||||
{
|
||||
throw PropListIException("PropList::getNumProps", "H5Pget_nprops failed");
|
||||
}
|
||||
return (nprops);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::setProperty
|
||||
///\brief Set a property's value in a property list.
|
||||
///\param name - IN: Name of property to set - \c char pointer
|
||||
///\param value - IN: Void pointer to the value for the property
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void PropList::setProperty(const char* name, void* value) const
|
||||
{
|
||||
herr_t ret_value = H5Pset(id, name, value);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("PropList::setProperty", "H5Pset failed");
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::setProperty
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It differs from the above function only in what arguments it
|
||||
/// accepts.
|
||||
///\param name - IN: Name of property to set - \c char pointer
|
||||
///\param charptr - IN: Char pointer to the value for the property
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void PropList::setProperty(const char* name, const char* charptr) const
|
||||
{
|
||||
herr_t ret_value = H5Pset(id, name, (void*) charptr);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("PropList::setProperty", "H5Pset failed");
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::setProperty
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It differs from the above function only in what arguments it
|
||||
/// accepts.
|
||||
///\param name - IN: Name of property to set - \c char pointer
|
||||
///\param strg - IN: Value for the property is a \c std::string
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void PropList::setProperty(const char* name, string& strg) const
|
||||
{
|
||||
setProperty(name, strg.c_str());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::setProperty
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It differs from the above function only in what arguments it
|
||||
/// accepts.
|
||||
///\param name - IN: Name of property to set - \c std::string
|
||||
///\param value - IN: Void pointer to the value for the property
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void PropList::setProperty(const string& name, void* value) const
|
||||
{
|
||||
setProperty(name.c_str(), value);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::setProperty
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It differs from the above function only in what arguments it
|
||||
/// accepts.
|
||||
///\param name - IN: Name of property to set - \c std::string
|
||||
///\param strg - IN: Value for the property is a \c std::string
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void PropList::setProperty(const string& name, string& strg) const
|
||||
{
|
||||
setProperty(name.c_str(), strg.c_str());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::isAClass
|
||||
///\brief Determines whether a property list is a certain class
|
||||
///\param prop_class - IN: Property class to query
|
||||
///\return true if the property list is a member of the property list
|
||||
/// class, and false, otherwise.
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
bool PropList::isAClass(const PropList& prop_class) const
|
||||
{
|
||||
htri_t ret_value = H5Pisa_class(id, prop_class.getId());
|
||||
if( ret_value > 0 )
|
||||
return true;
|
||||
else if( ret_value == 0 )
|
||||
return false;
|
||||
else // Raise exception when H5Pisa_class returns a negative value
|
||||
{
|
||||
throw PropListIException("PropList::isAClass", "H5Pisa_class failed");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::removeProp
|
||||
///\brief Removes a property from a property list
|
||||
///\param name - IN: Name of property to remove - \c char pointer
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void PropList::removeProp(const char *name) const
|
||||
{
|
||||
herr_t ret_value = H5Premove(id, name);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("PropList::removeProp", "H5Premove failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::removeProp
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It differs from the above function only in what arguments it
|
||||
/// accepts.
|
||||
///\param name - IN: Name of property to remove - \c std::string
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void PropList::removeProp(const string& name) const
|
||||
{
|
||||
removeProp(name.c_str());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::operator==
|
||||
///\brief Compares this property list or class against the given list or class.
|
||||
///\param rhs - IN: Reference to the property list to compare
|
||||
///\return true if the property lists or classes are equal, and
|
||||
/// false, otherwise.
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
bool PropList::operator==(const PropList& rhs) const
|
||||
{
|
||||
htri_t ret_value = H5Pequal(id, rhs.getId());
|
||||
if( ret_value > 0 )
|
||||
return true;
|
||||
else if( ret_value == 0 )
|
||||
return false;
|
||||
else // Raise exception when H5Pequal returns a negative value
|
||||
{
|
||||
throw PropListIException("PropList::operator==", "H5Pequal failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropList::getClassParent
|
||||
///\brief Returns the parent class of a generic property class
|
||||
///\return The parent class of a property class
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
PropList PropList::getClassParent() const
|
||||
{
|
||||
hid_t class_id = H5Pget_class_parent(id);
|
||||
if (class_id <= 0)
|
||||
{
|
||||
throw PropListIException("PropList::getClassParent", "H5Pget_class_parent failed");
|
||||
}
|
||||
PropList pclass(class_id);
|
||||
return(pclass);
|
||||
}
|
||||
|
||||
// The destructor of this instance calls the template resetIdComponent to
|
||||
// reset its identifier
|
||||
PropList::~PropList()
|
||||
|
@ -43,13 +43,46 @@ class H5_DLLCPP PropList : public IdComponent {
|
||||
PropList& operator=( const PropList& rhs );
|
||||
|
||||
// Copies a property from one property list or property class to another
|
||||
void copyProp( PropList& dest, PropList& src, const string& name);
|
||||
void copyProp( PropList& dest, PropList& src, const char* name);
|
||||
void copyProp( PropList& dest, PropList& src, const string& name) const;
|
||||
void copyProp( PropList& dest, PropList& src, const char* name) const;
|
||||
|
||||
// Gets the class of this property list, i.e. H5P_FILE_CREATE,
|
||||
// H5P_FILE_ACCESS, ...
|
||||
hid_t getClass() const;
|
||||
|
||||
/// Query the existance of a property in a property object.
|
||||
bool propExist(const char* name) const;
|
||||
bool propExist(const string& name) const;
|
||||
|
||||
void closeClass() const;
|
||||
|
||||
void getProperty(const char* name, void* value) const;
|
||||
string getProperty(const char* name) const;
|
||||
void getProperty(const string& name, void* value) const;
|
||||
string getProperty(const string& name) const;
|
||||
|
||||
size_t getPropSize(const char *name) const;
|
||||
size_t getPropSize(const string& name) const;
|
||||
|
||||
string getClassName() const;
|
||||
|
||||
size_t getNumProps() const;
|
||||
|
||||
void setProperty(const char* name, void* charptr) const;
|
||||
void setProperty(const char* name, const char* value) const;
|
||||
void setProperty(const char* name, string& strg) const;
|
||||
void setProperty(const string& name, void* value) const;
|
||||
void setProperty(const string& name, string& strg) const;
|
||||
|
||||
bool isAClass(const PropList& prop_class) const;
|
||||
|
||||
void removeProp(const char *name) const;
|
||||
void removeProp(const string& name) const;
|
||||
|
||||
bool operator==(const PropList& rhs) const;
|
||||
|
||||
PropList getClassParent() const;
|
||||
|
||||
// Used by the API to close the property list
|
||||
void p_close() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user