3352dab3c58f0e308ae9b1b4d3b44526f474b9c4
[mono.git] / mono / sgen / sgen-pointer-queue.h
1 /*
2  * sgen-pointer-queue.h: A pointer queue that can be sorted.
3  *
4  * Copyright (C) 2014 Xamarin Inc
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License 2.0 as published by the Free Software Foundation;
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License 2.0 along with this library; if not, write to the Free
17  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19
20 #ifndef __MONO_SGEN_POINTER_QUEUE_H__
21 #define __MONO_SGEN_POINTER_QUEUE_H__
22
23 #include <glib.h>
24
25 typedef struct {
26         void **data;
27         size_t size;
28         size_t next_slot;
29         int mem_type;
30 } SgenPointerQueue;
31
32 #define SGEN_POINTER_QUEUE_INIT(mem_type)       { NULL, 0, 0, (mem_type) }
33
34 void sgen_pointer_queue_add (SgenPointerQueue *queue, void *ptr);
35 void sgen_pointer_queue_clear (SgenPointerQueue *queue);
36 void sgen_pointer_queue_remove_nulls (SgenPointerQueue *queue);
37 void sgen_pointer_queue_sort_uniq (SgenPointerQueue *queue);
38 size_t sgen_pointer_queue_search (SgenPointerQueue *queue, void *addr);
39 size_t sgen_pointer_queue_find (SgenPointerQueue *queue, void *ptr);
40 void sgen_pointer_queue_init (SgenPointerQueue *queue, int mem_type);
41 void* sgen_pointer_queue_pop (SgenPointerQueue *queue);
42 gboolean sgen_pointer_queue_is_empty (SgenPointerQueue *queue);
43 void sgen_pointer_queue_free (SgenPointerQueue *queue);
44 gboolean sgen_pointer_queue_will_grow (SgenPointerQueue *queue);
45
46 #endif