ccp4_array.h

Go to the documentation of this file.
00001 /*
00002      ccp4_array.h: header file for resizable array implementation. 
00003      Copyright (C) 2002  Kevin Cowtan
00004 
00005      This library is free software; you can redistribute it and/or
00006      modify it under the terms of the GNU Lesser General Public
00007      License as published by the Free Software Foundation; either
00008      version 2.1 of the License, or (at your option) any later
00009      version.
00010 
00011      This library is distributed in the hope that it will be useful,
00012      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014      Lesser General Public License for more details.
00015 
00016      You should have received a copy of the GNU Lesser General Public
00017      License along with this library; if not, write to the Free
00018      Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019      Boston, MA 02110-1301 USA
00020 
00021 */
00022 
00071 #ifndef __CCP4_ARRAY_INC
00072 #define __CCP4_ARRAY_INC
00073 
00074 #ifdef  __cplusplus
00075 extern "C" {
00076 #endif
00077 
00078 #include <stdlib.h>
00079 #include <string.h>
00080 
00082 typedef const void *ccp4_constptr;
00084 typedef char *ccp4_byteptr;
00086 typedef void *ccp4_ptr;
00087 
00090 typedef struct ccp4array_base_ {
00091   int size;                     
00092   int capacity;                 
00093 } ccp4array_base;
00094 
00100 #define ccp4array_new(v) ccp4array_new_((ccp4_ptr*)(&v))
00101 
00108 #define ccp4array_new_size(v,s) ccp4array_new_size_((ccp4_ptr*)(&v),s,sizeof(*v))
00109 
00118 #define ccp4array_resize(v,s) ccp4array_resize_((ccp4_ptr*)(&v),s,sizeof(*v))
00119 
00128 #define ccp4array_reserve(v,s) ccp4array_reserve_((ccp4_ptr*)(&v),s,sizeof(*v))
00129 
00136 #define ccp4array_append(v,d) ccp4array_append_((ccp4_ptr*)(&v),(ccp4_constptr)(&d),sizeof(*v))
00137 
00145 #define ccp4array_append_n(v,d,n) ccp4array_append_n_((ccp4_ptr*)(&v),(ccp4_constptr)(&d),n,sizeof(*v))
00146 
00154 #define ccp4array_append_list(v,l,n) ccp4array_append_list_((ccp4_ptr*)(&v),(ccp4_constptr)l,n,sizeof(*v))
00155 
00163 #define ccp4array_insert(v,i,d) ccp4array_insert_((ccp4_ptr*)(&v),i,(ccp4_constptr)(&d),sizeof(*v))
00164 
00171 #define ccp4array_delete_ordered(v,i) ccp4array_delete_ordered_((ccp4_ptr*)(&v),i,sizeof(*v))
00172 
00178 #define ccp4array_delete(v,i) ccp4array_delete_((ccp4_ptr*)(&v),i,sizeof(*v))
00179 
00184 #define ccp4array_delete_last(v) ccp4array_delete_last_((ccp4_ptr*)(&v),sizeof(*v))
00185 
00190 #define ccp4array_size(v) ccp4array_size_((ccp4_constptr*)(&v))
00191 
00196 #define ccp4array_free(v) ccp4array_free_((ccp4_ptr*)(&v))
00197 
00201 ccp4_ptr ccp4array_new_(ccp4_ptr *p);
00205 ccp4_ptr ccp4array_new_size_(ccp4_ptr *p, const int size, const size_t reclen);
00209 void ccp4array_resize_(ccp4_ptr *p, const int size, const size_t reclen);
00213 void ccp4array_reserve_(ccp4_ptr *p, const int size, const size_t reclen);
00217 void ccp4array_append_(ccp4_ptr *p, ccp4_constptr data, const size_t reclen);
00221 void ccp4array_append_n_(ccp4_ptr *p, ccp4_constptr data, const int n, const size_t reclen);
00225 void ccp4array_append_list_(ccp4_ptr *p, ccp4_constptr data, const int n, const size_t reclen);
00229 void ccp4array_insert_(ccp4_ptr *p, const int i, ccp4_constptr data, const size_t reclen);
00233 void ccp4array_delete_ordered_(ccp4_ptr *p, const int i, const size_t reclen);
00237 void ccp4array_delete_(ccp4_ptr *p, const int i, const size_t reclen);
00241 void ccp4array_delete_last_(ccp4_ptr *p, const size_t reclen);
00245 int ccp4array_size_(ccp4_constptr *p);
00249 void ccp4array_free_(ccp4_ptr *p);
00250 
00251 #ifdef __cplusplus
00252 } 
00253 #endif
00254 
00255 #endif /* __CCP4_ARRAY_INC */
00256 
00257 /*
00258   Local variables:
00259   mode: font-lock
00260   End:
00261 */

Generated on Wed Oct 29 21:14:36 2008 for gpp4 by  doxygen 1.4.7