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 module gstreamer.AtomicQueue; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import gstreamerc.gstreamer; 30 public import gstreamerc.gstreamertypes; 31 32 33 /** 34 * The #GstAtomicQueue object implements a queue that can be used from multiple 35 * threads without performing any blocking operations. 36 */ 37 public class AtomicQueue 38 { 39 /** the main Gtk struct */ 40 protected GstAtomicQueue* gstAtomicQueue; 41 42 /** Get the main Gtk struct */ 43 public GstAtomicQueue* getAtomicQueueStruct() 44 { 45 return gstAtomicQueue; 46 } 47 48 /** the main Gtk struct as a void* */ 49 protected void* getStruct() 50 { 51 return cast(void*)gstAtomicQueue; 52 } 53 54 /** 55 * Sets our main struct and passes it to the parent class. 56 */ 57 public this (GstAtomicQueue* gstAtomicQueue) 58 { 59 this.gstAtomicQueue = gstAtomicQueue; 60 } 61 62 /** 63 */ 64 65 public static GType getType() 66 { 67 return gst_atomic_queue_get_type(); 68 } 69 70 /** 71 * Create a new atomic queue instance. @initial_size will be rounded up to the 72 * nearest power of 2 and used as the initial size of the queue. 73 * 74 * Params: 75 * initialSize = initial queue size 76 * 77 * Return: a new #GstAtomicQueue 78 * 79 * Throws: ConstructionException GTK+ fails to create the object. 80 */ 81 public this(uint initialSize) 82 { 83 auto p = gst_atomic_queue_new(initialSize); 84 85 if(p is null) 86 { 87 throw new ConstructionException("null returned by new"); 88 } 89 90 this(cast(GstAtomicQueue*) p); 91 } 92 93 /** 94 * Get the amount of items in the queue. 95 * 96 * Return: the number of elements in the queue. 97 */ 98 public uint length() 99 { 100 return gst_atomic_queue_length(gstAtomicQueue); 101 } 102 103 /** 104 * Peek the head element of the queue without removing it from the queue. 105 * 106 * Return: the head element of @queue or 107 * %NULL when the queue is empty. 108 */ 109 public void* peek() 110 { 111 return gst_atomic_queue_peek(gstAtomicQueue); 112 } 113 114 /** 115 * Get the head element of the queue. 116 * 117 * Return: the head element of @queue or %NULL when 118 * the queue is empty. 119 */ 120 public void* pop() 121 { 122 return gst_atomic_queue_pop(gstAtomicQueue); 123 } 124 125 /** 126 * Append @data to the tail of the queue. 127 * 128 * Params: 129 * data = the data 130 */ 131 public void push(void* data) 132 { 133 gst_atomic_queue_push(gstAtomicQueue, data); 134 } 135 136 /** 137 * Increase the refcount of @queue. 138 */ 139 public void doref() 140 { 141 gst_atomic_queue_ref(gstAtomicQueue); 142 } 143 144 /** 145 * Unref @queue and free the memory when the refcount reaches 0. 146 */ 147 public void unref() 148 { 149 gst_atomic_queue_unref(gstAtomicQueue); 150 } 151 }