alternative to assert
[gtkD.git] / gtkD / src / glib / TrashStack.d
blobf63c2e783e586432a9c5177bd7d6df737b56be34
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = glib-Trash-Stacks.html
26 * outPack = glib
27 * outFile = TrashStack
28 * strct = GTrashStack
29 * realStrct=
30 * ctorStrct=
31 * clss = TrashStack
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - g_trash_stack_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * structWrap:
45 * module aliases:
46 * local aliases:
49 module glib.TrashStack;
51 version(noAssert)
53 version(Tango)
55 import tango.io.Stdout; // use the tango loging?
59 private import gtkc.glibtypes;
61 private import gtkc.glib;
68 /**
69 * Description
70 * A GTrashStack is an efficient way to keep a stack of unused allocated
71 * memory chunks. Each memory chunk is required to be large enough to hold
72 * a gpointer. This allows the stack to be maintained without any space
73 * overhead, since the stack pointers can be stored inside the memory chunks.
74 * There is no function to create a GTrashStack. A NULL GTrashStack*
75 * is a perfectly valid empty stack.
77 public class TrashStack
80 /** the main Gtk struct */
81 protected GTrashStack* gTrashStack;
84 public GTrashStack* getTrashStackStruct()
86 return gTrashStack;
90 /** the main Gtk struct as a void* */
91 protected void* getStruct()
93 return cast(void*)gTrashStack;
96 /**
97 * Sets our main struct and passes it to the parent class
99 public this (GTrashStack* gTrashStack)
101 version(noAssert)
103 if ( gTrashStack is null )
105 int zero = 0;
106 version(Tango)
108 Stdout("struct gTrashStack is null on constructor").newline;
110 else
112 printf("struct gTrashStack is null on constructor");
114 zero = zero / zero;
117 else
119 assert(gTrashStack !is null, "struct gTrashStack is null on constructor");
121 this.gTrashStack = gTrashStack;
129 * Pushes a piece of memory onto a GTrashStack.
130 * stack_p:
131 * a pointer to a GTrashStack.
132 * data_p:
133 * the piece of memory to push on the stack.
135 public static void push(GTrashStack** stackP, void* dataP)
137 // void g_trash_stack_push (GTrashStack **stack_p, gpointer data_p);
138 g_trash_stack_push(stackP, dataP);
142 * Pops a piece of memory off a GTrashStack.
143 * stack_p:
144 * a pointer to a GTrashStack.
145 * Returns:
146 * the element at the top of the stack.
148 public static void* pop(GTrashStack** stackP)
150 // gpointer g_trash_stack_pop (GTrashStack **stack_p);
151 return g_trash_stack_pop(stackP);
155 * Returns the element at the top of a GTrashStack which may be NULL.
156 * stack_p:
157 * a pointer to a GTrashStack.
158 * Returns:
159 * the element at the top of the stack.
161 public static void* peek(GTrashStack** stackP)
163 // gpointer g_trash_stack_peek (GTrashStack **stack_p);
164 return g_trash_stack_peek(stackP);
168 * Returns the height of a GTrashStack.
169 * Note that execution of this function is of O(N) complexity
170 * where N denotes the number of items on the stack.
171 * stack_p:
172 * a pointer to a GTrashStack.
173 * Returns:
174 * the height of the stack.
176 public static uint height(GTrashStack** stackP)
178 // guint g_trash_stack_height (GTrashStack **stack_p);
179 return g_trash_stack_height(stackP);