mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-17 16:10:24 +08:00
[svn-r3082] Purpose:
Renaming source files for portability Description: Removed *.C files after adding the corresponding *.cpp files. Platforms tested:
This commit is contained in:
parent
0ed058b1c0
commit
b337b85b13
@ -1,78 +0,0 @@
|
||||
#include <string>
|
||||
|
||||
#include "H5Include.h"
|
||||
#include "H5RefCounter.h"
|
||||
#include "H5Exception.h"
|
||||
#include "H5IdComponent.h"
|
||||
#include "H5PropList.h"
|
||||
#include "H5Object.h"
|
||||
#include "H5DataType.h"
|
||||
#include "H5AbstractDs.h"
|
||||
#include "H5DxferProp.h"
|
||||
#include "H5DataSpace.h"
|
||||
#include "H5AtomType.h"
|
||||
#include "H5IntType.h"
|
||||
#include "H5DataSet.h"
|
||||
#include "H5PredType.h"
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
// Default constructor
|
||||
IntType::IntType() {}
|
||||
|
||||
// Copy constructor: makes copy of the original IntType object
|
||||
IntType::IntType( const IntType& original ) : AtomType( original ) {}
|
||||
|
||||
// Creates a integer type using a predefined type
|
||||
IntType::IntType( const PredType& pred_type ) : AtomType()
|
||||
{
|
||||
// use DataType::copy to make a copy of this predefined type
|
||||
copy( pred_type );
|
||||
}
|
||||
|
||||
// Creates a integer datatype using an existing id
|
||||
IntType::IntType( const hid_t existing_id ) : AtomType( existing_id ) {}
|
||||
|
||||
// Gets the integer datatype of the specified dataset - will reimplement
|
||||
IntType::IntType( const DataSet& dataset ) : AtomType()
|
||||
{
|
||||
// Calls C function H5Dget_type to get the id of the datatype
|
||||
id = H5Dget_type( dataset.getId() );
|
||||
|
||||
if( id <= 0 )
|
||||
{
|
||||
throw DataSetIException();
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieves the sign type for an integer type
|
||||
H5T_sign_t IntType::getSign() const
|
||||
{
|
||||
H5T_sign_t type_sign = H5Tget_sign( id ); // C routine
|
||||
// Returns a valid sign type if successful
|
||||
if( type_sign == H5T_SGN_ERROR )
|
||||
{
|
||||
throw DataTypeIException();
|
||||
}
|
||||
return( type_sign );
|
||||
}
|
||||
|
||||
// Sets the sign proprety for an integer type.
|
||||
void IntType::setSign( H5T_sign_t sign ) const
|
||||
{
|
||||
// Call C routine to set the sign property
|
||||
herr_t ret_value = H5Tset_sign( id, sign );
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw DataTypeIException();
|
||||
}
|
||||
}
|
||||
|
||||
// This destructor terminates access to the datatype
|
||||
IntType::~IntType() {}
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
} // end namespace
|
||||
#endif
|
@ -1,67 +0,0 @@
|
||||
#include <string>
|
||||
|
||||
#include "H5Include.h"
|
||||
#include "H5Exception.h"
|
||||
#include "H5Library.h"
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
// This static variable will be set to true when dontAtExit is called
|
||||
bool H5Library::need_cleanup = false;
|
||||
|
||||
// Initializes the HDF5 library.
|
||||
void H5Library::open()
|
||||
{
|
||||
herr_t ret_value = H5open();
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw LibraryIException();
|
||||
}
|
||||
}
|
||||
|
||||
// Flushes all data to disk, closes files, and cleans up memory.
|
||||
void H5Library::close()
|
||||
{
|
||||
herr_t ret_value = H5close();
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw LibraryIException();
|
||||
}
|
||||
}
|
||||
|
||||
// Instructs library not to install atexit cleanup routine
|
||||
void H5Library::dontAtExit()
|
||||
{
|
||||
herr_t ret_value = H5dont_atexit();
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw LibraryIException();
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the HDF library release number.
|
||||
void H5Library::getLibVersion( unsigned& majnum, unsigned& minnum, unsigned& relnum )
|
||||
{
|
||||
herr_t ret_value = H5get_libversion( &majnum, &minnum, &relnum );
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw LibraryIException();
|
||||
}
|
||||
}
|
||||
|
||||
// Verifies that the arguments match the version numbers compiled
|
||||
// into the library
|
||||
void H5Library::checkVersion( unsigned majnum, unsigned minnum, unsigned relnum )
|
||||
{
|
||||
herr_t ret_value = H5check_version( majnum, minnum, relnum );
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw LibraryIException();
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
} // end namespace
|
||||
#endif
|
@ -1,168 +0,0 @@
|
||||
#include <string>
|
||||
|
||||
#include "H5Include.h"
|
||||
#include "H5RefCounter.h"
|
||||
#include "H5Exception.h"
|
||||
#include "H5IdComponent.h"
|
||||
#include "H5Idtemplates.h"
|
||||
#include "H5PropList.h"
|
||||
#include "H5Object.h"
|
||||
#include "H5DataType.h"
|
||||
#include "H5DataSpace.h"
|
||||
#include "H5AbstractDs.h"
|
||||
#include "H5Attribute.h"
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
// 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.
|
||||
extern "C" herr_t userAttrOpWrpr( hid_t loc_id, const char* attr_name, void* op_data )
|
||||
{
|
||||
string s_attr_name = string( attr_name );
|
||||
UserData4Aiterate* myData = static_cast <UserData4Aiterate *> (op_data);
|
||||
myData->op( *myData->object, s_attr_name, myData->opData );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Default constructor - set id to 0 by default here but may be set
|
||||
// to a valid HDF5 id, if any, by a subclass constructor.
|
||||
H5Object::H5Object() : IdComponent() {}
|
||||
|
||||
// Constructs an object from an existing HDF5 id
|
||||
H5Object::H5Object( hid_t object_id ) : IdComponent( object_id ) {}
|
||||
|
||||
// Copy constructor: makes a copy of the original H5Object instance
|
||||
H5Object::H5Object( const H5Object& original ) : IdComponent( original ) {}
|
||||
|
||||
// Creates an attribute for a group, dataset, or named datatype.
|
||||
Attribute H5Object::createAttribute( const char* name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const
|
||||
{
|
||||
hid_t type_id = data_type.getId();
|
||||
hid_t space_id = data_space.getId();
|
||||
hid_t plist_id = create_plist.getId();
|
||||
hid_t attr_id = H5Acreate( id, name, type_id, space_id, plist_id );
|
||||
|
||||
// If the attribute id is valid, create and return the Attribute object
|
||||
if( attr_id > 0 )
|
||||
{
|
||||
Attribute attr( attr_id );
|
||||
return( attr );
|
||||
}
|
||||
else
|
||||
{
|
||||
throw AttributeIException();
|
||||
}
|
||||
}
|
||||
|
||||
// Creates an attribute for a group, dataset, or named datatype.
|
||||
Attribute H5Object::createAttribute( const string& name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const
|
||||
{
|
||||
return( createAttribute( name.c_str(), data_type, data_space, create_plist ));
|
||||
}
|
||||
|
||||
// Opens an attribute given its name; name is given as char*
|
||||
Attribute H5Object::openAttribute( const char* name ) const
|
||||
{
|
||||
hid_t attr_id = H5Aopen_name( id, name );
|
||||
if( attr_id > 0 )
|
||||
{
|
||||
Attribute attr( attr_id );
|
||||
return( attr );
|
||||
}
|
||||
else
|
||||
{
|
||||
throw AttributeIException();
|
||||
}
|
||||
}
|
||||
|
||||
// Opens an attribute given its name; name is given as string
|
||||
Attribute H5Object::openAttribute( const string& name ) const
|
||||
{
|
||||
return( openAttribute( name.c_str()) );
|
||||
}
|
||||
|
||||
// Opens an attribute given its index.
|
||||
Attribute H5Object::openAttribute( unsigned int idx ) const
|
||||
{
|
||||
hid_t attr_id = H5Aopen_idx( id, idx );
|
||||
if( attr_id > 0 )
|
||||
{
|
||||
Attribute attr( attr_id );
|
||||
return( attr );
|
||||
}
|
||||
else
|
||||
{
|
||||
throw AttributeIException();
|
||||
}
|
||||
}
|
||||
|
||||
// Iterates a user's function over all the attributes of the dataset
|
||||
int H5Object::iterateAttrs( attr_operator_t user_op, unsigned * idx, void *op_data )
|
||||
{
|
||||
// store the user's function and data
|
||||
UserData4Aiterate* userData = new UserData4Aiterate;
|
||||
userData->opData = op_data;
|
||||
userData->idx = idx;
|
||||
userData->op = user_op;
|
||||
userData->object = this;
|
||||
|
||||
// call the C library routine H5Aiterate to iterate the attributes
|
||||
int ret_value = H5Aiterate( id, idx, userAttrOpWrpr, (void *) userData );
|
||||
// release memory
|
||||
delete userData;
|
||||
|
||||
if( ret_value >= 0 )
|
||||
return( ret_value );
|
||||
else // raise exception when H5Aiterate returns a negative value
|
||||
{
|
||||
throw AttributeIException();
|
||||
}
|
||||
}
|
||||
|
||||
// Determines the number of attributes attached to
|
||||
int H5Object::getNumAttrs() const
|
||||
{
|
||||
int num_attrs = H5Aget_num_attrs( id );
|
||||
if( num_attrs < 0 )
|
||||
{
|
||||
throw AttributeIException();
|
||||
}
|
||||
else
|
||||
return( num_attrs );
|
||||
}
|
||||
|
||||
// Removes the named attribute from this object.
|
||||
void H5Object::removeAttr( const char* name ) const
|
||||
{
|
||||
herr_t ret_value = H5Adelete( id, name );
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw AttributeIException();
|
||||
}
|
||||
}
|
||||
void H5Object::removeAttr( const string& name ) const
|
||||
{
|
||||
removeAttr( name.c_str() );
|
||||
}
|
||||
|
||||
// Flushes all buffers associated with a file to disk.
|
||||
void H5Object::flush(H5F_scope_t scope ) const
|
||||
{
|
||||
herr_t ret_value = H5Fflush( id, scope );
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw FileIException();
|
||||
}
|
||||
}
|
||||
|
||||
// each subclass' destructor calls the template function resetIdComponent()
|
||||
// to reset the corresponding IdComponent object and close the HDF5 object
|
||||
// where appropriate.
|
||||
H5Object::~H5Object() {}
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
} // end namespace
|
||||
#endif
|
@ -1,192 +0,0 @@
|
||||
#include <string>
|
||||
|
||||
#include "H5Include.h"
|
||||
#include "H5RefCounter.h"
|
||||
#include "H5Exception.h"
|
||||
#include "H5IdComponent.h"
|
||||
#include "H5PropList.h"
|
||||
#include "H5Object.h"
|
||||
#include "H5DataType.h"
|
||||
#include "H5AtomType.h"
|
||||
#include "H5Library.h"
|
||||
#include "H5PredType.h"
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
// Default constructor
|
||||
PredType::PredType() : AtomType() {}
|
||||
|
||||
// creates predefined datatype, so set DataType::is_predtype to true by default
|
||||
PredType::PredType( const hid_t predtype_id ) : AtomType( predtype_id )
|
||||
{
|
||||
is_predtype = true;
|
||||
}
|
||||
|
||||
// Copy constructor: makes a copy of this PredType object.
|
||||
PredType::PredType( const PredType& original ) : AtomType( original ) {}
|
||||
|
||||
const PredType PredType::NotAtexit; // only for atexit/global dest. problem
|
||||
|
||||
// Definition of pre-defined types
|
||||
const PredType PredType::C_S1( H5T_C_S1 );
|
||||
const PredType PredType::FORTRAN_S1( H5T_FORTRAN_S1 );
|
||||
|
||||
const PredType PredType::STD_I8BE( H5T_STD_I8BE );
|
||||
const PredType PredType::STD_I8LE( H5T_STD_I8LE );
|
||||
const PredType PredType::STD_I16BE( H5T_STD_I16BE );
|
||||
const PredType PredType::STD_I16LE( H5T_STD_I16LE );
|
||||
const PredType PredType::STD_I32BE( H5T_STD_I32BE );
|
||||
const PredType PredType::STD_I32LE( H5T_STD_I32LE );
|
||||
const PredType PredType::STD_I64BE( H5T_STD_I64BE );
|
||||
const PredType PredType::STD_I64LE( H5T_STD_I64LE );
|
||||
const PredType PredType::STD_U8BE( H5T_STD_U8BE );
|
||||
const PredType PredType::STD_U8LE( H5T_STD_U8LE );
|
||||
const PredType PredType::STD_U16BE( H5T_STD_U16BE );
|
||||
const PredType PredType::STD_U16LE( H5T_STD_U16LE );
|
||||
const PredType PredType::STD_U32BE( H5T_STD_U32BE );
|
||||
const PredType PredType::STD_U32LE( H5T_STD_U32LE );
|
||||
const PredType PredType::STD_U64BE( H5T_STD_U64BE );
|
||||
const PredType PredType::STD_U64LE( H5T_STD_U64LE );
|
||||
const PredType PredType::STD_B8BE( H5T_STD_B8BE );
|
||||
const PredType PredType::STD_B8LE( H5T_STD_B8LE );
|
||||
const PredType PredType::STD_B16BE( H5T_STD_B16BE );
|
||||
const PredType PredType::STD_B16LE( H5T_STD_B16LE );
|
||||
const PredType PredType::STD_B32BE( H5T_STD_B32BE );
|
||||
const PredType PredType::STD_B32LE( H5T_STD_B32LE );
|
||||
const PredType PredType::STD_B64BE( H5T_STD_B64BE );
|
||||
const PredType PredType::STD_B64LE( H5T_STD_B64LE );
|
||||
const PredType PredType::STD_REF_OBJ( H5T_STD_REF_OBJ );
|
||||
const PredType PredType::STD_REF_DSETREG( H5T_STD_REF_DSETREG );
|
||||
|
||||
const PredType PredType::IEEE_F32BE( H5T_IEEE_F32BE );
|
||||
const PredType PredType::IEEE_F32LE( H5T_IEEE_F32LE );
|
||||
const PredType PredType::IEEE_F64BE( H5T_IEEE_F64BE );
|
||||
const PredType PredType::IEEE_F64LE( H5T_IEEE_F64LE );
|
||||
|
||||
const PredType PredType::UNIX_D32BE( H5T_UNIX_D32BE );
|
||||
const PredType PredType::UNIX_D32LE( H5T_UNIX_D32LE );
|
||||
const PredType PredType::UNIX_D64BE( H5T_UNIX_D64BE );
|
||||
const PredType PredType::UNIX_D64LE( H5T_UNIX_D64LE );
|
||||
|
||||
const PredType PredType::INTEL_I8( H5T_INTEL_I8 );
|
||||
const PredType PredType::INTEL_I16( H5T_INTEL_I16 );
|
||||
const PredType PredType::INTEL_I32( H5T_INTEL_I32 );
|
||||
const PredType PredType::INTEL_I64( H5T_INTEL_I64 );
|
||||
const PredType PredType::INTEL_U8( H5T_INTEL_U8 );
|
||||
const PredType PredType::INTEL_U16( H5T_INTEL_U16 );
|
||||
const PredType PredType::INTEL_U32( H5T_INTEL_U32 );
|
||||
const PredType PredType::INTEL_U64( H5T_INTEL_U64 );
|
||||
const PredType PredType::INTEL_B8( H5T_INTEL_B8 );
|
||||
const PredType PredType::INTEL_B16( H5T_INTEL_B16 );
|
||||
const PredType PredType::INTEL_B32( H5T_INTEL_B32 );
|
||||
const PredType PredType::INTEL_B64( H5T_INTEL_B64 );
|
||||
const PredType PredType::INTEL_F32( H5T_INTEL_F32 );
|
||||
const PredType PredType::INTEL_F64( H5T_INTEL_F64 );
|
||||
|
||||
const PredType PredType::ALPHA_I8( H5T_ALPHA_I8 );
|
||||
const PredType PredType::ALPHA_I16( H5T_ALPHA_I16 );
|
||||
const PredType PredType::ALPHA_I32( H5T_ALPHA_I32 );
|
||||
const PredType PredType::ALPHA_I64( H5T_ALPHA_I64 );
|
||||
const PredType PredType::ALPHA_U8( H5T_ALPHA_U8 );
|
||||
const PredType PredType::ALPHA_U16( H5T_ALPHA_U16 );
|
||||
const PredType PredType::ALPHA_U32( H5T_ALPHA_U32 );
|
||||
const PredType PredType::ALPHA_U64( H5T_ALPHA_U64 );
|
||||
const PredType PredType::ALPHA_B8( H5T_ALPHA_B8 );
|
||||
const PredType PredType::ALPHA_B16( H5T_ALPHA_B16 );
|
||||
const PredType PredType::ALPHA_B32( H5T_ALPHA_B32 );
|
||||
const PredType PredType::ALPHA_B64( H5T_ALPHA_B64 );
|
||||
const PredType PredType::ALPHA_F32( H5T_ALPHA_F32 );
|
||||
const PredType PredType::ALPHA_F64( H5T_ALPHA_F64 );
|
||||
|
||||
const PredType PredType::MIPS_I8( H5T_MIPS_I8 );
|
||||
const PredType PredType::MIPS_I16( H5T_MIPS_I16 );
|
||||
const PredType PredType::MIPS_I32( H5T_MIPS_I32 );
|
||||
const PredType PredType::MIPS_I64( H5T_MIPS_I64 );
|
||||
const PredType PredType::MIPS_U8( H5T_MIPS_U8 );
|
||||
const PredType PredType::MIPS_U16( H5T_MIPS_U16 );
|
||||
const PredType PredType::MIPS_U32( H5T_MIPS_U32 );
|
||||
const PredType PredType::MIPS_U64( H5T_MIPS_U64 );
|
||||
const PredType PredType::MIPS_B8( H5T_MIPS_B8 );
|
||||
const PredType PredType::MIPS_B16( H5T_MIPS_B16 );
|
||||
const PredType PredType::MIPS_B32( H5T_MIPS_B32 );
|
||||
const PredType PredType::MIPS_B64( H5T_MIPS_B64 );
|
||||
const PredType PredType::MIPS_F32( H5T_MIPS_F32 );
|
||||
const PredType PredType::MIPS_F64( H5T_MIPS_F64 );
|
||||
|
||||
const PredType PredType::NATIVE_CHAR( H5T_NATIVE_CHAR );
|
||||
const PredType PredType::NATIVE_INT( H5T_NATIVE_INT );
|
||||
const PredType PredType::NATIVE_FLOAT( H5T_NATIVE_FLOAT );
|
||||
const PredType PredType::NATIVE_SCHAR( H5T_NATIVE_SCHAR );
|
||||
const PredType PredType::NATIVE_UCHAR( H5T_NATIVE_UCHAR );
|
||||
const PredType PredType::NATIVE_SHORT( H5T_NATIVE_SHORT );
|
||||
const PredType PredType::NATIVE_USHORT( H5T_NATIVE_USHORT );
|
||||
const PredType PredType::NATIVE_UINT( H5T_NATIVE_UINT );
|
||||
const PredType PredType::NATIVE_LONG( H5T_NATIVE_LONG );
|
||||
const PredType PredType::NATIVE_ULONG( H5T_NATIVE_ULONG );
|
||||
const PredType PredType::NATIVE_LLONG( H5T_NATIVE_LLONG );
|
||||
const PredType PredType::NATIVE_ULLONG( H5T_NATIVE_ULLONG );
|
||||
const PredType PredType::NATIVE_DOUBLE( H5T_NATIVE_DOUBLE );
|
||||
const PredType PredType::NATIVE_LDOUBLE( H5T_NATIVE_LDOUBLE );
|
||||
const PredType PredType::NATIVE_B8( H5T_NATIVE_B8 );
|
||||
const PredType PredType::NATIVE_B16( H5T_NATIVE_B16 );
|
||||
const PredType PredType::NATIVE_B32( H5T_NATIVE_B32 );
|
||||
const PredType PredType::NATIVE_B64( H5T_NATIVE_B64 );
|
||||
const PredType PredType::NATIVE_OPAQUE( H5T_NATIVE_OPAQUE );
|
||||
const PredType PredType::NATIVE_HSIZE( H5T_NATIVE_HSIZE );
|
||||
const PredType PredType::NATIVE_HSSIZE( H5T_NATIVE_HSSIZE );
|
||||
const PredType PredType::NATIVE_HERR( H5T_NATIVE_HERR );
|
||||
const PredType PredType::NATIVE_HBOOL( H5T_NATIVE_HBOOL );
|
||||
|
||||
const PredType PredType::NATIVE_INT8( H5T_NATIVE_INT8 );
|
||||
const PredType PredType::NATIVE_UINT8( H5T_NATIVE_UINT8 );
|
||||
const PredType PredType::NATIVE_INT_LEAST8( H5T_NATIVE_INT_LEAST8 );
|
||||
const PredType PredType::NATIVE_UINT_LEAST8( H5T_NATIVE_UINT_LEAST8 );
|
||||
const PredType PredType::NATIVE_INT_FAST8( H5T_NATIVE_INT_FAST8 );
|
||||
const PredType PredType::NATIVE_UINT_FAST8( H5T_NATIVE_UINT_FAST8 );
|
||||
|
||||
const PredType PredType::NATIVE_INT16( H5T_NATIVE_INT16 );
|
||||
const PredType PredType::NATIVE_UINT16( H5T_NATIVE_UINT16 );
|
||||
const PredType PredType::NATIVE_INT_LEAST16( H5T_NATIVE_INT_LEAST16 );
|
||||
const PredType PredType::NATIVE_UINT_LEAST16( H5T_NATIVE_UINT_LEAST16 );
|
||||
const PredType PredType::NATIVE_INT_FAST16( H5T_NATIVE_INT_FAST16 );
|
||||
const PredType PredType::NATIVE_UINT_FAST16( H5T_NATIVE_UINT_FAST16 );
|
||||
|
||||
const PredType PredType::NATIVE_INT32( H5T_NATIVE_INT32 );
|
||||
const PredType PredType::NATIVE_UINT32( H5T_NATIVE_UINT32 );
|
||||
const PredType PredType::NATIVE_INT_LEAST32( H5T_NATIVE_INT_LEAST32 );
|
||||
const PredType PredType::NATIVE_UINT_LEAST32( H5T_NATIVE_UINT_LEAST32 );
|
||||
const PredType PredType::NATIVE_INT_FAST32( H5T_NATIVE_INT_FAST32 );
|
||||
const PredType PredType::NATIVE_UINT_FAST32( H5T_NATIVE_UINT_FAST32 );
|
||||
|
||||
const PredType PredType::NATIVE_INT64( H5T_NATIVE_INT64 );
|
||||
const PredType PredType::NATIVE_UINT64( H5T_NATIVE_UINT64 );
|
||||
const PredType PredType::NATIVE_INT_LEAST64( H5T_NATIVE_INT_LEAST64 );
|
||||
const PredType PredType::NATIVE_UINT_LEAST64( H5T_NATIVE_UINT_LEAST64 );
|
||||
const PredType PredType::NATIVE_INT_FAST64( H5T_NATIVE_INT_FAST64 );
|
||||
const PredType PredType::NATIVE_UINT_FAST64( H5T_NATIVE_UINT_FAST64 );
|
||||
|
||||
// These dummy functions do not inherit from DataType - they'll
|
||||
// throw an DataTypeIException if invoked.
|
||||
void PredType::commit( H5Object& loc, const char* name )
|
||||
{
|
||||
throw DataTypeIException( "Attempting to commit a predefined datatype. This operation is invalid" );
|
||||
}
|
||||
|
||||
void PredType::commit( H5Object& loc, const string& name )
|
||||
{
|
||||
commit( loc, name.c_str());
|
||||
}
|
||||
|
||||
bool PredType::committed()
|
||||
{
|
||||
throw DataTypeIException( "Attempting to check for commit status on a predefined datatype. This operation is invalid" );
|
||||
}
|
||||
|
||||
// Destructor: calls ~AtomType immediately
|
||||
PredType::~PredType() {}
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
} // end namespace
|
||||
#endif
|
@ -1,103 +0,0 @@
|
||||
#include <string>
|
||||
|
||||
#include "H5Include.h"
|
||||
#include "H5RefCounter.h"
|
||||
#include "H5Exception.h"
|
||||
#include "H5IdComponent.h"
|
||||
#include "H5Idtemplates.h"
|
||||
#include "H5PropList.h"
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
const PropList PropList::DEFAULT( H5P_DEFAULT );
|
||||
|
||||
// Default constructor - set id to 0 by default here but may be set
|
||||
// to a valid one, if any, by a subclass constructor.
|
||||
PropList::PropList() : IdComponent( 0 )
|
||||
{
|
||||
// id_obj = new IdComponent( 0 ); // init default object's id to 0
|
||||
}
|
||||
|
||||
// Creates a new property of specified type
|
||||
PropList::PropList( H5P_class_t type ) : IdComponent( 0 )
|
||||
{
|
||||
// call C routine to create the new property
|
||||
id = H5Pcreate(type );
|
||||
if( id <= 0 )
|
||||
{
|
||||
throw PropListIException();
|
||||
}
|
||||
}
|
||||
|
||||
// Copy constructor: makes a copy of the original object
|
||||
PropList::PropList( const PropList& original ) : IdComponent( original ) {}
|
||||
|
||||
/* Constructor that takes an existing property list id.
|
||||
Description:
|
||||
Uses an HDF5 id to create a PropList identifier object. This id
|
||||
can be either an existing property list id or a default property
|
||||
list id. Design note: in the case of default property list,
|
||||
the identifier still has reference counter; the p_close function
|
||||
will take care of not to call H5Pclose on the default id.
|
||||
*/
|
||||
PropList::PropList( const hid_t plist_id ) : IdComponent( plist_id ) { }
|
||||
|
||||
// Makes a copy of an existing property list
|
||||
void PropList::copy( const PropList& like_plist )
|
||||
{
|
||||
// reset the identifier of this PropList - send 'this' in so that
|
||||
// H5Pclose can be called appropriately
|
||||
resetIdComponent( this );
|
||||
|
||||
// call C routine to copy the property list
|
||||
id = H5Pcopy( like_plist.getId() );
|
||||
|
||||
// points to the same ref counter
|
||||
ref_count = like_plist.ref_count;
|
||||
|
||||
// increment ref counter to indicate additional references to this id
|
||||
ref_count->increment();
|
||||
|
||||
if( id <= 0 )
|
||||
{
|
||||
throw PropListIException();
|
||||
}
|
||||
}
|
||||
|
||||
// Closes the property list if it is not a default one
|
||||
void PropList::p_close() const
|
||||
{
|
||||
if( id != H5P_DEFAULT ) // not a constant, should call H5Pclose
|
||||
{
|
||||
herr_t ret_value = H5Pclose( id );
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("PropList::p_close: unable to close the property list. Please report this bug to HDF." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the class of this property list, i.e. H5P_FILE_CREATE...
|
||||
H5P_class_t PropList::getClass() const
|
||||
{
|
||||
H5P_class_t plist_class = H5Pget_class( id );
|
||||
if( plist_class == H5P_NO_CLASS )
|
||||
{
|
||||
throw PropListIException();
|
||||
}
|
||||
return( plist_class );
|
||||
}
|
||||
|
||||
// The destructor of this instance calls the template resetIdComponent to
|
||||
// reset its identifier
|
||||
PropList::~PropList()
|
||||
{
|
||||
// The property list id will be closed properly
|
||||
resetIdComponent( this );
|
||||
}
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
} // end namespace
|
||||
#endif
|
@ -1,35 +0,0 @@
|
||||
#include "H5RefCounter.h"
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
using namespace std;
|
||||
#endif
|
||||
|
||||
// Creates a reference counter to be used by an HDF5 object
|
||||
RefCounter::RefCounter() : counter(1) { };
|
||||
|
||||
// Returns the current value of the reference counter
|
||||
int RefCounter::getCounter () const { return counter; }
|
||||
|
||||
// Increments the reference counter as a copy of the object that uses
|
||||
// this counter is created.
|
||||
void RefCounter::increment() { counter++; }
|
||||
|
||||
// Decrements the reference counter as a copy of the object that uses
|
||||
// this counter is destroyed.
|
||||
void RefCounter::decrement() { counter--; }
|
||||
|
||||
// Decrements the reference counter then determines if there are no more
|
||||
// reference to the object that uses this counter
|
||||
bool RefCounter::noReference()
|
||||
{
|
||||
if( counter > 0 )
|
||||
counter--;
|
||||
return( counter == 0 ? true:false );
|
||||
}
|
||||
|
||||
RefCounter::~RefCounter() {}
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
} // end namespace
|
||||
#endif
|
@ -1,103 +0,0 @@
|
||||
#include <string>
|
||||
|
||||
#include "H5Include.h"
|
||||
#include "H5RefCounter.h"
|
||||
#include "H5Exception.h"
|
||||
#include "H5IdComponent.h"
|
||||
#include "H5PropList.h"
|
||||
#include "H5Object.h"
|
||||
#include "H5DataType.h"
|
||||
#include "H5AtomType.h"
|
||||
#include "H5AbstractDs.h"
|
||||
#include "H5DxferProp.h"
|
||||
#include "H5DataSpace.h"
|
||||
#include "H5StrType.h"
|
||||
#include "H5DataSet.h"
|
||||
#include "H5PredType.h"
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
// Default constructor
|
||||
StrType::StrType() : AtomType() {}
|
||||
|
||||
// Creates a string type using a predefined type
|
||||
StrType::StrType( const PredType& pred_type ) : AtomType()
|
||||
{
|
||||
// use DataType::copy to make a copy of this predefined type
|
||||
copy( pred_type );
|
||||
}
|
||||
|
||||
// Creates a string datatype using an existing id
|
||||
StrType::StrType( const hid_t existing_id ) : AtomType( existing_id ) {}
|
||||
|
||||
// Copy constructor: makes copy of the original StrType object
|
||||
StrType::StrType( const StrType& original ) : AtomType ( original ) {}
|
||||
|
||||
// Gets the string datatype of the specified dataset - will reimplement
|
||||
StrType::StrType( const DataSet& dataset ) : AtomType ()
|
||||
{
|
||||
// Calls C function H5Dget_type to get the id of the datatype
|
||||
id = H5Dget_type( dataset.getId() );
|
||||
|
||||
if( id <= 0 )
|
||||
{
|
||||
throw DataSetIException();
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieves the character set type of a string datatype.
|
||||
H5T_cset_t StrType::getCset() const
|
||||
{
|
||||
H5T_cset_t cset = H5Tget_cset( id );
|
||||
|
||||
// Returns a valid character set type if successful
|
||||
if( cset == H5T_CSET_ERROR )
|
||||
{
|
||||
throw DataTypeIException();
|
||||
}
|
||||
return( cset );
|
||||
}
|
||||
|
||||
// Sets character set to be used.
|
||||
void StrType::setCset( H5T_cset_t cset ) const
|
||||
{
|
||||
herr_t ret_value = H5Tset_cset( id, cset );
|
||||
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw DataTypeIException();
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieves the string padding method for a string datatype.
|
||||
H5T_str_t StrType::getStrpad() const
|
||||
{
|
||||
H5T_str_t strpad = H5Tget_strpad( id );
|
||||
|
||||
// Returns a valid string padding type if successful
|
||||
if( strpad == H5T_STR_ERROR )
|
||||
{
|
||||
throw DataTypeIException();
|
||||
}
|
||||
return( strpad );
|
||||
}
|
||||
|
||||
// Defines the storage mechanism for character strings.
|
||||
void StrType::setStrpad( H5T_str_t strpad ) const
|
||||
{
|
||||
herr_t ret_value = H5Tset_strpad( id, strpad );
|
||||
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw DataTypeIException();
|
||||
}
|
||||
}
|
||||
|
||||
// This destructor terminates access to the datatype
|
||||
StrType::~StrType() {}
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
} // end namespace
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user