3 * \brief YASM associated data storage (libyasm internal use)
6 * Copyright (C) 2003-2007 Peter Johnson
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * - Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * - Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS''
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
30 #ifndef YASM_ASSOCDAT_H
31 #define YASM_ASSOCDAT_H
37 /** Associated data container. */
38 typedef struct yasm__assoc_data yasm__assoc_data;
40 /** Create an associated data container. */
42 /*@only@*/ yasm__assoc_data *yasm__assoc_data_create(void);
44 /** Get associated data for a data callback.
45 * \param assoc_data container of associated data
46 * \param callback callback used when adding data
47 * \return Associated data (NULL if none).
50 /*@dependent@*/ /*@null@*/ void *yasm__assoc_data_get
51 (/*@null@*/ yasm__assoc_data *assoc_data,
52 const yasm_assoc_data_callback *callback);
54 /** Add associated data to a associated data container.
55 * \attention Deletes any existing associated data for that data callback.
56 * \param assoc_data container of associated data
57 * \param callback callback
58 * \param data data to associate
61 /*@only@*/ yasm__assoc_data *yasm__assoc_data_add
62 (/*@null@*/ /*@only@*/ yasm__assoc_data *assoc_data,
63 const yasm_assoc_data_callback *callback,
64 /*@only@*/ /*@null@*/ void *data);
66 /** Destroy all associated data in a container. */
68 void yasm__assoc_data_destroy
69 (/*@null@*/ /*@only@*/ yasm__assoc_data *assoc_data);
71 /** Print all associated data in a container. */
73 void yasm__assoc_data_print(const yasm__assoc_data *assoc_data, FILE *f,