H5RCprivate.h

00001 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00002  * Copyright by The HDF Group.                                               *
00003  * Copyright by the Board of Trustees of the University of Illinois.         *
00004  * All rights reserved.                                                      *
00005  *                                                                           *
00006  * This file is part of HDF5.  The full HDF5 copyright notice, including     *
00007  * terms governing use, modification, and redistribution, is contained in    *
00008  * the files COPYING and Copyright.html.  COPYING can be found at the root   *
00009  * of the source code distribution tree; Copyright.html can be found at the  *
00010  * root level of an installed copy of the electronic HDF5 document set and   *
00011  * is linked from the top-level documents page.  It can also be found at     *
00012  * http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
00013  * access to either file, you may request a copy from help@hdfgroup.org.     *
00014  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00015 
00016 /*
00017  * This file contains private information about the H5RC module
00018  */
00019 #ifndef _H5RCprivate_H
00020 #define _H5RCprivate_H
00021 
00022 /**************************************/
00023 /* Public headers needed by this file */
00024 /**************************************/
00025 #ifdef LATER
00026 #include "H5RCpublic.h"
00027 #endif /* LATER */
00028 
00029 /***************************************/
00030 /* Private headers needed by this file */
00031 /***************************************/
00032 #include "H5private.h"
00033 
00034 /************/
00035 /* Typedefs */
00036 /************/
00037 
00038 /* Typedef for function to release object when reference count drops to zero */
00039 typedef herr_t (*H5RC_free_func_t)(void *o);
00040 
00041 /* Typedef for reference counted objects */
00042 typedef struct H5RC_t {
00043     void *o;            /* Object to be reference counted */
00044     size_t n;           /* Reference count of number of pointers sharing object */
00045     H5RC_free_func_t free_func; /* Function to free object */
00046 } H5RC_t;
00047 
00048 /**********/
00049 /* Macros */
00050 /**********/
00051 #define H5RC_INC(rc)            ((rc)->n++)
00052 #define H5RC_DEC(rc)            (H5RC_decr(rc))
00053 #define H5RC_GET_OBJ(rc)        ((rc)->o)
00054 
00055 /********************/
00056 /* Private routines */
00057 /********************/
00058 H5_DLL H5RC_t *H5RC_create(void *s, H5RC_free_func_t free_func);
00059 H5_DLL herr_t H5RC_decr(H5RC_t *rc);
00060 
00061 #endif /* _H5RSprivate_H */
00062 
00063