1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD 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
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = gstreamer-GstAtomicQueue.html
27  * outPack = gstreamer
28  * outFile = AtomicQueue
29  * strct   = GstAtomicQueue
30  * realStrct=
31  * ctorStrct=
32  * clss    = AtomicQueue
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gst_atomic_queue_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * structWrap:
47  * module aliases:
48  * local aliases:
49  * overrides:
50  */
51 
52 module gstreamer.AtomicQueue;
53 
54 public  import gstreamerc.gstreamertypes;
55 
56 private import gstreamerc.gstreamer;
57 private import glib.ConstructionException;
58 private import gobject.ObjectG;
59 
60 
61 
62 
63 
64 
65 /**
66  * The GstAtomicQueue object implements a queue that can be used from multiple
67  * threads without performing any blocking operations.
68  */
69 public class AtomicQueue
70 {
71 	
72 	/** the main Gtk struct */
73 	protected GstAtomicQueue* gstAtomicQueue;
74 	
75 	
76 	public GstAtomicQueue* getAtomicQueueStruct()
77 	{
78 		return gstAtomicQueue;
79 	}
80 	
81 	
82 	/** the main Gtk struct as a void* */
83 	protected void* getStruct()
84 	{
85 		return cast(void*)gstAtomicQueue;
86 	}
87 	
88 	/**
89 	 * Sets our main struct and passes it to the parent class
90 	 */
91 	public this (GstAtomicQueue* gstAtomicQueue)
92 	{
93 		this.gstAtomicQueue = gstAtomicQueue;
94 	}
95 	
96 	/**
97 	 */
98 	
99 	/**
100 	 * Create a new atomic queue instance. initial_size will be rounded up to the
101 	 * nearest power of 2 and used as the initial size of the queue.
102 	 * Params:
103 	 * initialSize = initial queue size
104 	 * Throws: ConstructionException GTK+ fails to create the object.
105 	 */
106 	public this (uint initialSize)
107 	{
108 		// GstAtomicQueue * gst_atomic_queue_new (guint initial_size);
109 		auto p = gst_atomic_queue_new(initialSize);
110 		if(p is null)
111 		{
112 			throw new ConstructionException("null returned by gst_atomic_queue_new(initialSize)");
113 		}
114 		this(cast(GstAtomicQueue*) p);
115 	}
116 	
117 	/**
118 	 * Increase the refcount of queue.
119 	 */
120 	public void doref()
121 	{
122 		// void gst_atomic_queue_ref (GstAtomicQueue *queue);
123 		gst_atomic_queue_ref(gstAtomicQueue);
124 	}
125 	
126 	/**
127 	 * Unref queue and free the memory when the refcount reaches 0.
128 	 */
129 	public void unref()
130 	{
131 		// void gst_atomic_queue_unref (GstAtomicQueue *queue);
132 		gst_atomic_queue_unref(gstAtomicQueue);
133 	}
134 	
135 	/**
136 	 * Append data to the tail of the queue.
137 	 * Params:
138 	 * data = the data
139 	 */
140 	public void push(void* data)
141 	{
142 		// void gst_atomic_queue_push (GstAtomicQueue *queue,  gpointer data);
143 		gst_atomic_queue_push(gstAtomicQueue, data);
144 	}
145 	
146 	/**
147 	 * Peek the head element of the queue without removing it from the queue.
148 	 * Returns: the head element of queue or NULL when the queue is empty. [transfer none]
149 	 */
150 	public void* peek()
151 	{
152 		// gpointer gst_atomic_queue_peek (GstAtomicQueue *queue);
153 		return gst_atomic_queue_peek(gstAtomicQueue);
154 	}
155 	
156 	/**
157 	 * Get the head element of the queue.
158 	 * Returns: the head element of queue or NULL when the queue is empty. [transfer full]
159 	 */
160 	public void* pop()
161 	{
162 		// gpointer gst_atomic_queue_pop (GstAtomicQueue *queue);
163 		return gst_atomic_queue_pop(gstAtomicQueue);
164 	}
165 	
166 	/**
167 	 * Get the amount of items in the queue.
168 	 * Returns: the number of elements in the queue.
169 	 */
170 	public uint length()
171 	{
172 		// guint gst_atomic_queue_length (GstAtomicQueue *queue);
173 		return gst_atomic_queue_length(gstAtomicQueue);
174 	}
175 }