diff options
author | James Laird <jlaird@hdfgroup.org> | 2007-01-16 17:19:11 (GMT) |
---|---|---|
committer | James Laird <jlaird@hdfgroup.org> | 2007-01-16 17:19:11 (GMT) |
commit | 8fa9daa17424a76c715f63afc35cfdcd0c3add32 (patch) | |
tree | bd278f590332535b85d6b3c37d936809717aa171 /src/H5Omessage.c | |
parent | 8e88c834ffaf3904105ff585087a09a69ed1a56f (diff) | |
download | hdf5-8fa9daa17424a76c715f63afc35cfdcd0c3add32.zip hdf5-8fa9daa17424a76c715f63afc35cfdcd0c3add32.tar.gz hdf5-8fa9daa17424a76c715f63afc35cfdcd0c3add32.tar.bz2 |
[svn-r13143] Refactoring.
Added can_share callback for OH messages. This determines whether the
message is allowed to be shared in the heap (committed and immutable datatypes
can't be).
Fixed a bug in the dense attribute storage that tried to open the shared message
heap when it hadn't been created yet.
Made the test to extend shared dataspace messages a bit more robust.
Refactored the code the searches a shared message list index to be a little
more efficient.
A few other minor changes.
Tested on smirom, kagiso, Windows, and juniper.
Diffstat (limited to 'src/H5Omessage.c')
-rw-r--r-- | src/H5Omessage.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/H5Omessage.c b/src/H5Omessage.c index e1ae146..54bbdf4 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -1556,6 +1556,58 @@ done: /*------------------------------------------------------------------------- + * Function: H5O_msg_can_share + * + * Purpose: Call the 'can share' method for a + * particular class of object header. This returns TRUE + * if the message is allowed to be put in the shared message + * heap and false otherwise (e.g., for committed or immutable + * datatypes). + * + * Return: Object can be shared: TRUE + * Object cannot be shared: FALSE + * + * Programmer: James Laird + * January 12 2007 + * + *------------------------------------------------------------------------- + */ +htri_t +H5O_msg_can_share(unsigned type_id, const void *mesg) +{ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + htri_t ret_value = FALSE; + + FUNC_ENTER_NOAPI_NOFUNC(H5O_msg_can_share) + + /* Check args */ + HDassert(type_id < NELMTS(H5O_msg_class_g)); + HDassert(type_id != H5O_SHARED_ID); + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + HDassert(type); + HDassert(mesg); + + /* If the message doesn't have an is_shared callback, it's not sharable + * and thus can't be shared. + */ + /* If there is a can_share callback, use it */ + if((type->can_share)) + ret_value = (type->can_share)(mesg); + else { + /* Otherwise, the message can be shared if messages of this type are + * shareable in general; i.e., if they have a set_share callback + */ + if(type->set_share) + ret_value = TRUE; + else + ret_value = FALSE; + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_msg_can_share() */ + + +/*------------------------------------------------------------------------- * Function: H5O_msg_is_shared * * Purpose: Call the 'is_shared' method for a |