diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2004-07-31 04:54:08 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2004-07-31 04:54:08 (GMT) |
commit | fddc43caad965b3cfef964ba02195d211d51669e (patch) | |
tree | 9f88cbfe03f70b0f9df981da9ae71b5557665227 | |
parent | e8671d70c3bf755472c54d9740c694757bb5749e (diff) | |
download | hdf5-fddc43caad965b3cfef964ba02195d211d51669e.zip hdf5-fddc43caad965b3cfef964ba02195d211d51669e.tar.gz hdf5-fddc43caad965b3cfef964ba02195d211d51669e.tar.bz2 |
[svn-r8973] Purpose: Updated documentation
Description:
Updated various function headers for the RM as reviewing progresses.
Rearranged functions in header files for more sensible look of the RM.
Platforms tested:
SunOS 5.7 (arabica)
Linux 2.4 (verbena)
43 files changed, 801 insertions, 658 deletions
diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h index 6e54588..13c2309 100644 --- a/c++/src/H5AbstractDs.h +++ b/c++/src/H5AbstractDs.h @@ -26,13 +26,6 @@ namespace H5 { #endif class H5_DLLCPP AbstractDs : public H5Object { public: - // Gets the dataspace of this abstract dataset - pure virtual - virtual DataSpace getSpace() const = 0; - - // Gets the class of the datatype that is used by this abstract - // dataset - H5T_class_t getTypeClass() const; - // Gets a copy the datatype of that this abstract dataset uses. // Note that this datatype is a generic one and can only be accessed // via generic member functions, i.e., member functions belong @@ -47,6 +40,13 @@ class H5_DLLCPP AbstractDs : public H5Object { FloatType getFloatType() const; StrType getStrType() const; + // Gets the dataspace of this abstract dataset - pure virtual + virtual DataSpace getSpace() const = 0; + + // Gets the class of the datatype that is used by this abstract + // dataset + H5T_class_t getTypeClass() const; + // Copy constructor AbstractDs( const AbstractDs& original ); diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp index 993b1ca..0d84bd4 100644 --- a/c++/src/H5AtomType.cpp +++ b/c++/src/H5AtomType.cpp @@ -29,21 +29,23 @@ namespace H5 { #endif +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- -// Function: AtomType default constructor -///\brief Default constructor: Creates a stub datatype +// Function: AtomType default constructor [protected] +// Purpose Default constructor: creates a stub atomic datatype. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- AtomType::AtomType() : DataType() {} //-------------------------------------------------------------------------- -// Function: AtomType overloaded constructor -///\brief Creates an AtomType object using an existing id. -///\param existing_id - IN: Id of an existing datatype -///\exception H5::DataTypeIException +// Function: AtomType overloaded constructor [protected] +// Purpose Creates an AtomType object using an existing id. +// Parameter existing_id - IN: Id of an existing datatype +// Exception H5::DataTypeIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- AtomType::AtomType( const hid_t existing_id ) : DataType( existing_id ) {} +#endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: AtomType copy constructor diff --git a/c++/src/H5AtomType.h b/c++/src/H5AtomType.h index bb20bd3..e1b1eb9 100644 --- a/c++/src/H5AtomType.h +++ b/c++/src/H5AtomType.h @@ -26,21 +26,12 @@ namespace H5 { #endif class H5_DLLCPP AtomType : public DataType { public: - // Sets the total size for an atomic datatype. - void setSize( size_t size ) const; - // Returns the byte order of an atomic datatype. H5T_order_t getOrder( string& order_string ) const; // Sets the byte ordering of an atomic datatype. void setOrder( H5T_order_t order ) const; - // Returns the precision of an atomic datatype. - size_t getPrecision() const; - - // Sets the precision of an atomic datatype. - void setPrecision( size_t precision ) const; - // Retrieves the bit offset of the first significant bit. // 12/05/00 - changed return type to int from size_t - C API int getOffset() const; @@ -54,6 +45,15 @@ class H5_DLLCPP AtomType : public DataType { // Sets the least and most-significant bits padding types void setPad( H5T_pad_t lsb, H5T_pad_t msb ) const; + // Returns the precision of an atomic datatype. + size_t getPrecision() const; + + // Sets the precision of an atomic datatype. + void setPrecision( size_t precision ) const; + + // Sets the total size for an atomic datatype. + void setSize( size_t size ) const; + // Copy constructor - makes copy of the original object AtomType( const AtomType& original ); @@ -61,11 +61,13 @@ class H5_DLLCPP AtomType : public DataType { virtual ~AtomType(); protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Default constructor AtomType(); // Constructor that takes an existing id AtomType( const hid_t existing_id ); +#endif // DOXYGEN_SHOULD_SKIP_THIS }; #ifndef H5_NO_NAMESPACE } diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h index 8c15227..b18a6f0 100644 --- a/c++/src/H5Attribute.h +++ b/c++/src/H5Attribute.h @@ -22,29 +22,21 @@ namespace H5 { class H5_DLLCPP Attribute : public AbstractDs { public: - // Writes data to this attribute. - void write(const DataType& mem_type, const void *buf ) const; - void write(const DataType& mem_type, const string& strg ) const; - - // Reads data from this attribute. - void read( const DataType& mem_type, void *buf ) const; - void read( const DataType& mem_type, string& strg ) const; - - // Gets a copy of the dataspace for this attribute. - virtual DataSpace getSpace() const; - // Gets the name of this attribute. ssize_t getName( size_t buf_size, string& attr_name ) const; string getName( size_t buf_size ) const; // returns name, not its length string getName() const; // returns name, no argument - // do not inherit iterateAttrs from H5Object - int iterateAttrs() { return 0; } + // Gets a copy of the dataspace for this attribute. + virtual DataSpace getSpace() const; -#ifndef DOXYGEN_SHOULD_SKIP_THIS - // Used by the API to appropriately close an attribute - virtual void p_close() const; -#endif // DOXYGEN_SHOULD_SKIP_THIS + // Reads data from this attribute. + void read( const DataType& mem_type, void *buf ) const; + void read( const DataType& mem_type, string& strg ) const; + + // Writes data to this attribute. + void write(const DataType& mem_type, const void *buf ) const; + void write(const DataType& mem_type, const string& strg ) const; // Creates a copy of an existing attribute using the attribute id Attribute( const hid_t attr_id ); @@ -52,6 +44,12 @@ class H5_DLLCPP Attribute : public AbstractDs { // Copy constructor: makes a copy of an existing Attribute object. Attribute( const Attribute& original ); +#ifndef DOXYGEN_SHOULD_SKIP_THIS + // Used by the API to appropriately close an attribute + virtual void p_close() const; +#endif // DOXYGEN_SHOULD_SKIP_THIS + + // Destructor: properly terminates access to this attribute. virtual ~Attribute(); private: @@ -61,6 +59,9 @@ class H5_DLLCPP Attribute : public AbstractDs { // sub-types virtual hid_t p_get_type() const; + // do not inherit iterateAttrs from H5Object + int iterateAttrs() { return 0; } + // Default constructor Attribute(); }; diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h index cde7c89..1ede66b 100644 --- a/c++/src/H5CommonFG.h +++ b/c++/src/H5CommonFG.h @@ -28,11 +28,13 @@ class Group; class H5File; class H5_DLLCPP CommonFG { public: - // Creates a new group at this location which can be a file or another group. + // Creates a new group at this location which can be a file + // or another group. Group createGroup(const char* name, size_t size_hint = 0) const; Group createGroup(const string& name, size_t size_hint = 0) const; - // Opens an existing group in a location which can be a file or another group. + // Opens an existing group in a location which can be a file + // or another group. Group openGroup(const char* name) const; Group openGroup(const string& name) const; @@ -44,38 +46,48 @@ class H5_DLLCPP CommonFG { DataSet openDataSet(const char* name) const; DataSet openDataSet(const string& name) const; - // Creates a link of the specified type from new_name to current_name; - // both names are interpreted relative to the specified location id. - void link(H5G_link_t link_type, const char* curr_name, const char* new_name) const; - void link(H5G_link_t link_type, const string& curr_name, const string& new_name) const; + // Retrieves comment for the HDF5 object specified by its name. + string getComment(const char* name, size_t bufsize) const; + string getComment(const string& name, size_t bufsize) const; - // Removes the specified name at this location. - void unlink(const char* name) const; - void unlink(const string& name) const; + // Sets the comment for an HDF5 object specified by its name. + void setComment(const char* name, const char* comment) const; + void setComment(const string& name, const string& comment) const; - /// For subclasses to return the correct object id, i.e. file or group id. - virtual hid_t getLocId() const = 0; + // Returns the name of the HDF5 object that the symbolic link points to. + string getLinkval(const char* name, size_t size) const; + string getLinkval(const string& name, size_t size) const; - // Renames an object at this location. - void move(const char* src, const char* dst) const; - void move(const string& src, const string& dst) const; + // Returns the number of objects in this group. + hsize_t getNumObjs() const; // Returns information about an HDF5 object, given by its name, // at this location. void getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const; void getObjinfo(const string& name, hbool_t follow_link, H5G_stat_t& statbuf) const; - // Returns the name of the HDF5 object that the symbolic link points to. - string getLinkval(const char* name, size_t size) const; - string getLinkval(const string& name, size_t size) const; + // Retrieves the name of an object in this group, given the + // object's index. + ssize_t getObjnameByIdx(hsize_t idx, string& name, size_t size) const; - // Sets the comment for an HDF5 object specified by its name. - void setComment(const char* name, const char* comment) const; - void setComment(const string& name, const string& comment) const; + // Returns the type of an object in this group, given the + // object's index. + H5G_obj_t getObjTypeByIdx(hsize_t idx) const; + H5G_obj_t getObjTypeByIdx(hsize_t idx, string& type_name) const; - // Retrieves comment for the HDF5 object specified by its name. - string getComment(const char* name, size_t bufsize) const; - string getComment(const string& name, size_t bufsize) const; + // Iterates over the elements of this group - not implemented in + // C++ style yet. + int iterateElems(const char* name, int *idx, H5G_iterate_t op, void *op_data); + int iterateElems(const string& name, int *idx, H5G_iterate_t op, void *op_data); + + // Creates a link of the specified type from new_name to current_name; + // both names are interpreted relative to the specified location id. + void link(H5G_link_t link_type, const char* curr_name, const char* new_name) const; + void link(H5G_link_t link_type, const string& curr_name, const string& new_name) const; + + // Removes the specified name at this location. + void unlink(const char* name) const; + void unlink(const string& name) const; // Mounts the file 'child' onto this location. void mount(const char* name, H5File& child, PropList& plist) const; @@ -85,10 +97,9 @@ class H5_DLLCPP CommonFG { void unmount(const char* name) const; void unmount(const string& name) const; - // Iterates over the elements of this group - not implemented in - // C++ style yet. - int iterateElems(const char* name, int *idx, H5G_iterate_t op, void *op_data); - int iterateElems(const string& name, int *idx, H5G_iterate_t op, void *op_data); + // Renames an object at this location. + void move(const char* src, const char* dst) const; + void move(const string& src, const string& dst) const; // Opens a generic named datatype in this location. DataType openDataType(const char* name) const; @@ -114,19 +125,11 @@ class H5_DLLCPP CommonFG { StrType openStrType(const char* name) const; StrType openStrType(const string& name) const; - // Returns the number of objects in this group. - hsize_t getNumObjs() const; - - // Retrieves the name of an object in this group, given the - // object's index. - ssize_t getObjnameByIdx(hsize_t idx, string& name, size_t size) const; - - // Returns the type of an object in this group, given the - // object's index. - H5G_obj_t getObjTypeByIdx(hsize_t idx) const; - H5G_obj_t getObjTypeByIdx(hsize_t idx, string& type_name) const; + /// For subclasses, H5File and Group, to return the correct + /// object id, i.e. file or group id. + virtual hid_t getLocId() const = 0; - /// For H5File and Group to throw appropriate exception. + /// For subclasses, H5File and Group, to throw appropriate exception. virtual void throwException(const string func_name, const string msg) const = 0; // Default constructor. diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h index fa104f0..0c530b1 100644 --- a/c++/src/H5CompType.h +++ b/c++/src/H5CompType.h @@ -31,11 +31,13 @@ class H5_DLLCPP CompType : public DataType { // Gets the compound datatype of the specified dataset CompType( const DataSet& dataset ); // H5Dget_type - // Returns the number of members in this compound datatype. - int getNmembers() const; + // Returns the type class of the specified member of this compound + // datatype. It provides to the user a way of knowing what type + // to create another datatype of the same class + H5T_class_t getMemberClass( int member_num ) const; - // Returns the name of a member of this compound datatype. - string getMemberName( int member_num ) const; + // Returns the dimensionality of the specified member. + int getMemberDims( int member_num, size_t* dims, int* perm ) const; // Returns the index of a member in this compound data type. int getMemberIndex(const char* name) const; @@ -44,13 +46,12 @@ class H5_DLLCPP CompType : public DataType { // Returns the offset of a member of this compound datatype. size_t getMemberOffset( int memb_no ) const; - // Returns the dimensionality of the specified member. - int getMemberDims( int member_num, size_t* dims, int* perm ) const; + // Returns the name of a member of this compound datatype. + string getMemberName( int member_num ) const; - // Returns the type class of the specified member of this compound - // datatype. It provides to the user a way of knowing what type - // to create another datatype of the same class - H5T_class_t getMemberClass( int member_num ) const; + // Returns the compound datatype of the specified member in + // this compound datatype. + CompType getMemberCompType( int member_num ) const; // Returns the generic datatype of the specified member in // this compound datatype. @@ -60,10 +61,6 @@ class H5_DLLCPP CompType : public DataType { // this compound datatype. EnumType getMemberEnumType( int member_num ) const; - // Returns the compound datatype of the specified member in - // this compound datatype. - CompType getMemberCompType( int member_num ) const; - // Returns the integer datatype of the specified member in // this compound datatype. IntType getMemberIntType( int member_num ) const; @@ -76,6 +73,9 @@ class H5_DLLCPP CompType : public DataType { // this compound datatype. StrType getMemberStrType( int member_num ) const; + // Returns the number of members in this compound datatype. + int getNmembers() const; + // Adds a new member to this compound datatype. void insertMember( const string& name, size_t offset, const DataType& new_member ) const; @@ -91,6 +91,7 @@ class H5_DLLCPP CompType : public DataType { // Copy constructor - makes a copy of original object CompType( const CompType& original ); + // Noop destructor. virtual ~CompType(); private: diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index f344308..6392767 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -41,7 +41,7 @@ namespace H5 { //-------------------------------------------------------------------------- // Function: DataSet default constructor -///\brief Default constructor: Creates a stub dataset. +///\brief Default constructor: creates a stub DataSet. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataSet::DataSet() : AbstractDs() {} diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h index 85aa974..03e6567 100644 --- a/c++/src/H5DataSet.h +++ b/c++/src/H5DataSet.h @@ -24,21 +24,29 @@ namespace H5 { class H5_DLLCPP DataSet : public AbstractDs { public: - // Gets the dataspace of this dataset. - virtual DataSpace getSpace() const; + // Extends the dataset with unlimited dimension. + void extend( const hsize_t* size ) const; + + // Fills a selection in memory with a value + void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space); + // Fills a selection in memory with zero + void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space); // Gets the creation property list of this dataset. DSetCreatPropList getCreatePlist() const; - // Gets the storage size of this dataset. - hsize_t getStorageSize() const; - // Returns the address of this dataset in the file. haddr_t getOffset() const; + // Gets the dataspace of this dataset. + virtual DataSpace getSpace() const; + // Determines whether space has been allocated for a dataset. void getSpaceStatus(H5D_space_status_t& status) const; + // Gets the storage size of this dataset. + hsize_t getStorageSize() const; + // not yet implemented?? hsize_t getVlenBufSize( DataType& type, DataSpace& space ) const; void vlenReclaim( DataType& type, DataSpace& space, DSetMemXferPropList& xfer_plist, void* buf ) const; @@ -58,26 +66,18 @@ class H5_DLLCPP DataSet : public AbstractDs { // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet int iterateElems( void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data = NULL ); - // Extends the dataset with unlimited dimension. - void extend( const hsize_t* size ) const; - - // Fills a selection in memory with a value - void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space); - // Fills a selection in memory with zero - void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space); + // Retrieves the type of object that an object reference points to. + H5G_obj_t getObjType(void *ref, H5R_type_t ref_type) const; - // Creates a reference to a named Hdf5 object in this object. - void* Reference(const char* name) const; + // Retrieves a dataspace with the region pointed to selected. + DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; // Creates a reference to a named Hdf5 object or to a dataset region // in this object. void* Reference(const char* name, DataSpace& dataspace, H5R_type_t ref_type = H5R_DATASET_REGION) const; - // Retrieves the type of object that an object reference points to. - H5G_obj_t getObjType(void *ref, H5R_type_t ref_type) const; - - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; + // Creates a reference to a named Hdf5 object in this object. + void* Reference(const char* name) const; // Creates a copy of an existing DataSet using its id. DataSet(const hid_t existing_id); @@ -93,6 +93,7 @@ class H5_DLLCPP DataSet : public AbstractDs { // Copy constructor. DataSet( const DataSet& original ); + // Destructor: properly terminates access to this dataset. virtual ~DataSet(); private: diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index 8b6f508..71f697b 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -31,13 +31,13 @@ namespace H5 { #endif //-------------------------------------------------------------------------- -///\brief Constant for default dataspace +///\brief Constant for default dataspace. //-------------------------------------------------------------------------- const DataSpace DataSpace::ALL( H5S_ALL ); //-------------------------------------------------------------------------- // Function: DataSpace default constructor -///\brief Default constructor: creates a stub dataspace instance. +///\brief Default constructor: creates a stub DataSpace. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataSpace::DataSpace() : IdComponent() {} @@ -46,7 +46,8 @@ DataSpace::DataSpace() : IdComponent() {} // Function: DataSpace overloaded constructor ///\brief Creates a new dataspace given a dataspace type. ///\param type - IN: Type of the dataspace to be created, which -/// currently can be either \c H5S_SCALAR or \c H5S_SIMPLE +/// currently can be either \c H5S_SCALAR or \c H5S_SIMPLE; +/// default to \c H5S_SCALAR. ///\exception H5::DataSpaceIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- @@ -79,7 +80,7 @@ DataSpace::DataSpace( int rank, const hsize_t * dims, const hsize_t * maxdims) : //-------------------------------------------------------------------------- // Function: DataSpace overloaded constructor -///\brief Creates an DataSpace object using the id of an existing +///\brief Creates a DataSpace object using the id of an existing /// dataspace. ///\param existing_id - IN: Id of an existing dataspace ///\exception H5::DataSpaceIException @@ -90,7 +91,7 @@ DataSpace::DataSpace(const hid_t existing_id) : IdComponent(existing_id) {} //-------------------------------------------------------------------------- // Function: DataSpace copy constructor ///\brief Copy constructor: makes a copy of the original DataSpace object. -///\param original - IN: DataSpace instance to copy +///\param original - IN: DataSpace object to copy // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataSpace::DataSpace( const DataSpace& original ) : IdComponent( original ) {} @@ -104,7 +105,7 @@ DataSpace::DataSpace( const DataSpace& original ) : IdComponent( original ) {} //-------------------------------------------------------------------------- void DataSpace::copy( const DataSpace& like_space ) { - // reset the identifier of this instance - send 'this' in so that + // reset the identifier of this object - send 'this' in so that // H5Sclose can be called appropriately try { resetIdComponent( this ); } @@ -205,7 +206,7 @@ int DataSpace::getSimpleExtentDims ( hsize_t *dims, hsize_t *maxdims ) const //-------------------------------------------------------------------------- // Function: DataSpace::getSimpleExtentNdims -///\brief Determines the dimensionality of a dataspace. +///\brief Returns the dimensionality of a dataspace. ///\return Number of dimensions ///\exception H5::DataSpaceIException // Programmer Binh-Minh Ribler - 2000 @@ -223,7 +224,7 @@ int DataSpace::getSimpleExtentNdims () const //-------------------------------------------------------------------------- // Function: DataSpace::getSimpleExtentNpoints -///\brief Determines the number of elements in a dataspace. +///\brief Returns the number of elements in a dataspace. ///\return Number of elements ///\exception H5::DataSpaceIException // Modification @@ -247,7 +248,7 @@ hssize_t DataSpace::getSimpleExtentNpoints () const //-------------------------------------------------------------------------- // Function: DataSpace::getSimpleExtentType -///\brief Determine the current class of a dataspace. +///\brief Returns the current class of a dataspace. ///\return Class of the dataspace ///\exception H5::DataSpaceIException // Programmer Binh-Minh Ribler - 2000 @@ -398,7 +399,7 @@ hssize_t DataSpace::getSelectElemNpoints () const ///\par Description /// For more information, please refer to the C layer Reference /// Manual at: -/// http: +/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5S.html#Dataspace-SelectElemPointList // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSpace::getSelectElemPointlist ( hsize_t startpoint, hsize_t numpoints, hsize_t *buf ) const diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h index c56b7a5..6c6b72a 100644 --- a/c++/src/H5DataSpace.h +++ b/c++/src/H5DataSpace.h @@ -26,22 +26,37 @@ class H5_DLLCPP DataSpace : public IdComponent { static const DataSpace ALL; // Creates a dataspace object given the space type - DataSpace(H5S_class_t type); + DataSpace(H5S_class_t type = H5S_SCALAR); // Creates a simple dataspace DataSpace(int rank, const hsize_t * dims, const hsize_t * maxdims = NULL); + // Assignment operator + DataSpace& operator=( const DataSpace& rhs ); + // Makes copy of an existing dataspace. void copy(const DataSpace& like_space); - // Assignment operator - DataSpace& operator=( const DataSpace& rhs ); + // Copies the extent of this dataspace. + void extentCopy( DataSpace& dest_space ) const; - // Determines if this dataspace is a simple one. - bool isSimple() const; + // Gets the bounding box containing the current selection. + void getSelectBounds( hssize_t* start, hssize_t* end ) const; - // Sets the offset of this simple dataspace. - void offsetSimple( const hssize_t* offset ) const; + // Gets the number of element points in the current selection. + hssize_t getSelectElemNpoints() const; + + // Retrieves the list of element points currently selected. + void getSelectElemPointlist( hsize_t startpoint, hsize_t numpoints, hsize_t *buf ) const; + + // Gets the list of hyperslab blocks currently selected. + void getSelectHyperBlocklist( hsize_t startblock, hsize_t numblocks, hsize_t *buf ) const; + + // Get number of hyperslab blocks. + hssize_t getSelectHyperNblocks() const; + + // Gets the number of elements in this dataspace selection. + hssize_t getSelectNpoints() const; // Retrieves dataspace dimension size and maximum size. int getSimpleExtentDims( hsize_t *dims, hsize_t *maxdims = NULL ) const; @@ -56,39 +71,21 @@ class H5_DLLCPP DataSpace : public IdComponent { // Gets the current class of this dataspace. H5S_class_t getSimpleExtentType() const; - // Copies the extent of this dataspace. - void extentCopy( DataSpace& dest_space ) const; - - // Sets or resets the size of this dataspace. - void setExtentSimple( int rank, const hsize_t *current_size, const hsize_t *maximum_size = NULL ) const; - - // Removes the extent from this dataspace. - void setExtentNone() const; - - // Gets the number of elements in this dataspace selection. - hssize_t getSelectNpoints() const; - - // Get number of hyperslab blocks. - hssize_t getSelectHyperNblocks() const; - - // Gets the list of hyperslab blocks currently selected. - void getSelectHyperBlocklist( hsize_t startblock, hsize_t numblocks, hsize_t *buf ) const; - - // Gets the number of element points in the current selection. - hssize_t getSelectElemNpoints() const; + // Determines if this dataspace is a simple one. + bool isSimple() const; - // Retrieves the list of element points currently selected. - void getSelectElemPointlist( hsize_t startpoint, hsize_t numpoints, hsize_t *buf ) const; + // Sets the offset of this simple dataspace. + void offsetSimple( const hssize_t* offset ) const; - // Gets the bounding box containing the current selection. - void getSelectBounds( hssize_t* start, hssize_t* end ) const; + // Selects the entire dataspace. + void selectAll() const; // Selects array elements to be included in the selection for // this dataspace. void selectElements( H5S_seloper_t op, const size_t num_elements, const hssize_t *coord[ ] ) const; - // Selects the entire dataspace. - void selectAll() const; + // Selects a hyperslab region to add to the current selected region. + void selectHyperslab( H5S_seloper_t op, const hsize_t *count, const hssize_t *start, const hsize_t *stride = NULL, const hsize_t *block = NULL ) const; // Resets the selection region to include no elements. void selectNone() const; @@ -96,24 +93,27 @@ class H5_DLLCPP DataSpace : public IdComponent { // Verifies that the selection is within the extent of the dataspace. bool selectValid() const; - // Selects a hyperslab region to add to the current selected region. - void selectHyperslab( H5S_seloper_t op, const hsize_t *count, const hssize_t *start, const hsize_t *stride = NULL, const hsize_t *block = NULL ) const; + // Removes the extent from this dataspace. + void setExtentNone() const; - // Uses an existing dataspace identifier to make a DataSpace object - // or uses a default id to create a default dataspace object - DataSpace( const hid_t space_id ); + // Sets or resets the size of this dataspace. + void setExtentSimple( int rank, const hsize_t *current_size, const hsize_t *maximum_size = NULL ) const; -#ifndef DOXYGEN_SHOULD_SKIP_THIS - // Used by the API to close the dataspace - void p_close() const; -#endif // DOXYGEN_SHOULD_SKIP_THIS + // Creates a DataSpace object using an existing dataspace id. + DataSpace(const hid_t space_id); // Default constructor DataSpace(); // Copy constructor: makes a copy of the original DataSpace object. - DataSpace( const DataSpace& original ); + DataSpace(const DataSpace& original); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + // Used by the API to close the dataspace + void p_close() const; +#endif // DOXYGEN_SHOULD_SKIP_THIS + // Destructor: properly terminates access to this dataspace. virtual ~DataSpace(); }; #ifndef H5_NO_NAMESPACE diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index 6ac6418..7714231 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -25,15 +25,9 @@ class H5_DLLCPP DataType : public H5Object { // Creates a datatype given its class and size DataType( const H5T_class_t type_class, size_t size ); - // Copy constructor: makes a copy of the original object - DataType( const DataType& original ); - // Copies an existing datatype to this datatype object void copy( const DataType& like_type ); - // Returns the datatype class identifier. - H5T_class_t getClass() const; - // Commits a transient datatype to a file; this datatype becomes // a named datatype which can be accessed from the location. void commit( CommonFG& loc, const char* name ) const; @@ -43,27 +37,24 @@ class H5_DLLCPP DataType : public H5Object { // a transient datatype. bool committed() const; + // Converts data from between specified datatypes. + void convert( const DataType& dest, hsize_t nelmts, void *buf, void *background, PropList& plist ) const; + + // Checks whether this datatype contains (or is) a certain type class. + bool detectClass(H5T_class_t cls) const; + // Finds a conversion function that can handle the conversion // this datatype to the given datatype, dest. H5T_conv_t find( const DataType& dest, H5T_cdata_t **pcdata ) const; - // Converts data from between specified datatypes. - void convert( const DataType& dest, hsize_t nelmts, void *buf, void *background, PropList& plist ) const; - - // Sets the overflow handler to a specified function. - void setOverflow(H5T_overflow_t func) const; + // Returns the datatype class identifier. + H5T_class_t getClass() const; // Returns a pointer to the current global overflow function. H5T_overflow_t getOverflow(void) const; - // Assignment operator - DataType& operator=( const DataType& rhs ); - - // Determines whether two datatypes are the same. - bool operator==(const DataType& compared_type ) const; - - // Locks a datatype. - void lock() const; + // Sets the overflow handler to a specified function. + void setOverflow(H5T_overflow_t func) const; // Returns the size of a datatype. size_t getSize() const; @@ -72,33 +63,32 @@ class H5_DLLCPP DataType : public H5Object { // Note: not quite right for specific types yet??? DataType getSuper() const; - // Registers a conversion function. - void registerFunc(H5T_pers_t pers, const string& name, const DataType& dest, H5T_conv_t func ) const; - void registerFunc(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func ) const; - - // Removes a conversion function from all conversion paths. - void unregister( H5T_pers_t pers, const string& name, const DataType& dest, H5T_conv_t func ) const; - void unregister( H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func ) const; + // Gets the tag associated with an opaque datatype. + string getTag() const; // Tags an opaque datatype. void setTag( const string& tag ) const; void setTag( const char* tag ) const; - // Gets the tag associated with an opaque datatype. - string getTag() const; - - // Checks whether this datatype contains (or is) a certain type class. - bool detectClass(H5T_class_t cls) const; - // Checks whether this datatype is a variable-length string. bool isVariableStr() const; - // Creates a reference to a named Hdf5 object in this object. - void* Reference(const char* name) const; + // Locks a datatype. + void lock() const; - // Creates a reference to a named Hdf5 object or to a dataset region - // in this object. - void* Reference(const char* name, DataSpace& dataspace, H5R_type_t ref_type = H5R_DATASET_REGION) const; + // Assignment operator + DataType& operator=( const DataType& rhs ); + + // Determines whether two datatypes are the same. + bool operator==(const DataType& compared_type ) const; + + // Registers a conversion function. + void registerFunc(H5T_pers_t pers, const string& name, const DataType& dest, H5T_conv_t func ) const; + void registerFunc(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func ) const; + + // Removes a conversion function from all conversion paths. + void unregister( H5T_pers_t pers, const string& name, const DataType& dest, H5T_conv_t func ) const; + void unregister( H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func ) const; // Retrieves the type of object that an object reference points to. H5G_obj_t getObjType(void *ref, H5R_type_t ref_type) const; @@ -106,10 +96,12 @@ class H5_DLLCPP DataType : public H5Object { // Retrieves a dataspace with the region pointed to selected. DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; -#ifndef DOXYGEN_SHOULD_SKIP_THIS - // Used by the API to appropriately close a datatype - void p_close() const; -#endif // DOXYGEN_SHOULD_SKIP_THIS + // Creates a reference to a named Hdf5 object or to a dataset region + // in this object. + void* Reference(const char* name, DataSpace& dataspace, H5R_type_t ref_type = H5R_DATASET_REGION) const; + + // Creates a reference to a named Hdf5 object in this object. + void* Reference(const char* name) const; // Creates a copy of an existing DataType using its id DataType( const hid_t type_id, bool predtype = false ); @@ -117,6 +109,15 @@ class H5_DLLCPP DataType : public H5Object { // Default constructor DataType(); + // Copy constructor: makes a copy of the original object + DataType( const DataType& original ); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + // Used by the API to appropriately close a datatype + void p_close() const; +#endif // DOXYGEN_SHOULD_SKIP_THIS + + // Destructor: properly terminates access to this datatype. virtual ~DataType(); protected: diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp index b263fa5..50c6351 100644 --- a/c++/src/H5DcreatProp.cpp +++ b/c++/src/H5DcreatProp.cpp @@ -29,24 +29,34 @@ namespace H5 { #endif //-------------------------------------------------------------------------- -///\brief Constant for default property +///\brief Constant for dataset creation default property //-------------------------------------------------------------------------- const DSetCreatPropList DSetCreatPropList::DEFAULT( H5P_DEFAULT ); //-------------------------------------------------------------------------- // Function: DSetCreatPropList default constructor -///\brief Default Constructor: Creates a dataset creation property list +///\brief Default constructor: creates a stub dataset creation property list +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetCreatPropList::DSetCreatPropList() : PropList( H5P_DATASET_CREATE) {} //-------------------------------------------------------------------------- // Function: DSetCreatPropList copy constructor -///\brief Copy Constructor: Makes a copy of the original +///\brief Copy constructor: makes a copy of the original /// DSetCreatPropList object +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetCreatPropList::DSetCreatPropList( const DSetCreatPropList& orig ) : PropList( orig ) {} //-------------------------------------------------------------------------- +// Function: DSetCreatPropList overloaded constructor +///\brief Creates a DSetCreatPropList object using the id of an +/// existing dataset creation property list. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +DSetCreatPropList::DSetCreatPropList(const hid_t plist_id) : PropList( plist_id ) {} + +//-------------------------------------------------------------------------- // Function: DSetCreatPropList::setChunk ///\brief Sets the size of the chunks used to store a chunked layout /// dataset. @@ -59,6 +69,7 @@ DSetCreatPropList::DSetCreatPropList( const DSetCreatPropList& orig ) : PropList /// 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. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setChunk( int ndims, const hsize_t* dim ) const { @@ -76,6 +87,7 @@ void DSetCreatPropList::setChunk( int ndims, const hsize_t* dim ) const ///\param max_ndims - IN: Size of \a dim array ///\param dim - OUT: Array to store the chunk dimensions ///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int DSetCreatPropList::getChunk( int max_ndims, hsize_t* dim ) const { @@ -97,6 +109,7 @@ int DSetCreatPropList::getChunk( int max_ndims, hsize_t* dim ) const ///\par Description /// For information on setting layout type, please refer to /// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetLayout +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setLayout(hid_t plist, H5D_layout_t layout ) const { @@ -122,6 +135,7 @@ void DSetCreatPropList::setLayout(hid_t plist, H5D_layout_t layout ) const /// in the file. ///\exception H5::PropListIException ///\par Description +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5D_layout_t DSetCreatPropList::getLayout() const { @@ -144,6 +158,7 @@ H5D_layout_t DSetCreatPropList::getLayout() const /// list to \c H5D_COMPRESS_DEFLATE and the compression level to /// \a level. Lower compression levels are faster but result in /// less compression. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setDeflate( int level ) const { @@ -171,6 +186,7 @@ void DSetCreatPropList::setDeflate( int level ) const /// 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 +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setFillValue( const DataType& fvalue_type, const void* value ) const { @@ -193,6 +209,7 @@ void DSetCreatPropList::setFillValue( const DataType& fvalue_type, const void* v /// 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. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::getFillValue( const DataType& fvalue_type, void* value ) const { @@ -212,6 +229,7 @@ void DSetCreatPropList::getFillValue( const DataType& fvalue_type, void* value ) /// \li \c H5D_FILL_VALUE_DEFAULT =1, /// \li \c H5D_FILL_VALUE_USER_DEFINED =2 ///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5D_fill_value_t DSetCreatPropList::isFillValueDefined() { @@ -244,6 +262,7 @@ H5D_fill_value_t DSetCreatPropList::isFillValueDefined() /// 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. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setFilter( H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[] ) const { @@ -263,6 +282,7 @@ void DSetCreatPropList::setFilter( H5Z_filter_t filter_id, unsigned int flags, s ///\par Description /// Deletes a filter from the dataset creation property list; /// deletes all filters if \a filter_id is \c H5Z_FILTER_NONE. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::removeFilter(H5Z_filter_t filter_id) const { @@ -279,6 +299,7 @@ void DSetCreatPropList::removeFilter(H5Z_filter_t filter_id) const ///\brief Returns the number of filters in the pipeline ///\return Number of filters ///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int DSetCreatPropList::getNfilters() const { @@ -307,6 +328,7 @@ int DSetCreatPropList::getNfilters() const ///\exception H5::PropListIException ///\par Description /// Failure occurs when \a filter_number is out of range. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- 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 { @@ -334,6 +356,7 @@ H5Z_filter_t DSetCreatPropList::getFilter( int filter_number, unsigned int& flag ///\param namelen - IN: Length of \a name ///\param name - OUT: Name of the filter ///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- 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 { @@ -365,6 +388,7 @@ void DSetCreatPropList::getFilterById(H5Z_filter_t filter_id, unsigned int &flag /// 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. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::modifyFilter( H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[] ) const { @@ -383,6 +407,7 @@ void DSetCreatPropList::modifyFilter( H5Z_filter_t filter_id, unsigned int flags ///\return true if all filters available, and false if one or more /// filters not currently available ///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- bool DSetCreatPropList::allFiltersAvail() { @@ -405,6 +430,7 @@ bool DSetCreatPropList::allFiltersAvail() /// Please refer to the Reference Manual of \c H5Pset_shuffle for /// details. /// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetShuffle +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setShuffle() { @@ -428,6 +454,7 @@ void DSetCreatPropList::setShuffle() /// \li \c H5D_ALLOC_TIME_EARLY /// \li \c H5D_ALLOC_TIME_LATE /// \li \c H5D_ALLOC_TIME_INCR +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5D_alloc_time_t DSetCreatPropList::getAllocTime() { @@ -451,6 +478,7 @@ H5D_alloc_time_t DSetCreatPropList::getAllocTime() /// Valid values for fill value writing time include /// \li \c H5D_FILL_TIME_NEVER /// \li \c H5D_FILL_TIME_ALLOC. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5D_fill_time_t DSetCreatPropList::getFillTime() { @@ -476,6 +504,7 @@ H5D_fill_time_t DSetCreatPropList::getFillTime() /// \li \c H5D_ALLOC_TIME_EARLY /// \li \c H5D_ALLOC_TIME_LATE /// \li \c H5D_ALLOC_TIME_INCR +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setAllocTime(H5D_alloc_time_t alloc_time) { @@ -496,6 +525,7 @@ void DSetCreatPropList::setAllocTime(H5D_alloc_time_t alloc_time) /// Valid values for fill value writing time include /// \li \c H5D_FILL_TIME_NEVER /// \li \c H5D_FILL_TIME_ALLOC. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setFillTime(H5D_fill_time_t fill_time) { @@ -511,6 +541,7 @@ void DSetCreatPropList::setFillTime(H5D_fill_time_t fill_time) // Function: DSetCreatPropList::setFletcher32 ///\brief Sets Fletcher32 checksum of EDC for this property list. ///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setFletcher32() { @@ -536,6 +567,7 @@ void DSetCreatPropList::setFletcher32() /// 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). +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setExternal( const char* name, off_t offset, hsize_t size ) const { @@ -552,6 +584,7 @@ void DSetCreatPropList::setExternal( const char* name, off_t offset, hsize_t siz ///\brief Returns the number of external files for a dataset ///\return Number of external files ///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int DSetCreatPropList::getExternalCount() const { @@ -585,6 +618,7 @@ int DSetCreatPropList::getExternalCount() const /// external file name will not be returned. If \a offset or /// \a size are null pointers then the corresponding information /// will not be returned. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::getExternal( int idx, size_t name_size, char* name, off_t& offset, hsize_t& size ) const { diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h index 8c1a831..e2e7361 100644 --- a/c++/src/H5DcreatProp.h +++ b/c++/src/H5DcreatProp.h @@ -21,96 +21,96 @@ namespace H5 { #endif class H5_DLLCPP DSetCreatPropList : public PropList { - public: + public: + // Default dataset creation property list. static const DSetCreatPropList DEFAULT; - // Creates a dataset creation property list - DSetCreatPropList(); - - // Copy constructor: creates a copy of a DSetCreatPropList object; - // often used by the compiler when passing by value occurs. - DSetCreatPropList( const DSetCreatPropList& orig ); - - // Sets the type of storage used to store the raw data for the - // dataset that uses this property list - void setLayout(hid_t plist, H5D_layout_t layout ) const; + // Queries whether all the filters set in this property list are + // available currently. + bool allFiltersAvail(); - // Gets the layout of the raw data storage of the data that uses this - // property list - H5D_layout_t getLayout() const; + // Get space allocation time for this property. + H5D_alloc_time_t getAllocTime(); - // Sets the size of the chunks used to store a chunked layout dataset. - void setChunk( int ndims, const hsize_t* dim ) const; + // Set space allocation time for dataset during creation. + void setAllocTime(H5D_alloc_time_t alloc_time); // Retrieves the size of the chunks used to store a chunked layout dataset. int getChunk( int max_ndims, hsize_t* dim ) const; - // Sets compression method and compression level - void setDeflate( int level ) const; + // Sets the size of the chunks used to store a chunked layout dataset. + void setChunk( int ndims, const hsize_t* dim ) const; - // Sets a dataset fill value - void setFillValue( const DataType& fvalue_type, const void* value ) const; + // Returns information about an external file. + void getExternal( int idx, size_t name_size, char* name, off_t& offset, hsize_t& size ) const; - // Retrieves a dataset fill value - void getFillValue( const DataType& fvalue_type, void* value ) const; + // Returns the number of external files for a dataset. + int getExternalCount() const; - // Checks if fill value has been defined for this property - H5D_fill_value_t isFillValueDefined(); + // Gets fill value writing time. + H5D_fill_time_t getFillTime(); - // 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; + // Sets fill value writing time for dataset. + void setFillTime(H5D_fill_time_t fill_time); - // Remove one or all filters from the filter pipeline - void removeFilter( H5Z_filter_t filter_id) const; + // Retrieves a dataset fill value. + void getFillValue( const DataType& fvalue_type, void* value ) const; - // Returns the number of filters in the pipeline - int getNfilters() const; + // Sets a dataset fill value. + void setFillValue( const DataType& fvalue_type, const void* value ) const; - // Returns information about a filter in a pipeline + // 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 + // 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; + // Gets the layout of the raw data storage of the data that uses this + // property list. + H5D_layout_t getLayout() const; - // Queries whether all the filters set in this property list are - // available currently. - bool allFiltersAvail(); + // Sets the type of storage used to store the raw data for the + // dataset that uses this property list. + void setLayout(hid_t plist, H5D_layout_t layout ) const; - // Sets method of the shuffle filter - void setShuffle(); + // Returns the number of filters in the pipeline. + int getNfilters() const; - // Get space allocation time for this property - H5D_alloc_time_t getAllocTime(); + // Checks if fill value has been defined for this property. + H5D_fill_value_t isFillValueDefined(); - // Gets fill value writing time - H5D_fill_time_t getFillTime(); + // Modifies the specified filter. + void modifyFilter( H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[] ) const; - // Set space allocation time for dataset during creation - void setAllocTime(H5D_alloc_time_t alloc_time); + // Remove one or all filters from the filter pipeline. + void removeFilter( H5Z_filter_t filter_id) const; - // Sets fill value writing time for dataset - void setFillTime(H5D_fill_time_t fill_time); + // Sets compression method and compression level. + void setDeflate( int level ) const; + + // Adds an external file to the list of external files. + void setExternal( const char* name, off_t offset, hsize_t size ) const; - // Sets Fletcher32 checksum of EDC for this property list + // 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; + + // 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; + // Sets method of the shuffle filter. + void setShuffle(); - // Returns the number of external files for a dataset - int getExternalCount() const; + // Default constructor: creates a stub dataset creation property list. + DSetCreatPropList(); - // Returns information about an external file - void getExternal( int idx, size_t name_size, char* name, off_t& offset, hsize_t& size ) const; + // Copy constructor: creates a copy of a DSetCreatPropList object. + DSetCreatPropList(const DSetCreatPropList& orig); // Creates a copy of an existing dataset creation property list - // using the property list id - DSetCreatPropList( const hid_t plist_id ) : PropList( plist_id ) {} + // using the property list id. + DSetCreatPropList(const hid_t plist_id); - // Default destructor + // Noop destructor. virtual ~DSetCreatPropList(); }; #ifndef H5_NO_NAMESPACE diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp index 5ed6c82..f6f41a4 100644 --- a/c++/src/H5DxferProp.cpp +++ b/c++/src/H5DxferProp.cpp @@ -26,27 +26,37 @@ namespace H5 { #endif //-------------------------------------------------------------------------- -///\brief Constant for default property +///\brief Constant for default dataset memory and transfer property list. //-------------------------------------------------------------------------- const DSetMemXferPropList DSetMemXferPropList::DEFAULT( H5P_DEFAULT ); //-------------------------------------------------------------------------- // Function Default constructor -///\brief Default constructor - Creates a stub dataset memory and +///\brief Default constructor: creates a stub dataset memory and /// transfer property list object. -// Programmer: Binh-Minh Ribler +// Programmer: Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetMemXferPropList::DSetMemXferPropList() : PropList(H5P_DATASET_XFER) {} //-------------------------------------------------------------------------- -// Function Copy constructor -///\brief Copy constructor - makes a copy of the original +// Function DSetMemXferPropList copy constructor +///\brief Copy constructor: makes a copy of the original /// DSetMemXferPropList object ///\param original - IN: Original dataset memory and transfer property /// list object to copy -// Programmer: Binh-Minh Ribler +// Programmer: Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DSetMemXferPropList::DSetMemXferPropList( const DSetMemXferPropList& original ) : PropList( original ) {} +DSetMemXferPropList::DSetMemXferPropList(const DSetMemXferPropList& original) : PropList(original) {} + +//-------------------------------------------------------------------------- +// Function DSetMemXferPropList overloaded constructor +///\brief Creates a DSetMemXferPropList object using the id of an +/// existing DSetMemXferPropList. +///\param plist_id - IN: Id of an existing dataset memory and transfer +/// property list +// Programmer: Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +DSetMemXferPropList::DSetMemXferPropList(const hid_t plist_id) : PropList(plist_id) {} #ifdef H5_WANT_H5_V1_4_COMPAT //-------------------------------------------------------------------------- diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h index 652af55..7b29fe5 100644 --- a/c++/src/H5DxferProp.h +++ b/c++/src/H5DxferProp.h @@ -22,58 +22,53 @@ namespace H5 { class H5_DLLCPP DSetMemXferPropList : public PropList { public: + // Default dataset memory and transfer property list. static const DSetMemXferPropList DEFAULT; - // Creates a dataset memory and transfer property list - DSetMemXferPropList(); - - // Copy constructor: creates a copy of a DSetMemXferPropList object - DSetMemXferPropList( const DSetMemXferPropList& orig ); - #ifdef H5_WANT_H5_V1_4_COMPAT - // Sets type conversion and background buffers + // Sets type conversion and background buffers. void setBuffer( hsize_t size, void* tconv, void* bkg ) const; - // Reads buffer settings + // Reads buffer settings. hsize_t getBuffer( void** tconv, void** bkg ) const; - // Indicates whether to cache hyperslab blocks during I/O + // Indicates whether to cache hyperslab blocks during I/O. void setHyperCache( bool cache, unsigned limit = 0 ) const; - // Returns information regarding the caching of hyperslab blocks during I/O + // Returns information regarding the caching of hyperslab blocks during I/O. void getHyperCache( bool& cache, unsigned& limit ) const; #else /* H5_WANT_H5_V1_4_COMPAT */ - // Sets type conversion and background buffers + // Sets type conversion and background buffers. void setBuffer( size_t size, void* tconv, void* bkg ) const; - // Reads buffer settings + // Reads buffer settings. size_t getBuffer( void** tconv, void** bkg ) const; #endif /* H5_WANT_H5_V1_4_COMPAT */ - // Sets B-tree split ratios for a dataset transfer property list + // Sets B-tree split ratios for a dataset transfer property list. void setBtreeRatios( double left, double middle, double right ) const; - // Gets B-tree split ratios for a dataset transfer property list + // Gets B-tree split ratios for a dataset transfer property list. void getBtreeRatios( double& left, double& middle, double& right ) const; - // Sets the dataset transfer property list status to TRUE or FALSE + // Sets the dataset transfer property list status to TRUE or FALSE. void setPreserve( bool status ) const; - // Checks status of the dataset transfer property list + // Checks status of the dataset transfer property list. bool getPreserve() const; // Sets the memory manager for variable-length datatype - // allocation in H5Dread and H5Dvlen_reclaim + // allocation in H5Dread and H5Dvlen_reclaim. void setVlenMemManager( H5MM_allocate_t alloc, void* alloc_info, H5MM_free_t free, void* free_info ) const; // alloc and free are set to NULL, indicating that system - // malloc and free are to be used + // malloc and free are to be used. void setVlenMemManager() const; // Gets the memory manager for variable-length datatype - // allocation in H5Dread and H5Tvlen_reclaim + // allocation in H5Dread and H5Tvlen_reclaim. void getVlenMemManager( H5MM_allocate_t& alloc, void** alloc_info, H5MM_free_t& free, void** free_info ) const; @@ -103,11 +98,17 @@ class H5_DLLCPP DSetMemXferPropList : public PropList { // Determines whether error-detection is enabled for dataset reads. H5Z_EDC_t getEDCCheck(); + // Default constructor: creates a dataset memory and transfer prop list. + DSetMemXferPropList(); + + // Copy constructor: makes a copy of a DSetMemXferPropList object. + DSetMemXferPropList(const DSetMemXferPropList& orig); + // Creates a copy of an existing dataset memory and transfer - // property list using the property list id - DSetMemXferPropList (const hid_t plist_id) : PropList( plist_id ) {} + // property list using the property list id. + DSetMemXferPropList (const hid_t plist_id); - // Default destructor + // Noop destructor. virtual ~DSetMemXferPropList(); }; diff --git a/c++/src/H5EnumType.h b/c++/src/H5EnumType.h index cca253a..4cb6cbd 100644 --- a/c++/src/H5EnumType.h +++ b/c++/src/H5EnumType.h @@ -27,24 +27,25 @@ class H5_DLLCPP EnumType : public DataType { // integer type, whose size is given by size. EnumType( size_t size ); - // Default constructor - EnumType(); - - // Creates an enumeration datatype using an existing id - EnumType( const hid_t existing_id ); - - // Copy constructor: makes a copy of the original EnumType object. - EnumType( const EnumType& original ); - // Gets the enum datatype of the specified dataset EnumType( const DataSet& dataset ); // H5Dget_type // Creates a new enum datatype based on an integer datatype EnumType( const IntType& data_type ); // H5Tenum_create + // Returns the number of members in this enumeration datatype. + int getNmembers () const; + + // Returns the index of a member in this enumeration data type. + int getMemberIndex(const char* name) const; + int getMemberIndex(const string& name) const; + + // Returns the value of an enumeration datatype member + void getMemberValue( int memb_no, void *value ) const; + // Inserts a new member to this enumeration type. - void insert( const string& name, void *value ) const; void insert( const char* name, void *value ) const; + void insert( const string& name, void *value ) const; // Returns the symbol name corresponding to a specified member // of this enumeration datatype. @@ -52,18 +53,17 @@ class H5_DLLCPP EnumType : public DataType { // Returns the value corresponding to a specified member of this // enumeration datatype. - void valueOf( const string& name, void *value ) const; void valueOf( const char* name, void *value ) const; + void valueOf( const string& name, void *value ) const; - // Returns the index of a member in this enumeration data type. - int getMemberIndex(const char* name) const; - int getMemberIndex(const string& name) const; + // Default constructor + EnumType(); - // Returns the number of members in this enumeration datatype. - int getNmembers () const; + // Creates an enumeration datatype using an existing id + EnumType( const hid_t existing_id ); - // Returns the value of an enumeration datatype member - void getMemberValue( int memb_no, void *value ) const; + // Copy constructor: makes a copy of the original EnumType object. + EnumType( const EnumType& original ); virtual ~EnumType(); }; diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp index 767385d..20e939e 100644 --- a/c++/src/H5Exception.cpp +++ b/c++/src/H5Exception.cpp @@ -37,7 +37,6 @@ Exception::Exception() : detail_message(""), func_name("") {} /// in which the failure occurs, and an optional detailed message. ///\param func_name - IN: Name of the function where failure occurs ///\param message - IN: Message on the failure -///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Exception::Exception(const string func_name, const string message) : detail_message(message), func_name(func_name) {} @@ -56,9 +55,10 @@ Exception::Exception( const Exception& orig ) //-------------------------------------------------------------------------- // Function: Exception::getMajorString -///\brief Returns the text string that describes an error +///\brief Returns a text string that describes the error /// specified by a major error number. ///\param err_major - IN: Major error number +///\return Major error string ///\par Description /// In the failure case, the string "Invalid major error number" /// will be returned. @@ -74,9 +74,10 @@ string Exception::getMajorString(H5E_major_t err_major) const //-------------------------------------------------------------------------- // Function: Exception::getMinorString -///\brief Returns the text string that describes an error +///\brief Returns a text string that describes the error /// specified by a minor error number. ///\param err_minor - IN: Minor error number +///\return Minor error string ///\par Description /// In the failure case, the string "Invalid minor error number" /// will be returned. @@ -97,9 +98,10 @@ string Exception::getMinorString(H5E_minor_t err_minor) const ///\param client_data - IN: Data passed to the error function ///\par Description /// When the library is first initialized the auto printing -/// function is set to the C API \c H5Eprint and \a client_data is -/// the standard error stream pointer, \c stderr. Automatic stack -/// traversal is always in the \c H5E_WALK_DOWNWARD direction. +/// function, \a func, is set to the C API \c H5Eprint and +/// \a client_data is the standard error stream pointer, \c stderr. +/// Automatic stack traversal is always in the \c H5E_WALK_DOWNWARD +/// direction. ///\par /// Users are encouraged to write their own more specific error /// handlers @@ -116,7 +118,7 @@ void Exception::setAutoPrint( H5E_auto_t& func, void* client_data ) //-------------------------------------------------------------------------- // Function: Exception::dontPrint -///\brief Turns off the automatic error printing. +///\brief Turns off the automatic error printing from the C library. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void Exception::dontPrint() @@ -132,16 +134,10 @@ void Exception::dontPrint() // Function: Exception::getAutoPrint ///\brief Retrieves the current settings for the automatic error /// stack traversal function and its data. -///\param func - IN: Function to be called upon an error condition -///\param client_data - IN: Data passed to the error function -///\par Description -/// When the library is first initialized the auto printing -/// function is set to the C API \c H5Eprint and \a client_data is -/// the standard error stream pointer, \c stderr. Automatic stack -/// traversal is always in the \c H5E_WALK_DOWNWARD direction. -///\par -/// Users are encouraged to write their own more specific error -/// handlers +///\param func - OUT: Current setting for the function to be +/// called upon an error condition +///\param client_data - OUT: Current setting for the data passed to +/// the error function // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void Exception::getAutoPrint( H5E_auto_t& func, void** client_data ) @@ -158,7 +154,7 @@ void Exception::getAutoPrint( H5E_auto_t& func, void** client_data ) ///\brief Clears the error stack for the current thread. ///\par Description /// The stack is also cleared whenever a C API function is -/// called, with certain exceptions (for instance, H5Eprint). +/// called, with certain exceptions (for instance, \c H5Eprint). // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void Exception::clearErrorStack() diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h index 8f6f1c9..a70e7b4 100644 --- a/c++/src/H5Exception.h +++ b/c++/src/H5Exception.h @@ -27,21 +27,15 @@ namespace H5 { class H5_DLLCPP Exception { public: - // Default constructor - Exception(); - // Creates an exception with a function name where the failure occurs // and an optional detailed message Exception(const string func_name, const string message = DEFAULT_MSG); - // copy constructor - Exception( const Exception& orig); - - // Returns the character string that describes an error specified by + // Returns a character string that describes the error specified by // a major error number. string getMajorString( H5E_major_t major_num ) const; - // Returns the character string that describes an error specified by + // Returns a character string that describes the error specified by // a minor error number. string getMinorString( H5E_minor_t minor_num ) const; @@ -72,6 +66,12 @@ class H5_DLLCPP Exception { // Prints the error stack in a default manner. virtual void printError( FILE* stream = NULL ) const; + // Default constructor + Exception(); + + // copy constructor + Exception( const Exception& orig); + // virtual Destructor virtual ~Exception(); @@ -92,71 +92,71 @@ class H5_DLLCPP Exception { class H5_DLLCPP FileIException : public Exception { public: - FileIException(); FileIException( const string func_name, const string message = DEFAULT_MSG); + FileIException(); virtual ~FileIException(); }; class H5_DLLCPP GroupIException : public Exception { public: - GroupIException(); GroupIException( const string func_name, const string message = DEFAULT_MSG); + GroupIException(); virtual ~GroupIException(); }; class H5_DLLCPP DataSpaceIException : public Exception { public: - DataSpaceIException(); DataSpaceIException(const string func_name, const string message = DEFAULT_MSG); + DataSpaceIException(); virtual ~DataSpaceIException(); }; class H5_DLLCPP DataTypeIException : public Exception { public: - DataTypeIException(); DataTypeIException(const string func_name, const string message = DEFAULT_MSG); + DataTypeIException(); virtual ~DataTypeIException(); }; class H5_DLLCPP PropListIException : public Exception { public: - PropListIException(); PropListIException(const string func_name, const string message = DEFAULT_MSG); + PropListIException(); virtual ~PropListIException(); }; class H5_DLLCPP DataSetIException : public Exception { public: - DataSetIException(); DataSetIException(const string func_name, const string message = DEFAULT_MSG); + DataSetIException(); virtual ~DataSetIException(); }; class H5_DLLCPP AttributeIException : public Exception { public: - AttributeIException(); AttributeIException(const string func_name, const string message = DEFAULT_MSG); + AttributeIException(); virtual ~AttributeIException(); }; class H5_DLLCPP ReferenceException : public Exception { public: - ReferenceException(); ReferenceException(const string func_name, const string message = DEFAULT_MSG); + ReferenceException(); virtual ~ReferenceException(); }; class H5_DLLCPP LibraryIException : public Exception { public: - LibraryIException(); LibraryIException(const string func_name, const string message = DEFAULT_MSG); + LibraryIException(); virtual ~LibraryIException(); }; class H5_DLLCPP IdComponentException : public Exception { public: - IdComponentException(); IdComponentException(const string func_name, const string message = DEFAULT_MSG); + IdComponentException(); virtual ~IdComponentException(); }; diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp index 36b127f..8892e58 100644 --- a/c++/src/H5FaccProp.cpp +++ b/c++/src/H5FaccProp.cpp @@ -31,21 +31,31 @@ namespace H5 { const FileAccPropList FileAccPropList::DEFAULT( H5P_DEFAULT ); //-------------------------------------------------------------------------- -// Function: Default Constructor -///\brief Default constructor: Creates a file access property list +// Function: FileAccPropList default constructor +///\brief Default constructor: creates a file access property list. +// Programmer: Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FileAccPropList::FileAccPropList() : PropList( H5P_FILE_ACCESS ) {} //-------------------------------------------------------------------------- -// Function: Copy Constructor -///\brief Copy Constructor: Makes a copy of the original +// Function: FileAccPropList copy constructor +///\brief Copy constructor: makes a copy of the original FileAccPropList. /// FileAccPropList object +// Programmer: Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FileAccPropList::FileAccPropList(const FileAccPropList& orig) : PropList(orig) {} //-------------------------------------------------------------------------- +// Function: FileAccPropList overloaded constructor +///\brief Creates a file access property list using the id of an +/// existing one. +// Programmer: Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +FileAccPropList::FileAccPropList(const hid_t plist_id) : PropList(plist_id) {} + +//-------------------------------------------------------------------------- // Function: FileAccPropList::setStdio -///\brief Modifies this property list to use the \c H5FD_STDIO driver +///\brief Modifies this property list to use the \c H5FD_STDIO driver. ///\exception H5::PropListIException // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- @@ -81,7 +91,7 @@ hid_t FileAccPropList::getDriver() const //-------------------------------------------------------------------------- // Function: FileAccPropList::setDriver -///\brief Set file driver for this property list +///\brief Set file driver for this property list. ///\param new_driver_id - IN: File driver ///\param new_driver_info - IN: Struct containing the driver-specific properites ///\exception H5::PropListIException @@ -160,7 +170,7 @@ void FileAccPropList::setCore (size_t increment, hbool_t backing_store) const //-------------------------------------------------------------------------- // Function: FileAccPropList::getCore ///\brief Queries core file driver properties. -///\param increment - OUT: Size of memory increment, in bytes +///\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 @@ -364,10 +374,10 @@ void FileAccPropList::setSieveBufSize(size_t bufsize) const // Function: FileAccPropList::setMetaBlockSize ///\brief Sets the minimum size of metadata block allocations. ///\param block_size - IN: Minimum size, in bytes, of metadata -/// block allocations +/// block allocations ///\exception H5::PropListIException ///\par Description -/// For more detail, please refer to +/// For more detail, please see the C layer Reference Manual at: /// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetMetaBlockSize // Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h index e10c7d0..8b014ce 100644 --- a/c++/src/H5FaccProp.h +++ b/c++/src/H5FaccProp.h @@ -25,12 +25,6 @@ class H5_DLLCPP FileAccPropList : public PropList { public: static const FileAccPropList DEFAULT; - // Creates a file access property list. - FileAccPropList(); - - // Copy constructor: creates a copy of a FileAccPropList object - FileAccPropList( const FileAccPropList& original ); - // Modifies this property list to use the H5FD_STDIO driver void setStdio() const; @@ -125,9 +119,15 @@ class H5_DLLCPP FileAccPropList : public PropList { // Returns garbage collecting references setting. unsigned getGcReferences() const; + // Creates a file access property list. + FileAccPropList(); + + // Copy constructor: creates a copy of a FileAccPropList object. + FileAccPropList( const FileAccPropList& original ); + // Creates a copy of an existing file access property list - // using the property list id - FileAccPropList (const hid_t plist_id) : PropList( plist_id ) {} + // using the property list id. + FileAccPropList (const hid_t plist_id); // Default destructor virtual ~FileAccPropList(); diff --git a/c++/src/H5FcreatProp.cpp b/c++/src/H5FcreatProp.cpp index f2a683a..cd79b93 100644 --- a/c++/src/H5FcreatProp.cpp +++ b/c++/src/H5FcreatProp.cpp @@ -32,12 +32,21 @@ const FileCreatPropList FileCreatPropList::DEFAULT( H5P_DEFAULT ); //-------------------------------------------------------------------------- // Function: FileCreatPropList default constructor -///\brief Default constructor: Creates a file create property list +///\brief Default constructor: creates a file creation property list. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FileCreatPropList::FileCreatPropList() : PropList( H5P_FILE_CREATE ) {} //-------------------------------------------------------------------------- +// Function: FileCreatPropList overloaded constructor +///\brief Creates a file creation property list using the id of an +/// existing one. +///\param plist_id - IN: FileCreatPropList id to use +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +FileCreatPropList::FileCreatPropList(const hid_t plist_id) : PropList(plist_id) {} + +//-------------------------------------------------------------------------- // Function: FileCreatPropList copy constructor ///\brief Copy constructor: makes a copy of the original FileCreatPropList object. ///\param original - IN: FileCreatPropList instance to copy diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h index 79a7e25..493e28e 100644 --- a/c++/src/H5FcreatProp.h +++ b/c++/src/H5FcreatProp.h @@ -23,58 +23,59 @@ namespace H5 { // class for file access properties class H5_DLLCPP FileCreatPropList : public PropList { public: + // Default file creation property list. static const FileCreatPropList DEFAULT; - // Creates a file create property list. + // Creates a file creation property list. FileCreatPropList(); - // Copy constructor: creates a copy of a FileCreatPropList object - FileCreatPropList( const FileCreatPropList& orig ); - - // Retrieves version information for various parts of a file. - void getVersion( int& boot, int& freelist, int& stab, int& shhdr ) const; - - // Sets the userblock size field of a file creation property list. - void setUserblock( hsize_t size ) const; - - // Gets the size of a user block in this file creation property list. - hsize_t getUserblock() const; + // Returns the 1/2 rank of an indexed storage B-tree. + int getIstorek() const; - // Sets file size-of addresses and sizes. - void setSizes( size_t sizeof_addr = 4, size_t sizeof_size = 4 ) const; + // Sets the size of parameter used to control the B-trees for + // indexing chunked datasets. + void setIstorek( int ik ) const; // Retrieves the size-of address and size quantities stored in a // file according to this file creation property list. void getSizes( size_t& sizeof_addr, size_t& sizeof_size ) const; -#ifdef H5_WANT_H5_V1_4_COMPAT - // Sets the size of parameters used to control the symbol table nodes. - void setSymk( int int_nodes_k, int leaf_nodes_k ) const; + // Sets file size-of addresses and sizes. + void setSizes( size_t sizeof_addr = 4, size_t sizeof_size = 4 ) const; +#ifdef H5_WANT_H5_V1_4_COMPAT // Retrieves the size of the symbol table B-tree 1/2 rank and the // symbol table leaf node 1/2 size. void getSymk( int& int_nodes_k, int& leaf_nodes_k ) const; -#else /* H5_WANT_H5_V1_4_COMPAT */ - // Sets the size of parameters used to control the symbol table nodes. - void setSymk( int int_nodes_k, unsigned leaf_nodes_k ) const; + // Sets the size of parameters used to control the symbol table nodes. + void setSymk( int int_nodes_k, int leaf_nodes_k ) const; +#else /* H5_WANT_H5_V1_4_COMPAT */ // Retrieves the size of the symbol table B-tree 1/2 rank and the // symbol table leaf node 1/2 size. void getSymk( int& int_nodes_k, unsigned& leaf_nodes_k ) const; + + // Sets the size of parameters used to control the symbol table nodes. + void setSymk( int int_nodes_k, unsigned leaf_nodes_k ) const; #endif /* H5_WANT_H5_V1_4_COMPAT */ - // Sets the size of parameter used to control the B-trees for - // indexing chunked datasets. - void setIstorek( int ik ) const; + // Gets the size of a user block in this file creation property list. + hsize_t getUserblock() const; - // Returns the 1/2 rank of an indexed storage B-tree. - int getIstorek() const; + // Sets the userblock size field of a file creation property list. + void setUserblock( hsize_t size ) const; + + // Retrieves version information for various parts of a file. + void getVersion( int& boot, int& freelist, int& stab, int& shhdr ) const; + + // Copy constructor: creates a copy of a FileCreatPropList object + FileCreatPropList(const FileCreatPropList& orig); // Creates a copy of an existing file create property list // using the property list id - FileCreatPropList (const hid_t plist_id) : PropList( plist_id ) {} + FileCreatPropList (const hid_t plist_id); - // Default destructor + // Noop destructor. virtual ~FileCreatPropList(); }; #ifndef H5_NO_NAMESPACE diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index e176146..e4e9edd 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -43,10 +43,8 @@ namespace H5 { #endif //-------------------------------------------------------------------------- -// Function Default constructor -///\brief Default constructor - Creates a stub hdf5 file object. -///\par Description -/// The id of this hdf5 file is set to 0. +// Function H5File default constructor +///\brief Default constructor: creates a stub H5File object. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5File::H5File() : IdComponent() {} @@ -54,8 +52,8 @@ H5File::H5File() : IdComponent() {} //-------------------------------------------------------------------------- // Function: H5File overloaded constructor ///\brief Creates or opens an HDF5 file depending on the parameter flags. -///\param name - IN: Name of the file -///\param flags - IN: File access flags +///\param name - IN: Name of the file +///\param flags - IN: File access flags ///\param create_plist - IN: File creation property list, used when /// modifying default file meta-data. Default to /// FileCreatPropList::DEFAULT @@ -87,14 +85,13 @@ H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& c // Function: H5File overloaded constructor ///\brief This is another overloaded constructor. It differs from the /// above constructor only in the type of the \a name argument. -///\param name - IN: Name of the file +///\param name - IN: Name of the file - \c std::string ///\param flags - IN: File access flags ///\param create_plist - IN: File creation property list, used when /// modifying default file meta-data. Default to /// FileCreatPropList::DEFAULT ///\param access_plist - IN: File access property list. Default to /// FileCreatPropList::DEFAULT -///\param name - IN: Name of the file - \c std::string // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5File::H5File( const string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : IdComponent() @@ -135,8 +132,8 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro } //-------------------------------------------------------------------------- -// Function: Copy Constructor -///\brief Copy Constructor: Makes a copy of the original +// Function: H5File copy constructor +///\brief Copy constructor: makes a copy of the original /// H5File object. ///\param original - IN: H5File instance to copy // Programmer Binh-Minh Ribler - 2000 @@ -179,7 +176,7 @@ bool H5File::isHdf5(const string& name ) } //-------------------------------------------------------------------------- -// Function: H5File::reopen +// Function: H5File::reOpen ///\brief Reopens this file. ///\exception H5::FileIException // Description @@ -187,7 +184,7 @@ bool H5File::isHdf5(const string& name ) // HDF5 file need to be closed first. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void H5File::reopen() +void H5File::reOpen() { // reset the identifier of this H5File - send 'this' in so that // H5Fclose can be called appropriately @@ -207,6 +204,20 @@ void H5File::reopen() } //-------------------------------------------------------------------------- +// Function: H5File::reopen +///\brief Reopens this file. +///\exception H5::FileIException +///\par Description +/// This function will be replaced by the above function \c reOpen +/// in future releases. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +void H5File::reopen() +{ + H5File::reOpen(); +} + +//-------------------------------------------------------------------------- // Function: H5File::getCreatePlist ///\brief Returns the creation property list of this file ///\return FileCreatPropList object @@ -421,8 +432,7 @@ string H5File::getFileName() const ///\return A reference ///\exception H5::ReferenceIException ///\par Description -/// Note that, for H5File, name must be an absolute path to the -/// object in the file. +/// Note that name must be an absolute path to the object in the file. // Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void* H5File::Reference(const char* name, DataSpace& dataspace, H5R_type_t ref_type) const diff --git a/c++/src/H5File.h b/c++/src/H5File.h index 6493a3b..d272fa6 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -22,22 +22,25 @@ namespace H5 { class H5_DLLCPP H5File : public IdComponent, public CommonFG { public: - // Default constructor - H5File(); - - // copy constructor: makes a copy of the original H5File object. - H5File(const H5File& original ); - // Creates or opens an HDF5 file. - H5File( const string& name, unsigned int flags, + H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist = FileCreatPropList::DEFAULT, const FileAccPropList& access_plist = FileAccPropList::DEFAULT ); - H5File( const char* name, unsigned int flags, + H5File( const string& name, unsigned int flags, const FileCreatPropList& create_plist = FileCreatPropList::DEFAULT, const FileAccPropList& access_plist = FileAccPropList::DEFAULT ); - // Gets the file id - virtual hid_t getLocId() const; + // Gets the access property list of this file. + FileAccPropList getAccessPlist() const; + + // Gets the creation property list of this file. + FileCreatPropList getCreatePlist() const; + + // Gets the name of this file. + string getFileName() const; + + // Retrieves the file size of an opened file. + hsize_t getFileSize() const; // Returns the amount of free space in the file. hssize_t getFreeSpace() const; @@ -51,44 +54,42 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG { // and datatypes) in the same file. void getObjIDs(unsigned types, int max_objs, hid_t *oid_list) const; + // Retrieves the type of object that an object reference points to. + H5G_obj_t getObjType(void *ref, H5R_type_t ref_type) const; + + // Retrieves a dataspace with the region pointed to selected. + DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; + // Returns the pointer to the file handle of the low-level file driver. void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; void getVFDHandle(void **file_handle) const; // Determines if a file, specified by its name, is in HDF5 format - static bool isHdf5(const string& name ); static bool isHdf5(const char* name ); + static bool isHdf5(const string& name ); - // Gets the name of this file. - string getFileName() const; - - // Creates a reference to a named Hdf5 object in this object. - void* Reference(const char* name) const; + // Reopens this file. + void reOpen(); // added for better name + void reopen(); // Creates a reference to a named Hdf5 object or to a dataset region // in this object. void* Reference(const char* name, DataSpace& dataspace, H5R_type_t ref_type = H5R_DATASET_REGION) const; - // Retrieves the type of object that an object reference points to. - H5G_obj_t getObjType(void *ref, H5R_type_t ref_type) const; - - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; - - // Retrieves the file size of an opened file. - hsize_t getFileSize() const; + // Creates a reference to a named Hdf5 object in this object. + void* Reference(const char* name) const; - // Reopens this file. - void reopen(); + // Throw file exception. + virtual void throwException(const string func_name, const string msg) const; - // Gets the creation property list of this file. - FileCreatPropList getCreatePlist() const; + // Gets the file id + virtual hid_t getLocId() const; - // Gets the access property list of this file. - FileAccPropList getAccessPlist() const; + // Default constructor + H5File(); - // Throw file exception. - virtual void throwException(const string func_name, const string msg) const; + // Copy constructor: makes a copy of the original H5File object. + H5File(const H5File& original); #ifndef DOXYGEN_SHOULD_SKIP_THIS // Used by the API to appropriately close a file. diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h index e9163cb..bdc2f6f 100644 --- a/c++/src/H5FloatType.h +++ b/c++/src/H5FloatType.h @@ -22,38 +22,23 @@ namespace H5 { class H5_DLLCPP FloatType : public AtomType { public: - // default constructor - FloatType(); - - // Creates a floating-point datatype using an existing id - FloatType( const hid_t existing_id ); - // Creates a floating-point type using a predefined type FloatType( const PredType& pred_type ); - // Copy constructor: makes a copy of the original FloatType object. - FloatType( const FloatType& original ); - // Gets the floating-point datatype of the specified dataset FloatType( const DataSet& dataset ); - // Retrieves floating point datatype bit field information. - void getFields( size_t& spos, size_t& epos, size_t& esize, size_t& mpos, size_t& msize ) const; - - // Sets locations and sizes of floating point bit fields. - void setFields( size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize ) const; - // Retrieves the exponent bias of a floating-point type. size_t getEbias() const; // Sets the exponent bias of a floating-point type. void setEbias( size_t ebias ) const; - // Retrieves mantissa normalization of a floating-point datatype. - H5T_norm_t getNorm( string& norm_string ) const; + // Retrieves floating point datatype bit field information. + void getFields( size_t& spos, size_t& epos, size_t& esize, size_t& mpos, size_t& msize ) const; - // Sets the mantissa normalization of a floating-point datatype. - void setNorm( H5T_norm_t norm ) const; + // Sets locations and sizes of floating point bit fields. + void setFields( size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize ) const; // Retrieves the internal padding type for unused bits in floating-point datatypes. H5T_pad_t getInpad( string& pad_string ) const; @@ -61,6 +46,22 @@ class H5_DLLCPP FloatType : public AtomType { // Fills unused internal floating point bits. void setInpad( H5T_pad_t inpad ) const; + // Retrieves mantissa normalization of a floating-point datatype. + H5T_norm_t getNorm( string& norm_string ) const; + + // Sets the mantissa normalization of a floating-point datatype. + void setNorm( H5T_norm_t norm ) const; + + // Default constructor + FloatType(); + + // Creates a floating-point datatype using an existing id + FloatType( const hid_t existing_id ); + + // Copy constructor: makes a copy of the original FloatType object. + FloatType( const FloatType& original ); + + // Noop destructor. virtual ~FloatType(); }; #ifndef H5_NO_NAMESPACE diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index 398d181..dd03df1 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -44,7 +44,7 @@ namespace H5 { //-------------------------------------------------------------------------- // Function: Group default constructor -///\brief Default constructor: Creates a stub group +///\brief Default constructor: creates a stub Group. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Group::Group() : H5Object() {} diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index 6ed2a4a..654af18 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -22,11 +22,11 @@ namespace H5 { class H5_DLLCPP Group : public H5Object, public CommonFG { public: - // default constructor - Group(); + // Retrieves the type of object that an object reference points to. + H5G_obj_t getObjType(void *ref, H5R_type_t ref_type) const; - // Copy constructor: makes a copy of the original object - Group( const Group& original ); + // Retrieves a dataspace with the region pointed to selected. + DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; // Creates a reference to a named Hdf5 object or to a dataset region // in this object. @@ -35,16 +35,17 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { // Creates a reference to a named Hdf5 object in this object. void* Reference(const char* name) const; - // Retrieves the type of object that an object reference points to. - H5G_obj_t getObjType(void *ref, H5R_type_t ref_type) const; + // Throw group exception. + virtual void throwException(const string func_name, const string msg) const; - // Retrieves a dataspace with the region pointed to selected. - DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; // for CommonFG to get the file id. virtual hid_t getLocId() const; - // Throw group exception. - virtual void throwException(const string func_name, const string msg) const; + // default constructor + Group(); + + // Copy constructor: makes a copy of the original object + Group(const Group& original); #ifndef DOXYGEN_SHOULD_SKIP_THIS // Used by the API to appropriately close a group - will be obsolete. diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index cf5ae95..0508657 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -26,17 +26,6 @@ namespace H5 { #endif //-------------------------------------------------------------------------- -// Function: IdComponent default constructor - private -///\brief Default constructor. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -IdComponent::IdComponent() : id( -1 ) -{ - // starts counting object references - ref_count = new RefCounter; -} - -//-------------------------------------------------------------------------- // Function: IdComponent overloaded constructor ///\brief Creates an IdComponent object using the id of an existing object. ///\param h5_id - IN: Id of an existing object @@ -64,14 +53,14 @@ IdComponent::IdComponent( const IdComponent& original ) //-------------------------------------------------------------------------- // Function: IdComponent::incRefCount -///\brief Increment id reference counter. +///\brief Increments id reference counter. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void IdComponent::incRefCount() { ref_count->increment(); } //-------------------------------------------------------------------------- // Function: IdComponent::decRefCount -///\brief Decrement id reference counter. +///\brief Decrements id reference counter. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void IdComponent::decRefCount() { ref_count->decrement(); } @@ -140,11 +129,13 @@ IdComponent& IdComponent::operator=( const IdComponent& rhs ) ///\brief Sets the identifier of this object to a new value. ///\exception H5::IdComponentException when the attempt to close the HDF5 /// object fails -// Description: -// Reset the current id of this object so that the HDF5 -// id can be appropriately closed. If only this object references -// its id, its reference counter will be deleted. A new -// reference counter is created for the new HDF5 object id. +///\par Description: +/// The calling routine must reset the id of this object by +/// calling resetIdComponent and passing in the "this" pointer. +/// resetIdComponent ensures that the HDF5 id will be +/// appropriately closed. If only this object references its +/// id, its reference counter will be deleted. A new reference +/// counter is created for the new HDF5 object id. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void IdComponent::setId( hid_t new_id ) @@ -164,8 +155,8 @@ void IdComponent::setId( hid_t new_id ) //-------------------------------------------------------------------------- // Function: IdComponent::getId -///\brief Returns the id of this object -///\return HDF5 id +///\brief Returns the id of this object. +///\return HDF5 object id // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- hid_t IdComponent::getId () const @@ -173,7 +164,12 @@ hid_t IdComponent::getId () const return( id ); } -// Reset this object by deleting its RefCounter +//-------------------------------------------------------------------------- +// Function: IdComponent::reset +///\brief Reset this object by deleting/resetting its reference counter. +///\return HDF5 object id +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- void IdComponent::reset () { delete ref_count; @@ -324,6 +320,18 @@ hid_t IdComponent::p_get_region(void *ref, H5R_type_t ref_type) const } return(space_id); } + +//-------------------------------------------------------------------------- +// Function: IdComponent default constructor - private +///\brief Default constructor. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +IdComponent::IdComponent() : id(-1) +{ + // starts counting object references + ref_count = new RefCounter; +} + #endif // DOXYGEN_SHOULD_SKIP_THIS #ifndef H5_NO_NAMESPACE diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h index bea8cd4..5c84990 100644 --- a/c++/src/H5IdComponent.h +++ b/c++/src/H5IdComponent.h @@ -25,19 +25,6 @@ namespace H5 { class H5_DLLCPP IdComponent { public: - // Parent classes must reset the current IdComponent copy - // before setting new id to control reference count - void setId( hid_t new_id ); - - // Creates an object to hold an HDF5 identifier - IdComponent( const hid_t h5_id ); - - // Copy constructor: makes copy of the original IdComponent object. - IdComponent( const IdComponent& original ); - - // Gets the value of IdComponent's data member - virtual hid_t getId () const; - // Increment reference counter void incRefCount(); @@ -56,6 +43,18 @@ class H5_DLLCPP IdComponent { void reset(); + // Sets the identifier of this object to a new value. + void setId( hid_t new_id ); + + // Creates an object to hold an HDF5 identifier + IdComponent( const hid_t h5_id ); + + // Copy constructor: makes copy of the original IdComponent object. + IdComponent( const IdComponent& original ); + + // Gets the value of IdComponent's data member + virtual hid_t getId () const; + // Pure virtual function so appropriate close function can // be called by subclasses' for the corresponding object // This function will be obsolete because its functionality @@ -73,7 +72,7 @@ class H5_DLLCPP IdComponent { RefCounter* ref_count; // used to keep track of the // number of copies of an object - // Default constructor + // Default constructor. IdComponent(); // Gets the name of the file, in which an HDF5 object belongs. diff --git a/c++/src/H5Idtemplates.h b/c++/src/H5Idtemplates.h index 12f5aeb..7e7c37b 100644 --- a/c++/src/H5Idtemplates.h +++ b/c++/src/H5Idtemplates.h @@ -22,10 +22,23 @@ namespace H5 { #endif -// Older compilers (baldric) don't support template member functions -// and IdComponent::reset is one; so at this time, the resetId is not -// a member function so it can be template to work around that problem. - +//-------------------------------------------------------------------------- +// Function: resetIdComponent +///\brief Resets the id of the passed-in object. +///\param obj - IN: A "this" pointer of an IdComponent object +///\exception H5::Exception's subclasses, thrown by p_close +///\par Description: +/// This function is used to reset an IdComponent object +/// before using it again for another HDF5 object. If +/// the member \a id is the valid id of an HDF5 object, which +/// this IdComponent object represents, the associate close +/// function will be called to properly close the HDF5 object. +// +// Note: Some older compilers don't support template member functions; +// so at this time, resetIdComponent is not a member function so +// it can be template to work around that problem. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- template <class Type> H5_DLLCPP void resetIdComponent( Type* obj ) // pointer to object to be reset diff --git a/c++/src/H5Include.h b/c++/src/H5Include.h index c432595..df59653 100644 --- a/c++/src/H5Include.h +++ b/c++/src/H5Include.h @@ -20,3 +20,18 @@ // by #include <hdf5.h>, but decide not to. BMR - 3/22/01 #include <hdf5.h> + +// Define bool type for platforms that don't support bool yet +#ifdef BOOL_NOTDEFINED +#ifdef false +#undef false +#endif +#ifdef true +#undef true +#endif +typedef int bool; +const bool false = 0; +const bool true = 1; +#endif + + diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h index 5d8b1f9..efbed39 100644 --- a/c++/src/H5IntType.h +++ b/c++/src/H5IntType.h @@ -21,25 +21,11 @@ namespace H5 { #endif class H5_DLLCPP IntType : public AtomType { public: - - // default constructor - IntType(); - - // Creates a integer datatype using an existing id - IntType( const hid_t existing_id ); - // Creates a integer type using a predefined type - IntType( const PredType& pred_type ); - - // Copy constructor: makes copy of IntType object - IntType( const IntType& original ); + IntType(const PredType& pred_type); // Gets the integer datatype of the specified dataset - IntType( const DataSet& dataset ); - - // Assignment operator that takes a predefined type - // may not use - BMR - // virtual IntType& operator=( const PredType& rhs ); + IntType(const DataSet& dataset); // Retrieves the sign type for an integer type H5T_sign_t getSign() const; @@ -47,6 +33,16 @@ class H5_DLLCPP IntType : public AtomType { // Sets the sign proprety for an integer type. void setSign( H5T_sign_t sign ) const; + // Default constructor + IntType(); + + // Creates a integer datatype using an existing id + IntType(const hid_t existing_id); + + // Copy constructor: makes copy of IntType object + IntType(const IntType& original); + + // Noop destructor. virtual ~IntType(); }; #ifndef H5_NO_NAMESPACE diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp index fa36e0f..ff9a7d1 100644 --- a/c++/src/H5Library.cpp +++ b/c++/src/H5Library.cpp @@ -60,7 +60,7 @@ void H5Library::close() //-------------------------------------------------------------------------- // Function: H5Library::dontAtExit -///\brief Instructs library not to install atexit cleanup routine +///\brief Instructs library not to install \c atexit cleanup routine ///\exception H5::LibraryIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- @@ -95,9 +95,9 @@ void H5Library::getLibVersion( unsigned& majnum, unsigned& minnum, unsigned& rel // Function: H5Library::checkVersion ///\brief Verifies that the arguments match the version numbers /// compiled into the library -///\param majnum - OUT: Major version of the library -///\param minnum - OUT: Minor version of the library -///\param relnum - OUT: Release number of the library +///\param majnum - IN: Major version of the library +///\param minnum - IN: Minor version of the library +///\param relnum - IN: Release number of the library ///\exception H5::LibraryIException ///\par Description /// For information about library version, please refer to diff --git a/c++/src/H5Library.h b/c++/src/H5Library.h index 9dac9a8..404fda6 100644 --- a/c++/src/H5Library.h +++ b/c++/src/H5Library.h @@ -20,7 +20,9 @@ namespace H5 { #endif +#ifndef DOXYGEN_SHOULD_SKIP_THIS #define NOTATEXIT (-10) // just in case the HDF5 library use more +#endif // DOXYGEN_SHOULD_SKIP_THIS // negative constants. Note: the solution used for the atexit/global // destructors is not reliable, and desperately needs improvement // It is not even working, inifiteloop message still printed when diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 76d9b6c..774ea41 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -32,6 +32,7 @@ namespace H5 { #endif +#ifndef DOXYGEN_SHOULD_SKIP_THIS // userAttrOpWrpr simply interfaces between the user's function and the // C library function H5Aiterate; used to resolve the different prototype // problem. May be moved to Iterator later. @@ -50,21 +51,23 @@ extern "C" herr_t userAttrOpWrpr( hid_t loc_id, const char* attr_name, void* op_ //-------------------------------------------------------------------------- // Function: H5Object default constructor (protected) // Description -// The id is set to 0 here but subclass constructor will set -// it to a valid HDF5 id. +// The id is set by IdComponent() but subclass constructor will +// set it to a valid HDF5 id. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Object::H5Object() : IdComponent() {} //-------------------------------------------------------------------------- // Function: H5Object overloaded constructor (protected) -// Purpose Creates an H5Object object using the id of an existing H5 +// Purpose Creates an H5Object object using the id of an existing HDF5 // object. -// Parameters object_id - IN: Id of an existing H5 object +// Parameters object_id - IN: Id of an existing HDF5 object // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Object::H5Object( const hid_t object_id ) : IdComponent( object_id ) {} +#endif // DOXYGEN_SHOULD_SKIP_THIS + //-------------------------------------------------------------------------- // Function: H5Object copy constructor ///\brief Copy constructor: makes a copy of the original H5Object @@ -222,7 +225,7 @@ int H5Object::iterateAttrs( attr_operator_t user_op, unsigned * idx, void *op_da //-------------------------------------------------------------------------- // Function: H5Object::getNumAttrs -///\brief Returns the number of attributes attached to this H5 object. +///\brief Returns the number of attributes attached to this HDF5 object. ///\return Number of attributes ///\exception H5::AttributeIException // Programmer Binh-Minh Ribler - 2000 diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h index b99764c..fdc6c76 100644 --- a/c++/src/H5Object.h +++ b/c++/src/H5Object.h @@ -27,6 +27,7 @@ namespace H5 { #endif +#ifndef DOXYGEN_SHOULD_SKIP_THIS class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate // Define the operator function pointer for H5Aiterate(). @@ -34,7 +35,6 @@ typedef void (*attr_operator_t)( H5Object& loc/*in*/, const string attr_name/*in*/, void *operator_data/*in,out*/); -#ifndef DOXYGEN_SHOULD_SKIP_THIS class UserData4Aiterate { // user data for attribute iteration public: unsigned int* idx; @@ -48,12 +48,6 @@ class UserData4Aiterate { // user data for attribute iteration class H5_DLLCPP H5Object : public IdComponent { public: - // Copy constructor: makes copy of an H5Object object. - H5Object( const H5Object& original ); - - // Flushes all buffers associated with this object to disk - void flush( H5F_scope_t scope ) const; - // Creates an attribute for a group, dataset, or named datatype. // PropList is currently not used, so always be default. Attribute createAttribute( const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const; @@ -66,29 +60,36 @@ class H5_DLLCPP H5Object : public IdComponent { // Opens an attribute given its index. Attribute openAttribute( const unsigned int idx ) const; - // Iterate user's function over the attributes of this object - int iterateAttrs( attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL ); + // Flushes all buffers associated with this object to disk + void flush( H5F_scope_t scope ) const; + + // Gets the name of the file, in which this HDF5 object belongs. + string getFileName() const; // Determines the number of attributes attached to this object. int getNumAttrs() const; + // Iterate user's function over the attributes of this object + int iterateAttrs( attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL ); + // Removes the named attribute from this object. void removeAttr( const char* name ) const; void removeAttr( const string& name ) const; - // Gets the name of the file, in which this HDF5 object belongs. - string getFileName() const; + // Copy constructor: makes copy of an H5Object object. + H5Object(const H5Object& original); - // Noop destructor + // Noop destructor. virtual ~H5Object(); protected: - +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Default constructor H5Object(); // Creates a copy of an existing object giving the object id H5Object( const hid_t object_id ); +#endif // DOXYGEN_SHOULD_SKIP_THIS }; /* end class H5Object */ diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp index e951675..1208a1a 100644 --- a/c++/src/H5PredType.cpp +++ b/c++/src/H5PredType.cpp @@ -31,13 +31,7 @@ namespace H5 { #endif -//-------------------------------------------------------------------------- -// Function: PredType default constructor -///\brief Default constructor: Creates a stub predefined datatype -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -PredType::PredType() : AtomType() {} - +#ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: PredType overloaded constructor ///\brief Creates a PredType object using the id of an existing @@ -54,29 +48,19 @@ PredType::PredType( const hid_t predtype_id ) : AtomType( predtype_id ) } //-------------------------------------------------------------------------- -// Function: PredType copy constructor -///\brief Copy constructor: makes a copy of the original PredType object. -///\param original - IN: PredType instance to copy +// Function: PredType default constructor +///\brief Default constructor: Creates a stub predefined datatype // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -PredType::PredType( const PredType& original ) : AtomType( original ) {} +PredType::PredType() : AtomType() {} //-------------------------------------------------------------------------- -// Function: PredType::operator= -///\brief Assignment operator. -///\param rhs - IN: Reference to the predefined datatype -///\return Reference to PredType instance -///\exception H5::DataTypeIException -// Description -// Makes a copy of the type on the right hand side and stores -// the new id in the left hand side object. +// Function: PredType copy constructor +///\brief Copy constructor: makes a copy of the original PredType object. +///\param original - IN: PredType instance to copy // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -PredType& PredType::operator=( const PredType& rhs ) -{ - copy(rhs); - return(*this); -} +PredType::PredType( const PredType& original ) : AtomType( original ) {} const PredType PredType::NotAtexit; // only for atexit/global dest. problem @@ -225,6 +209,24 @@ const PredType PredType::NATIVE_INT_LEAST64( E_NATIVE_INT_LEAST64 ); const PredType PredType::NATIVE_UINT_LEAST64( E_NATIVE_UINT_LEAST64 ); const PredType PredType::NATIVE_INT_FAST64( E_NATIVE_INT_FAST64 ); const PredType PredType::NATIVE_UINT_FAST64( E_NATIVE_UINT_FAST64 ); +#endif // DOXYGEN_SHOULD_SKIP_THIS + +//-------------------------------------------------------------------------- +// Function: PredType::operator= +///\brief Assignment operator. +///\param rhs - IN: Reference to the predefined datatype +///\return Reference to PredType instance +///\exception H5::DataTypeIException +// Description +// Makes a copy of the type on the right hand side and stores +// the new id in the left hand side object. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- +PredType& PredType::operator=( const PredType& rhs ) +{ + copy(rhs); + return(*this); +} //-------------------------------------------------------------------------- // Function: PredType::getId @@ -503,6 +505,7 @@ hid_t PredType::getId() const } // end switch } // end of getId() +#ifndef DOXYGEN_SHOULD_SKIP_THIS // These dummy functions do not inherit from DataType - they'll // throw an DataTypeIException if invoked. void PredType::commit( H5Object& loc, const char* name ) @@ -520,8 +523,14 @@ bool PredType::committed() throw DataTypeIException("PredType::committed", "Error: Attempting to check for commit status on a predefined datatype." ); return (0); } +#endif // DOXYGEN_SHOULD_SKIP_THIS // Default destructor +//-------------------------------------------------------------------------- +// Function: PredType destructor +///\brief Noop destructor. +// Programmer Binh-Minh Ribler - 2000 +//-------------------------------------------------------------------------- PredType::~PredType() {} #ifndef H5_NO_NAMESPACE diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h index 6529425..b51aca0 100644 --- a/c++/src/H5PredType.h +++ b/c++/src/H5PredType.h @@ -27,15 +27,17 @@ namespace H5 { class H5_DLLCPP PredType : public AtomType { public: - // Default destructor - virtual ~PredType(); - - // Copy constructor - makes copy of the original object - PredType( const PredType& original ); + // Makes a copy of the predefined type and stores the new + // id in the left hand side object. + PredType& operator=( const PredType& rhs ); + // Returns the HDF5 predefined type id. virtual hid_t getId() const; - // Declaration of predefined types; their definition is in Predtype.C + // Default destructor + virtual ~PredType(); + + // Declaration of predefined types; their definition is in H5PredType.cpp static const PredType STD_I8BE; static const PredType STD_I8LE; static const PredType STD_I16BE; @@ -173,11 +175,13 @@ class H5_DLLCPP PredType : public AtomType { static const PredType NATIVE_INT_FAST64; static const PredType NATIVE_UINT_FAST64; +#ifndef DOXYGEN_SHOULD_SKIP_THIS // These dummy functions do not inherit from DataType - they'll // throw a DataTypeIException if invoked. void commit( H5Object& loc, const string& name ); void commit( H5Object& loc, const char* name ); bool committed(); +#endif // DOXYGEN_SHOULD_SKIP_THIS private: // added this to work around the atexit/global destructor problem @@ -233,15 +237,18 @@ class H5_DLLCPP PredType : public AtomType { }; protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS // Default constructor PredType(); // Creates a pre-defined type using an HDF5 pre-defined constant PredType( const hid_t predtype_id ); // used by the library only - // Makes a copy of the predefined type and stores the new - // id in the left hand side object. - PredType& operator=( const PredType& rhs ); + // Copy constructor - makes copy of the original object + PredType( const PredType& original ); + +#endif // DOXYGEN_SHOULD_SKIP_THIS + }; #ifndef H5_NO_NAMESPACE } diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 30bb0f1..065e77a 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -31,22 +31,22 @@ namespace H5 { #endif //-------------------------------------------------------------------------- -///\brief Constant for default property +///\brief Constant for default property. //-------------------------------------------------------------------------- const PropList PropList::DEFAULT( H5P_DEFAULT ); //-------------------------------------------------------------------------- // Function Default constructor -///\brief Default constructor - Creates a stub property list object. -///\par Description -/// The id of this property list is set to 0. +///\brief Default constructor: creates a stub property list object. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -PropList::PropList() : IdComponent( 0 ) {} +PropList::PropList() : IdComponent(0) {} //-------------------------------------------------------------------------- // Function: PropList copy constructor ///\brief Copy constructor ///\param original - IN: The original property list to copy +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- PropList::PropList( const PropList& original ) : IdComponent( original ) {} @@ -62,6 +62,7 @@ PropList::PropList( const PropList& original ) : IdComponent( original ) {} // 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. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- PropList::PropList( const hid_t plist_id ) : IdComponent(0) { @@ -86,6 +87,7 @@ PropList::PropList( const hid_t plist_id ) : IdComponent(0) ///\brief Makes a copy of an existing property list ///\param like_plist - IN: Reference to the existing property list ///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void PropList::copy( const PropList& like_plist ) { @@ -111,12 +113,14 @@ void PropList::copy( const PropList& like_plist ) //-------------------------------------------------------------------------- // Function: PropList::operator= -///\brief Assignment operator +///\brief Assignment operator. ///\param rhs - IN: Reference to the existing property list -/// +///\return Reference to PropList instance +///\exception H5::PropListIException // Description // Makes a copy of the property list on the right hand side // and stores the new id in the left hand side object. +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- PropList& PropList::operator=( const PropList& rhs ) { @@ -126,10 +130,12 @@ PropList& PropList::operator=( const PropList& rhs ) //-------------------------------------------------------------------------- // Function: PropList::copyProp -///\brief Copies a property from one list or class to another +///\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 +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void PropList::copyProp( PropList& dest, PropList& src, const char *name ) const { @@ -149,6 +155,8 @@ void PropList::copyProp( PropList& dest, PropList& src, const char *name ) const ///\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 +///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void PropList::copyProp( PropList& dest, PropList& src, const string& name ) const { @@ -183,6 +191,7 @@ void PropList::p_close() const ///\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 +// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- hid_t PropList::getClass() const { @@ -478,7 +487,7 @@ void PropList::setProperty(const string& name, string& strg) const //-------------------------------------------------------------------------- // Function: PropList::isAClass -///\brief Determines whether a property list is a certain class +///\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. @@ -501,7 +510,7 @@ bool PropList::isAClass(const PropList& prop_class) const //-------------------------------------------------------------------------- // Function: PropList::removeProp -///\brief Removes a property from a property list +///\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 diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h index 438b0ee..557a39b 100644 --- a/c++/src/H5PropList.h +++ b/c++/src/H5PropList.h @@ -25,69 +25,79 @@ class H5_DLLCPP PropList : public IdComponent { // Default property list static const PropList DEFAULT; - // Creates a property list of a given type or creates a copy of an - // existing property list giving the property list id - PropList( const hid_t plist_id ); + // Make a copy of the given property list using assignment statement + PropList& operator=( const PropList& rhs ); - // Default constructor: creates a PropList object - this object - // does not represent any property list yet. - PropList(); + // Compares this property list or class against the given list or class. + bool operator==(const PropList& rhs) const; - // Copy constructor: creates a copy of a PropList object. - PropList( const PropList& original ); + // Close a property list class. + void closeClass() const; // Makes a copy of the given property list. void copy( const PropList& like_plist ); - // Make a copy of the given property list using assignment statement - 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) const; void copyProp( PropList& dest, PropList& src, const char* name) const; + void copyProp( PropList& dest, PropList& src, const string& 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; + // Return the name of a generic property list class. + string getClassName() const; - void closeClass() const; + // Returns the parent class of a generic property class. + PropList getClassParent() const; + + // Returns the number of properties in this property list or class. + size_t getNumProps() const; + // Query the value of a property in a property list. 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; - + // Set a property's value in a property list. 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; + // Query the size of a property in a property list or class. + size_t getPropSize(const char *name) const; + size_t getPropSize(const string& name) const; + + // Determines whether a property list is a certain class. bool isAClass(const PropList& prop_class) const; + /// Query the existance of a property in a property object. + bool propExist(const char* name) const; + bool propExist(const string& name) const; + + // Removes a property from a property list. void removeProp(const char *name) const; void removeProp(const string& name) const; - bool operator==(const PropList& rhs) const; + // Default constructor: creates a stub PropList object. + PropList(); - PropList getClassParent() const; + // Creates a property list of a given type or creates a copy of an + // existing property list giving the property list id. + PropList(const hid_t plist_id); + + // Copy constructor: creates a copy of a PropList object. + PropList(const PropList& original); #ifndef DOXYGEN_SHOULD_SKIP_THIS - // Used by the API to close the property list + // Used by the API to close the property list. void p_close() const; #endif // DOXYGEN_SHOULD_SKIP_THIS + // Destructor: properly terminates access to this property list. virtual ~PropList(); }; diff --git a/c++/src/H5RefCounter.cpp b/c++/src/H5RefCounter.cpp index 1a0eff4..3489996 100644 --- a/c++/src/H5RefCounter.cpp +++ b/c++/src/H5RefCounter.cpp @@ -22,29 +22,29 @@ namespace H5 { //-------------------------------------------------------------------------- // Function: RefCounter default constructor -///\brief Default constructor: Creates a reference counter and set it -/// to 1. +//=\brief Default constructor: Creates a reference counter and set it +//= to 1. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- RefCounter::RefCounter() : counter(1) {} //-------------------------------------------------------------------------- // Function: RefCounter::getCounter -///\brief Returns the current value of the reference counter. +//=\brief Returns the current value of the reference counter. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int RefCounter::getCounter () const { return counter; } //-------------------------------------------------------------------------- // Function: RefCounter::increment -///\brief Increments the reference counter. +//=\brief Increments the reference counter. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void RefCounter::increment() { counter++; } //-------------------------------------------------------------------------- // Function: RefCounter::decrement -///\brief Decrements the reference counter. +//=\brief Decrements the reference counter. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void RefCounter::decrement() @@ -58,11 +58,11 @@ void RefCounter::decrement() //-------------------------------------------------------------------------- // Function: RefCounter::noReference -///\brief Returns true if there are no more reference to the object -/// that uses this counter. -///\return true if there are no more reference to the object -/// that uses this counter, and false, otherwise. -///\note This function will be obsolete in the next release. +//=\brief Returns true if there are no more reference to the object +//= that uses this counter. +//=\return true if there are no more reference to the object +//= that uses this counter, and false, otherwise. +//=\note This function will be obsolete in the next release. // Description // Decrements the reference counter then determines if there // are no more reference to the object that uses this counter. @@ -77,7 +77,7 @@ bool RefCounter::noReference() //-------------------------------------------------------------------------- // Function: RefCounter destructor -///\brief Noop destructor. +//=\brief Noop destructor. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- RefCounter::~RefCounter() {} diff --git a/c++/src/H5RefCounter.h b/c++/src/H5RefCounter.h index ebb2832..212515d 100644 --- a/c++/src/H5RefCounter.h +++ b/c++/src/H5RefCounter.h @@ -20,22 +20,6 @@ namespace H5 { #endif -// define bool type for platforms that don't support bool yet -// Note: it is added here because most of the C++ library source -// files include this header file -#ifdef BOOL_NOTDEFINED -#ifdef false -#undef false -#endif -#ifdef true -#undef true -#endif -typedef int bool; -const bool false = 0; -const bool true = 1; - -#endif - class H5_DLLCPP RefCounter { public: // Creates a reference counter to be used by an HDF5 object diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h index 6ee6025..9e4483e 100644 --- a/c++/src/H5StrType.h +++ b/c++/src/H5StrType.h @@ -22,39 +22,40 @@ namespace H5 { class H5_DLLCPP StrType : public AtomType { public: - // default constructor - StrType(); - // Creates a string type using a predefined type - StrType( const PredType& pred_type ); + StrType(const PredType& pred_type); // Creates a string type with specified length - StrType( const size_t& size ); + StrType(const size_t& size); // Creates a string type with specified length - will be obsolete - StrType( const PredType& pred_type, const size_t size ); - - // Creates a string datatype using an existing id - StrType( const hid_t existing_id ); - - // Copy constructor - makes a copy of the original object - StrType( const StrType& original ); + StrType(const PredType& pred_type, const size_t size); // Gets the string datatype of the specified dataset - StrType( const DataSet& dataset ); + StrType(const DataSet& dataset); // Retrieves the character set type of this string datatype. H5T_cset_t getCset() const; // Sets character set to be used. - void setCset( H5T_cset_t cset ) const; + void setCset(H5T_cset_t cset) const; // Retrieves the string padding method for this string datatype. H5T_str_t getStrpad() const; // Defines the storage mechanism for character strings. - void setStrpad( H5T_str_t strpad ) const; + void setStrpad(H5T_str_t strpad) const; + + // default constructor + StrType(); + + // Creates a string datatype using an existing id + StrType(const hid_t existing_id); + + // Copy constructor - makes a copy of the original object + StrType(const StrType& original); + // Noop destructor. virtual ~StrType(); }; #ifndef H5_NO_NAMESPACE |