pl-nk v0.4.5
Plonk|Plink|Plank are a set of cross-platform C/C++ frameworks for audio software development
plank_LockFreeDynamicArray.h
00001 /*
00002  -------------------------------------------------------------------------------
00003  This file is part of the Plink, Plonk, Plank libraries
00004   by Martin Robinson
00005  
00006  http://code.google.com/p/pl-nk/
00007  
00008  Copyright University of the West of England, Bristol 2011-14
00009  All rights reserved.
00010  
00011  Redistribution and use in source and binary forms, with or without
00012  modification, are permitted provided that the following conditions are met:
00013  
00014  * Redistributions of source code must retain the above copyright
00015    notice, this list of conditions and the following disclaimer.
00016  * Redistributions in binary form must reproduce the above copyright
00017    notice, this list of conditions and the following disclaimer in the
00018    documentation and/or other materials provided with the distribution.
00019  * Neither the name of University of the West of England, Bristol nor 
00020    the names of its contributors may be used to endorse or promote products
00021    derived from this software without specific prior written permission.
00022  
00023  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00024  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00025  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
00026  DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF THE WEST OF ENGLAND, BRISTOL BE 
00027  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
00028  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
00029  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
00030  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
00031  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
00032  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
00033  
00034  This software makes use of third party libraries. For more information see:
00035  doc/license.txt included in the distribution.
00036  -------------------------------------------------------------------------------
00037  */
00038 
00039 #ifndef PLANK_LOCKFREEDYNAMICARRAY_H
00040 #define PLANK_LOCKFREEDYNAMICARRAY_H
00041 
00042 // unlikely to implement now... 
00043 
00044 //#define PLANKLOCKFREEDYNAMICARRAY_DEFAULTGRANULARITY 8
00045 //#define PLANKLOCKFREEDYNAMICARRAY_DEFAULTITEMSIZE 4
00046 //
00047 //PLANK_BEGIN_C_LINKAGE
00048 //
00049 //
00051 // 
00052 // @defgroup PlankLockFreeDynamicArrayClass Plank LockFreeDynamicArray class
00053 // @ingroup PlankClasses
00054 // @{
00055 // */
00056 //
00058 //typedef struct PlankLockFreeDynamicArray* PlankLockFreeDynamicArrayRef; 
00059 //
00061 // @return A <i>Plank LockFreeDynamicArray</i> object as an opaque reference or PLANK_NULL. */
00062 //PlankLockFreeDynamicArrayRef pl_LockFreeDynamicArray_CreateAndInit();
00063 //
00065 // @return A <i>Plank LockFreeDynamicArray</i> object as an opaque reference or PLANK_NULL. */
00066 //PlankLockFreeDynamicArrayRef pl_LockFreeDynamicArray_Create();
00067 //
00069 // @param p The <i>Plank LockFreeDynamicArray</i> object.
00070 // @return A result code which will be PlankResult_OK if the operation was completely successful. */
00071 //PlankResult pl_LockFreeDynamicArray_Init (PlankLockFreeDynamicArrayRef);
00072 //
00074 // @param p The <i>Plank LockFreeDynamicArray</i> object.
00075 // @return A result code which will be PlankResult_OK if the operation was completely successful. */
00076 //PlankResult pl_LockFreeDynamicArray_InitWithItemSize (PlankLockFreeDynamicArrayRef p, const PlankL itemSize);
00077 //
00079 // @param p The <i>Plank LockFreeDynamicArray</i> object
00080 // @return A result code which will be PlankResult_OK if the operation was completely successful. */
00081 //PlankResult pl_LockFreeDynamicArray_InitWithItemSizeAndCapacity (PlankLockFreeDynamicArrayRef p, const PlankL itemSize, const PlankL initialCapacity);
00082 //
00084 // @param p The <i>Plank LockFreeDynamicArray</i> object.
00085 // @return A result code which will be PlankResult_OK if the operation was completely successful. */
00086 //PlankResult pl_LockFreeDynamicArray_DeInit (PlankLockFreeDynamicArrayRef p);
00087 //
00089 // @param p The <i>Plank LockFreeDynamicArray</i> object. */
00090 //PlankResult pl_LockFreeDynamicArray_Destroy (PlankLockFreeDynamicArrayRef p);
00091 //
00093 //PlankB pl_LockFreeDynamicArray_IsIndexInRange (PlankLockFreeDynamicArrayRef p, const PlankL index);
00094 //
00096 //PlankLL pl_LockFreeDynamicArray_GetSize (PlankLockFreeDynamicArrayRef p);
00097 //
00099 // This copies the bytes from one memory location to the array data based on the item
00100 // size set during initialisation.
00101 // @param p The <i>Plank LockFreeDynamicArray</i> object
00102 // @param item The item to add to the array.
00103 // @return A result code which will be PlankResult_OK if the operation was completely successful. */
00104 //PlankResult pl_LockFreeDynamicArray_AddItem (PlankLockFreeDynamicArrayRef p, const PlankP item);
00105 //
00107 // This copies the bytes from one memory location to the array data based on the item
00108 // size set during initialisation. 
00109 // @param p The <i>Plank LockFreeDynamicArray</i> object.
00110 // @param index The desired index. This must be between 0 and one less that the current size.  
00111 // @param item The item to add to the array.
00112 // @return A result code which will be PlankResult_OK if the operation was completely successful. */
00113 //PlankResult pl_LockFreeDynamicArray_SetItem (PlankLockFreeDynamicArrayRef p, const PlankL index, const PlankP item);
00114 //
00116 // This copies the bytes from one memory location to the array data based on the item
00117 // size set during initialisation. Items above the specified index will be moved one
00118 // index higher.
00119 // @param p The <i>Plank LockFreeDynamicArray</i> object.
00120 // @param index The desired index. This should be 0 or greater. If this is beyond the 
00121 //              size of the array the item will be added to the end. 
00122 // @param item The item to add to the array.
00123 // @return A result code which will be PlankResult_OK if the operation was completely successful. */
00124 //PlankResult pl_LockFreeDynamicArray_InsertItem (PlankLockFreeDynamicArrayRef p, const PlankL index, const PlankP item);
00125 //
00127 // @param p The <i>Plank LockFreeDynamicArray</i> object.
00128 // @param index The desired index. This must be between 0 and one less that the current size.  
00129 // @param item The destination to copy the specified item. This must point to memory of 
00130 //             sufficient size to hold the item.
00131 // @return A result code which will be PlankResult_OK if the operation was completely successful. */
00132 //PlankResult pl_LockFreeDynamicArray_GetItem (PlankLockFreeDynamicArrayRef p, const PlankL index, PlankP item);
00133 //
00135 // @param p The <i>Plank LockFreeDynamicArray</i> object.
00136 // @param index The desired index to remove. This must be between 0 and one less that the current size. 
00137 // @return A result code which will be PlankResult_OK if the operation was completely successful. */
00138 //PlankResult pl_LockFreeDynamicArray_RemoveItem (PlankLockFreeDynamicArrayRef p, const PlankL index);
00139 //
00141 // This will resize the array if necessary to hold the specified capacity. This only
00142 // resizes the avauilable capacity pl_LockFreeDynamicArray_GetSize() will still return the
00143 // number of items used.
00144 // @param p The <i>Plank LockFreeDynamicArray</i> object.
00145 // @param capacity The number of items the array should be set to hold.
00146 // @return A result code which will be PlankResult_OK if the operation was completely successful. */
00147 //PlankResult pl_LockFreeDynamicArray_EnsureSize (PlankLockFreeDynamicArrayRef p, const PlankL capacity);
00148 //
00150 // @param p The <i>Plank LockFreeDynamicArray</i> object.
00151 // @param amount The number of additional items the array should be set to hold.
00152 // @return A result code which will be PlankResult_OK if the operation was completely successful. */
00153 //PlankResult pl_LockFreeDynamicArray_Grow (PlankLockFreeDynamicArrayRef p, const int amount);
00154 //
00156 // This sets the allocated size to the number of items used.
00157 // @warniong During this operation the array may temporarily require more memory. 
00158 // @param p The <i>Plank LockFreeDynamicArray</i> object.
00159 // @return A result code which will be PlankResult_OK if the operation was completely successful. */
00160 //PlankResult pl_LockFreeDynamicArray_Purge (PlankLockFreeDynamicArrayRef p);
00161 //
00163 //
00164 //PLANK_END_C_LINKAGE
00165 //
00166 //#if !DOXYGEN
00167 //typedef struct PlankLockFreeDynamicArray
00168 //{
00169 //    PlankL itemSize;
00170 //    PlankL allocatedItems;
00171 //    PlankL usedItems;
00172 //    PlankP data;
00173 //} PlankLockFreeDynamicArray;
00174 //#endif
00175 
00176 #endif // PLANK_LOCKFREEDYNAMICARRAY_H
 All Classes Functions Typedefs Enumerations Enumerator Properties