summaryrefslogtreecommitdiffstats
path: root/c++/src/H5FaccProp.C
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2000-11-14 21:30:12 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2000-11-14 21:30:12 (GMT)
commit92041a68656c59813619ae1f26ed211b7f028e86 (patch)
treeaaa3256c9a9f0adde21570eac9254f7ce00450b1 /c++/src/H5FaccProp.C
parent36acd5381e3977164e0d6d666f8ce97cc53f9387 (diff)
downloadhdf5-92041a68656c59813619ae1f26ed211b7f028e86.zip
hdf5-92041a68656c59813619ae1f26ed211b7f028e86.tar.gz
hdf5-92041a68656c59813619ae1f26ed211b7f028e86.tar.bz2
[svn-r2897] Purpose:
C++ API for 1.3.x branch Description: The *.C and *.h files named different than those in 1.2.x. They are in the form: 'H5' + classname, or just classname if the classname is already prefixed with 'H5' to avoid ambiguity in documentation context. This version has several hidden bugs fixed and an improvement on the reference counting approach. The classes and their inheritance structure are listed below: --------------------------------------- H5Library Exception RefCounter IdComponent H5File DataSpace H5Object Group AbstractDs DataSet Attribute DataType PredType EnumType CompType AtomType StrType IntType FloatType PropList FileCreatPropList FileAccPropList DSetCreatPropList DSetMemXferPropList --------------------------------------- IdComponent uses RefCounter to keep track of opened objects so proper termination of HDF5 objects can be maintained. Each class has a .h file containing the class declaration and a .C file containing its definition. In addition to the classes files, the following files do not have class information: - H5Cpp.h: header file to be included in user's application - H5Idtemplates.h: contains a template function used by several classes - H5Classes.h: contains forward class declarations - H5CommonFG.*: contains common code used by classes H5File and Group - H5Include.h: contains the hdf5.h header file and the #undef RCSID to work around the problem: multiple defined RcsId - H5Alltypes.h: simply serves as a container to hold the header files of all datatypes to simplify the header file inclusion Platforms: Solaris (arabica) and Linux
Diffstat (limited to 'c++/src/H5FaccProp.C')
-rw-r--r--c++/src/H5FaccProp.C244
1 files changed, 244 insertions, 0 deletions
diff --git a/c++/src/H5FaccProp.C b/c++/src/H5FaccProp.C
new file mode 100644
index 0000000..a59173d
--- /dev/null
+++ b/c++/src/H5FaccProp.C
@@ -0,0 +1,244 @@
+#include <string>
+
+#include "H5Include.h"
+#include "H5RefCounter.h"
+#include "H5Exception.h"
+#include "H5IdComponent.h"
+#include "H5PropList.h"
+#include "H5FaccProp.h"
+
+#ifndef H5_NO_NAMESPACE
+namespace H5 {
+#endif
+
+const FileAccPropList FileAccPropList::DEFAULT( H5P_DEFAULT );
+
+// Creates a file access property list
+FileAccPropList::FileAccPropList() : PropList( H5P_FILE_ACCESS ) {}
+
+// Copy constructor: makes a copy of the original FileAccPropList object;
+FileAccPropList::FileAccPropList( const FileAccPropList& orig ) : PropList( orig ) {}
+
+// Copies a file access property list using assignment statement
+// Notes: can this be inherited from PropList??? and copy or operator=???
+FileAccPropList& FileAccPropList::operator=( const FileAccPropList& rhs )
+{
+ copy (rhs);
+ return( *this );
+}
+
+/* commented out for 1.3.x, only in 1.2.x
+void FileAccPropList::setStdio() const
+{
+ herr_t ret_value = H5Pset_stdio( id );
+ if( ret_value < 0 )
+ {
+ throw PropListIException();
+ }
+}
+
+bool FileAccPropList::getStdio() const
+{
+ herr_t ret_value = H5Pget_stdio( id );
+ if( ret_value < 0 )
+ return( false );
+ else
+ return( true );
+}
+
+H5F_driver_t FileAccPropList::getDriver() const
+{
+ H5F_driver_t driver = H5Pget_driver( id );
+ if( driver == H5F_LOW_ERROR )
+ {
+ throw PropListIException();
+ }
+ return( driver );
+}
+
+void FileAccPropList::setSec2() const
+{
+ herr_t ret_value = H5Pset_sec2( id );
+ if( ret_value < 0 )
+ {
+ throw PropListIException();
+ }
+}
+
+bool FileAccPropList::getSec2() const
+{
+ herr_t ret_value = H5Pget_sec2( id );
+ if( ret_value < 0 )
+ return( false );
+ else
+ return( true );
+}
+
+void FileAccPropList::setCore( size_t increment ) const
+{
+ herr_t ret_value = H5Pset_core( id, increment );
+ if( ret_value < 0 )
+ {
+ throw PropListIException();
+ }
+}
+
+bool FileAccPropList::getCore( size_t& increment) const
+{
+ herr_t ret_value = H5Pget_core( id, &increment );
+ if( ret_value < 0 )
+ return( false );
+ else
+ return( true );
+}
+
+void FileAccPropList::setFamily( hsize_t memb_size, const FileAccPropList& memb_plist ) const
+{
+ herr_t ret_value = H5Pset_family( id, memb_size, memb_plist.getId() );
+ if( ret_value < 0 )
+ {
+ throw PropListIException();
+ }
+}
+
+//Note: working on this return value here. added copy constructor
+//that uses PropList copy const. but din't work
+// Determines whether the file access property list is set to the family
+// driver then retrieves the family member's property list and returns
+// true or false
+bool FileAccPropList::getFamily( hsize_t& memb_size, FileAccPropList& memb_plist ) const
+{
+ hid_t memb_plist_id;
+ herr_t ret_value = H5Pget_family( id, &memb_size, &memb_plist_id );
+ if( ret_value < 0 )
+ {
+ memb_plist.setId( 0 );
+ return( false );
+ }
+ else
+ {
+ memb_plist.setId( memb_plist_id );
+ return( true );
+ }
+}
+
+void FileAccPropList::setSplit( FileAccPropList& meta_plist, FileAccPropList& raw_plist, const char* meta_ext, const char* raw_ext ) const
+{
+ hid_t meta_pid = meta_plist.getId();
+ hid_t raw_pid = raw_plist.getId();
+ herr_t ret_value = H5Pset_split( id, meta_ext, meta_pid, raw_ext, raw_pid );
+ if( ret_value < 0 )
+ {
+ throw PropListIException();
+ }
+}
+
+void FileAccPropList::setSplit( FileAccPropList& meta_plist, FileAccPropList& raw_plist, const string& meta_ext, const string& raw_ext ) const
+{
+ setSplit( meta_plist, raw_plist, meta_ext.c_str(), raw_ext.c_str() );
+}
+
+void FileAccPropList::getSplit( size_t meta_ext_size, string& meta_ext, FileAccPropList& meta_plist, size_t raw_ext_size, string& raw_ext, FileAccPropList& raw_plist ) const
+{
+ hid_t meta_plist_id, raw_plist_id; // meta-data and raw-data plist ids
+ char* meta_ext_C = new char[meta_ext_size]; // meta-data extension in C
+ char* raw_ext_C = new char[raw_ext_size]; // raw-data extension in C
+ herr_t ret_value = H5Pget_split( id, meta_ext_size, meta_ext_C,
+ &meta_plist_id, raw_ext_size, raw_ext_C, &raw_plist_id );
+ if( ret_value < 0 )
+ {
+ throw PropListIException();
+ }
+ meta_plist.setId( meta_plist_id );
+ raw_plist.setId( raw_plist_id );
+ raw_ext = string( raw_ext_C );
+ meta_ext = string( raw_ext_C );
+ delete [] raw_ext_C;
+ delete [] meta_ext_C;
+}
+*/
+
+void FileAccPropList::setAlignment( hsize_t threshold, hsize_t alignment ) const
+{
+ herr_t ret_value = H5Pset_alignment( id, threshold, alignment );
+ if( ret_value < 0 )
+ {
+ throw PropListIException();
+ }
+}
+
+void FileAccPropList::getAlignment( hsize_t& threshold, hsize_t& alignment ) const
+{
+ herr_t ret_value = H5Pget_alignment( id, &threshold, &alignment );
+ if( ret_value < 0 )
+ {
+ throw PropListIException();
+ }
+}
+
+/* MPI_Comm and MPI_Info not declared in serial mode so leave these
+routines out until C++ API needs to deal with parallel
+void FileAccPropList::setMpi( MPI_Comm comm, MPI_Info info ) const
+{
+ herr_t ret_value = H5Pset_mpi( id, comm, info );
+ if( ret_value < 0 )
+ {
+ throw PropListIException();
+ }
+}
+
+void FileAccPropList::getMpi( MPI_Comm& comm, MPI_Info& info ) const
+{
+ herr_t ret_value = H5Pget_mpi( id, &comm, &info );
+ if( ret_value < 0 )
+ return( false );
+ else
+ return( true );
+}
+*/
+
+void FileAccPropList::setCache( int mdc_nelmts, int rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0 ) const
+{
+ herr_t ret_value = H5Pset_cache( id, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0 );
+ if( ret_value < 0 )
+ {
+ throw PropListIException();
+ }
+}
+
+void FileAccPropList::getCache( int& mdc_nelmts, int& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0 ) const
+{
+ herr_t ret_value = H5Pget_cache( id, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0 );
+ if( ret_value < 0 )
+ {
+ throw PropListIException();
+ }
+}
+
+void FileAccPropList::setGcReferences( unsigned gc_ref ) const
+{
+ herr_t ret_value = H5Pset_gc_references( id, gc_ref );
+ if( ret_value < 0 )
+ {
+ throw PropListIException();
+ }
+}
+
+unsigned FileAccPropList::getGcReferences() const
+{
+ unsigned gc_ref;
+
+ // the name of this routine will be changed to H5Pget_gc_references???
+ herr_t ret_value = H5Pget_gc_references( id, &gc_ref );
+ if( ret_value < 0 )
+ {
+ throw PropListIException();
+ }
+ return( gc_ref );
+}
+
+FileAccPropList::~FileAccPropList() {}
+
+#ifndef H5_NO_NAMESPACE
+} // end namespace
+#endif