summaryrefslogtreecommitdiffstats
path: root/src/H5RSprivate.h
blob: 086396f8c3afefdeaa4d1a7e4c4803d73bc8730e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/****************************************************************************
 * NCSA HDF								    *
 * Software Development Group						    *
 * National Center for Supercomputing Applications			    *
 * University of Illinois at Urbana-Champaign				    *
 * 605 E. Springfield, Champaign IL 61820				    *
 *									    *
 * For conditions of distribution and use, see the accompanying		    *
 * hdf/COPYING file.							    *
 *									    *
 ****************************************************************************/

/*
 * This file contains private information about the H5RS module
 */
#ifndef _H5RSprivate_H
#define _H5RSprivate_H

#ifdef LATER
#include "H5RSpublic.h"
#endif /* LATER */

/* Private headers needed by this file */
#include "H5private.h"

/* Typedefs */

/* Typedef for reference counted string */
typedef struct {
    char *s;            /* String to be reference counted */
    unsigned wrapped;   /* Indicates that the string to be ref-counted is not copied */
    unsigned n;         /* Reference count of number of pointers sharing string */
} H5RS_str_t;

/* Macros */

/* Get the pointer to the actual string */
#define H5RS_GET_STR(rs)        ((rs)->s)
#define H5RS_GET_COUNT(rs)      ((rs)->n)

/* Private routines */
H5_DLL H5RS_str_t *H5RS_create(const char *s);
H5_DLL H5RS_str_t *H5RS_wrap(char *s);
H5_DLL H5RS_str_t *H5RS_own(char *s);
H5_DLL herr_t H5RS_decr(H5RS_str_t *rs);
H5_DLL herr_t H5RS_incr(H5RS_str_t *rs);
H5_DLL H5RS_str_t *H5RS_dup(H5RS_str_t *s);
H5_DLL int H5RS_cmp(const H5RS_str_t *rs1, const H5RS_str_t *rs2);
H5_DLL ssize_t H5RS_len(const H5RS_str_t *rs);

#endif /* _H5STprivate_H */