#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
Classes | |
struct | ccp4array_base_ |
Defines | |
#define | ccp4array_new(v) ccp4array_new_((ccp4_ptr*)(&v)) |
#define | ccp4array_new_size(v, s) ccp4array_new_size_((ccp4_ptr*)(&v),s,sizeof(*v)) |
#define | ccp4array_resize(v, s) ccp4array_resize_((ccp4_ptr*)(&v),s,sizeof(*v)) |
#define | ccp4array_reserve(v, s) ccp4array_reserve_((ccp4_ptr*)(&v),s,sizeof(*v)) |
#define | ccp4array_append(v, d) ccp4array_append_((ccp4_ptr*)(&v),(ccp4_constptr)(&d),sizeof(*v)) |
#define | ccp4array_append_n(v, d, n) ccp4array_append_n_((ccp4_ptr*)(&v),(ccp4_constptr)(&d),n,sizeof(*v)) |
#define | ccp4array_append_list(v, l, n) ccp4array_append_list_((ccp4_ptr*)(&v),(ccp4_constptr)l,n,sizeof(*v)) |
#define | ccp4array_insert(v, i, d) ccp4array_insert_((ccp4_ptr*)(&v),i,(ccp4_constptr)(&d),sizeof(*v)) |
#define | ccp4array_delete_ordered(v, i) ccp4array_delete_ordered_((ccp4_ptr*)(&v),i,sizeof(*v)) |
#define | ccp4array_delete(v, i) ccp4array_delete_((ccp4_ptr*)(&v),i,sizeof(*v)) |
#define | ccp4array_delete_last(v) ccp4array_delete_last_((ccp4_ptr*)(&v),sizeof(*v)) |
#define | ccp4array_size(v) ccp4array_size_((ccp4_constptr*)(&v)) |
#define | ccp4array_free(v) ccp4array_free_((ccp4_ptr*)(&v)) |
Typedefs | |
typedef const void * | ccp4_constptr |
typedef char * | ccp4_byteptr |
typedef void * | ccp4_ptr |
typedef struct ccp4array_base_ | ccp4array_base |
Functions | |
ccp4_ptr | ccp4array_new_ (ccp4_ptr *p) |
ccp4_ptr | ccp4array_new_size_ (ccp4_ptr *p, const int size, const size_t reclen) |
void | ccp4array_resize_ (ccp4_ptr *p, const int size, const size_t reclen) |
void | ccp4array_reserve_ (ccp4_ptr *p, const int size, const size_t reclen) |
void | ccp4array_append_ (ccp4_ptr *p, ccp4_constptr data, const size_t reclen) |
void | ccp4array_append_n_ (ccp4_ptr *p, ccp4_constptr data, const int n, const size_t reclen) |
void | ccp4array_append_list_ (ccp4_ptr *p, ccp4_constptr data, const int n, const size_t reclen) |
void | ccp4array_insert_ (ccp4_ptr *p, const int i, ccp4_constptr data, const size_t reclen) |
void | ccp4array_delete_ordered_ (ccp4_ptr *p, const int i, const size_t reclen) |
void | ccp4array_delete_ (ccp4_ptr *p, const int i, const size_t reclen) |
void | ccp4array_delete_last_ (ccp4_ptr *p, const size_t reclen) |
int | ccp4array_size_ (ccp4_constptr *p) |
void | ccp4array_free_ (ccp4_ptr *p) |
#define ccp4array_append | ( | v, | |||
d | ) | ccp4array_append_((ccp4_ptr*)(&v),(ccp4_constptr)(&d),sizeof(*v)) |
Macro to append an element to an array. This increments the size. Memory allocation only takes place if the new size is greater than the capacity.
v | The array pointer | |
d | The new element (may not be a literal) |
#define ccp4array_append_list | ( | v, | |||
l, | |||||
n | ) | ccp4array_append_list_((ccp4_ptr*)(&v),(ccp4_constptr)l,n,sizeof(*v)) |
Macro to append n elements from another list to an array. This increment the size by n. Memory allocation only takes place if the new size is greater than the capacity.
v | The array pointer | |
l | Pointer to the list | |
n | The number of copies to append |
#define ccp4array_append_n | ( | v, | |||
d, | |||||
n | ) | ccp4array_append_n_((ccp4_ptr*)(&v),(ccp4_constptr)(&d),n,sizeof(*v)) |
Macro to append n copies of an element to an array. This increments the size by n. Memory allocation only takes place if the new size is greater than the capacity.
v | The array pointer | |
d | The new element (may not be a literal) | |
n | The number of copies to append |
#define ccp4array_delete | ( | v, | |||
i | ) | ccp4array_delete_((ccp4_ptr*)(&v),i,sizeof(*v)) |
Macro to delete element[i] of an array without preserving order. The last element is moved into the gap, and the size is decremented.
v | The array pointer | |
i | The element to be deleted |
#define ccp4array_delete_last | ( | v | ) | ccp4array_delete_last_((ccp4_ptr*)(&v),sizeof(*v)) |
Macro to delete the last element of an array. This decrements the size.
v | The array pointer |
#define ccp4array_delete_ordered | ( | v, | |||
i | ) | ccp4array_delete_ordered_((ccp4_ptr*)(&v),i,sizeof(*v)) |
Macro to delete element[i] of an array, preserving order. This decrements the size. All subsequent elements are moved down. As a result this method is slow.
v | The array pointer | |
i | The element to be deleted |
Referenced by MtzDeleteRefl().
#define ccp4array_free | ( | v | ) | ccp4array_free_((ccp4_ptr*)(&v)) |
Macro free the array. All memory, including the header, is freed.
v | The array pointer |
Referenced by MtzFree(), and MtzFreeCol().
#define ccp4array_insert | ( | v, | |||
i, | |||||
d | ) | ccp4array_insert_((ccp4_ptr*)(&v),i,(ccp4_constptr)(&d),sizeof(*v)) |
Macro to insert an element before the element[i] of an array. This increments the size. All subsequent elements are moved up. As a result this method is slow.
v | The array pointer | |
d | The new element (may not be a literal) | |
i | The element before which the insertion is to be made. |
#define ccp4array_new | ( | v | ) | ccp4array_new_((ccp4_ptr*)(&v)) |
Macro to allocate a new array. The array is allocated with a size and capacity of 0
v | The array pointer |
#define ccp4array_new_size | ( | v, | |||
s | ) | ccp4array_new_size_((ccp4_ptr*)(&v),s,sizeof(*v)) |
Macro to allocate a new array with non-zero size. The array is allocated with a size of s and capacity of at least s
v | The array pointer | |
s | The new size |
Referenced by MtzAddDataset(), MtzAddXtal(), MtzMalloc(), and MtzMallocCol().
#define ccp4array_reserve | ( | v, | |||
s | ) | ccp4array_reserve_((ccp4_ptr*)(&v),s,sizeof(*v)) |
Macro to reserve space for an array. This forces a memory reallocation. The size of the array is unchanged, unless the new capacity is less than the current size, in which case the size is set to the new capacity. Unlike resize, the new allocation will be exactly the size of the array.
v | The array pointer | |
s | The new capacity |
#define ccp4array_resize | ( | v, | |||
s | ) | ccp4array_resize_((ccp4_ptr*)(&v),s,sizeof(*v)) |
Macro to resize an array. This changes the size. Memory allocation only takes place if the new size is greater than the capacity. If that occurs, the new capacity will be slightly greater than the requested size, to allow room for expansion.
v | The array pointer | |
s | The new size |
Referenced by ccp4_lwrefl(), MtzAddColumn(), MtzAddDataset(), MtzAddXtal(), and MtzAssignColumn().
#define ccp4array_size | ( | v | ) | ccp4array_size_((ccp4_constptr*)(&v)) |
Macro to return the size of the array.
v | The array pointer |
Referenced by ccp4_lwrefl(), MtzAddColumn(), MtzAddDataset(), MtzAddXtal(), and MtzAssignColumn().
typedef char* ccp4_byteptr |
byte pointer type
typedef const void* ccp4_constptr |
constant pointer type
typedef void* ccp4_ptr |
pointer type
void ccp4array_append_ | ( | ccp4_ptr * | p, | |
ccp4_constptr | data, | |||
const size_t | reclen | |||
) |
See macro ccp4array_append
References ccp4array_resize_().
void ccp4array_append_list_ | ( | ccp4_ptr * | p, | |
ccp4_constptr | data, | |||
const int | n, | |||
const size_t | reclen | |||
) |
See macro ccp4array_append_list
References ccp4array_resize_().
void ccp4array_append_n_ | ( | ccp4_ptr * | p, | |
ccp4_constptr | data, | |||
const int | n, | |||
const size_t | reclen | |||
) |
See macro ccp4array_append_n
References ccp4array_resize_().
void ccp4array_delete_ | ( | ccp4_ptr * | p, | |
const int | i, | |||
const size_t | reclen | |||
) |
See macro ccp4array_delete
void ccp4array_delete_last_ | ( | ccp4_ptr * | p, | |
const size_t | reclen | |||
) |
See macro ccp4array_delete_last
void ccp4array_delete_ordered_ | ( | ccp4_ptr * | p, | |
const int | i, | |||
const size_t | reclen | |||
) |
See macro ccp4array_delete_ordered
void ccp4array_free_ | ( | ccp4_ptr * | p | ) |
See macro ccp4array_free
void ccp4array_insert_ | ( | ccp4_ptr * | p, | |
const int | i, | |||
ccp4_constptr | data, | |||
const size_t | reclen | |||
) |
See macro ccp4array_insert
References ccp4array_resize_().
See macro ccp4array_new_size
void ccp4array_reserve_ | ( | ccp4_ptr * | p, | |
const int | size, | |||
const size_t | reclen | |||
) |
See macro ccp4array_reserve
void ccp4array_resize_ | ( | ccp4_ptr * | p, | |
const int | size, | |||
const size_t | reclen | |||
) |
See macro ccp4array_resize
Referenced by ccp4array_append_(), ccp4array_append_list_(), ccp4array_append_n_(), and ccp4array_insert_().
int ccp4array_size_ | ( | ccp4_constptr * | p | ) |
See macro ccp4array_size