diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2005-11-07 03:13:53 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2005-11-07 03:13:53 (GMT) |
commit | 08910385629d5cbfde5aa43cef0bcba17f7995b1 (patch) | |
tree | c47c355e63c972adac3e025e6bdd4a4dc67c0a47 /src/H5Ocont.c | |
parent | 23e994958b6190715aefb698b55dad70deb72049 (diff) | |
download | hdf5-08910385629d5cbfde5aa43cef0bcba17f7995b1.zip hdf5-08910385629d5cbfde5aa43cef0bcba17f7995b1.tar.gz hdf5-08910385629d5cbfde5aa43cef0bcba17f7995b1.tar.bz2 |
[svn-r11686] Purpose:
New feature
Description:
Add in baseline "object copy" code from Peter [in the form of a new API
routine: H5Gcopy()]. There's still some work to do (like handling variable-
length datatypes and possibly support for references) and it hasn't been tested
on mounted files yet, but the core functionality is there and working
correctly.
I've also got a set of patches to update the 1.6 branch with tweaks to
keep the branches mostly in sync, but Elena will kill me if I import them
before the 1.6.5 release is out... :-)
Platforms tested:
FreeBSD 4.11 (sleipnir)
h5committested
Diffstat (limited to 'src/H5Ocont.c')
-rw-r--r-- | src/H5Ocont.c | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/src/H5Ocont.c b/src/H5Ocont.c index e62ca07..afa5ab7 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -42,6 +42,8 @@ static void *H5O_cont_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shar static herr_t H5O_cont_encode(H5F_t *f, uint8_t *p, const void *_mesg); static size_t H5O_cont_size(const H5F_t *f, const void *_mesg); static herr_t H5O_cont_free(void *mesg); +static void *H5O_cont_copy_file(H5F_t *file_src, void *mesg_src, + H5F_t *file_dst, hid_t dxpl_id, H5SL_t *map_list, void *udata); static herr_t H5O_cont_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth); @@ -60,7 +62,9 @@ const H5O_class_t H5O_CONT[1] = {{ NULL, /* link method */ NULL, /*get share method */ NULL, /*set share method */ - H5O_cont_debug, /*debugging */ + H5O_cont_copy_file, /* copy native value to file */ + NULL, /* post copy native value to file */ + H5O_cont_debug /*debugging */ }}; /* Declare the free list for H5O_cont_t's */ @@ -209,6 +213,54 @@ H5O_cont_free (void *mesg) /*------------------------------------------------------------------------- + * Function: H5O_cont_copy_file + * + * Purpose: Copies a continuation block message from _MESG to _DEST in file + * + * Return: Success: Ptr to _DEST + * + * Failure: NULL + * + * Programmer: Peter Cao + * September 22, 2005 + * + *------------------------------------------------------------------------- + */ +static void * +H5O_cont_copy_file(H5F_t UNUSED *file_src, void *mesg_src, + H5F_t *file_dst, hid_t UNUSED dxpl_id, H5SL_t UNUSED *map_list, void *udata) +{ + H5O_cont_t *cont_src = (H5O_cont_t *) mesg_src; + H5O_chunk_t *chunk = (H5O_chunk_t *)udata; + H5O_cont_t *cont_dst = NULL; + void *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5O_cont_copy_file) + + /* check args */ + HDassert(cont_src); + HDassert(file_dst); + + /* Allocate space for the destination cont */ + if(NULL == (cont_dst = H5FL_MALLOC(H5O_cont_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + + HDmemcpy(cont_dst, cont_src, sizeof(H5O_cont_t)); + cont_dst->addr = chunk[cont_src->chunkno].addr; + + /* Set return value */ + ret_value = cont_dst; + +done: + if(!ret_value) + if(cont_dst) + H5FL_FREE(H5O_cont_t, cont_dst); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_cont_copy_file() */ + + +/*------------------------------------------------------------------------- * Function: H5O_cont_debug * * Purpose: Prints debugging info. |