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 * The GstAtomicQueue object implements a queue that can be used from multiple 65 * threads without performing any blocking operations. 66 */ 67 public class AtomicQueue 68 { 69 70 /** the main Gtk struct */ 71 protected GstAtomicQueue* gstAtomicQueue; 72 73 74 /** Get the main Gtk struct */ 75 public GstAtomicQueue* getAtomicQueueStruct() 76 { 77 return gstAtomicQueue; 78 } 79 80 81 /** the main Gtk struct as a void* */ 82 protected void* getStruct() 83 { 84 return cast(void*)gstAtomicQueue; 85 } 86 87 /** 88 * Sets our main struct and passes it to the parent class 89 */ 90 public this (GstAtomicQueue* gstAtomicQueue) 91 { 92 this.gstAtomicQueue = gstAtomicQueue; 93 } 94 95 /** 96 */ 97 98 /** 99 * Create a new atomic queue instance. initial_size will be rounded up to the 100 * nearest power of 2 and used as the initial size of the queue. 101 * Params: 102 * initialSize = initial queue size 103 * Throws: ConstructionException GTK+ fails to create the object. 104 */ 105 public this (uint initialSize) 106 { 107 // GstAtomicQueue * gst_atomic_queue_new (guint initial_size); 108 auto p = gst_atomic_queue_new(initialSize); 109 if(p is null) 110 { 111 throw new ConstructionException("null returned by gst_atomic_queue_new(initialSize)"); 112 } 113 this(cast(GstAtomicQueue*) p); 114 } 115 116 /** 117 * Increase the refcount of queue. 118 */ 119 public void doref() 120 { 121 // void gst_atomic_queue_ref (GstAtomicQueue *queue); 122 gst_atomic_queue_ref(gstAtomicQueue); 123 } 124 125 /** 126 * Unref queue and free the memory when the refcount reaches 0. 127 */ 128 public void unref() 129 { 130 // void gst_atomic_queue_unref (GstAtomicQueue *queue); 131 gst_atomic_queue_unref(gstAtomicQueue); 132 } 133 134 /** 135 * Append data to the tail of the queue. 136 * Params: 137 * data = the data 138 */ 139 public void push(void* data) 140 { 141 // void gst_atomic_queue_push (GstAtomicQueue *queue, gpointer data); 142 gst_atomic_queue_push(gstAtomicQueue, data); 143 } 144 145 /** 146 * Peek the head element of the queue without removing it from the queue. 147 * Returns: the head element of queue or NULL when the queue is empty. [transfer none] 148 */ 149 public void* peek() 150 { 151 // gpointer gst_atomic_queue_peek (GstAtomicQueue *queue); 152 return gst_atomic_queue_peek(gstAtomicQueue); 153 } 154 155 /** 156 * Get the head element of the queue. 157 * Returns: the head element of queue or NULL when the queue is empty. [transfer full] 158 */ 159 public void* pop() 160 { 161 // gpointer gst_atomic_queue_pop (GstAtomicQueue *queue); 162 return gst_atomic_queue_pop(gstAtomicQueue); 163 } 164 165 /** 166 * Get the amount of items in the queue. 167 * Returns: the number of elements in the queue. 168 */ 169 public uint length() 170 { 171 // guint gst_atomic_queue_length (GstAtomicQueue *queue); 172 return gst_atomic_queue_length(gstAtomicQueue); 173 } 174 }