p4est  1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sc_containers.h
Go to the documentation of this file.
1 /*
2  This file is part of the SC Library.
3  The SC Library provides support for parallel scientific applications.
4 
5  Copyright (C) 2010 The University of Texas System
6 
7  The SC Library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public
9  License as published by the Free Software Foundation; either
10  version 2.1 of the License, or (at your option) any later version.
11 
12  The SC Library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public
18  License along with the SC Library; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20  02110-1301, USA.
21 */
22 
23 #ifndef SC_CONTAINERS_H
24 #define SC_CONTAINERS_H
25 
40 #include <sc_obstack.h>
41 
42 SC_EXTERN_C_BEGIN;
43 
44 /* Hash macros from lookup3.c by Bob Jenkins, May 2006, public domain. */
45 #define sc_hash_rot(x,k) (((x) << (k)) | ((x) >> (32 - (k))))
46 #define sc_hash_mix(a,b,c) ((void) \
47  (a -= c, a ^= sc_hash_rot(c, 4), c += b, \
48  b -= a, b ^= sc_hash_rot(a, 6), a += c, \
49  c -= b, c ^= sc_hash_rot(b, 8), b += a, \
50  a -= c, a ^= sc_hash_rot(c,16), c += b, \
51  b -= a, b ^= sc_hash_rot(a,19), a += c, \
52  c -= b, c ^= sc_hash_rot(b, 4), b += a))
53 #define sc_hash_final(a,b,c) ((void) \
54  (c ^= b, c -= sc_hash_rot(b,14), \
55  a ^= c, a -= sc_hash_rot(c,11), \
56  b ^= a, b -= sc_hash_rot(a,25), \
57  c ^= b, c -= sc_hash_rot(b,16), \
58  a ^= c, a -= sc_hash_rot(c, 4), \
59  b ^= a, b -= sc_hash_rot(a,14), \
60  c ^= b, c -= sc_hash_rot(b,24)))
61 
67 typedef unsigned (*sc_hash_function_t) (const void *v, const void *u);
68 
73 typedef int (*sc_equal_function_t) (const void *v1,
74  const void *v2, const void *u);
75 
81 typedef int (*sc_hash_foreach_t) (void **v, const void *u);
82 
92 typedef struct sc_array
93 {
94  /* interface variables */
95  size_t elem_size;
96  size_t elem_count;
98  /* implementation variables */
99  ssize_t byte_alloc;
104  char *array;
105 }
106 sc_array_t;
107 
109 #define SC_ARRAY_IS_OWNER(a) ((a)->byte_alloc >= 0)
110 
111 #define SC_ARRAY_BYTE_ALLOC(a) ((size_t) \
112  (SC_ARRAY_IS_OWNER (a) ? (a)->byte_alloc : -((a)->byte_alloc + 1)))
113 
120 size_t sc_array_memory_used (sc_array_t * array, int is_dynamic);
121 
126 sc_array_t *sc_array_new (size_t elem_size);
127 
134 sc_array_t *sc_array_new_size (size_t elem_size, size_t elem_count);
135 
144  size_t offset, size_t length);
145 
152 sc_array_t *sc_array_new_data (void *base,
153  size_t elem_size, size_t elem_count);
154 
158 void sc_array_destroy (sc_array_t * array);
159 
164 void sc_array_init (sc_array_t * array, size_t elem_size);
165 
172 void sc_array_init_size (sc_array_t * array,
173  size_t elem_size, size_t elem_count);
174 
183 void sc_array_init_view (sc_array_t * view, sc_array_t * array,
184  size_t offset, size_t length);
185 
193 void sc_array_init_data (sc_array_t * view, void *base,
194  size_t elem_size, size_t elem_count);
195 
202 void sc_array_reset (sc_array_t * array);
203 
211 void sc_array_truncate (sc_array_t * array);
212 
220 void sc_array_resize (sc_array_t * array, size_t new_count);
221 
227 void sc_array_copy (sc_array_t * dest, sc_array_t * src);
228 
233 void sc_array_sort (sc_array_t * array,
234  int (*compar) (const void *,
235  const void *));
236 
242 int sc_array_is_sorted (sc_array_t * array,
243  int (*compar) (const void *,
244  const void *));
245 
252 int sc_array_is_equal (sc_array_t * array,
253  sc_array_t * other);
254 
260 void sc_array_uniq (sc_array_t * array,
261  int (*compar) (const void *,
262  const void *));
263 
270 ssize_t sc_array_bsearch (sc_array_t * array,
271  const void *key,
272  int (*compar) (const void *,
273  const void *));
274 
280 typedef size_t (*sc_array_type_t) (sc_array_t * array,
281  size_t index, void *data);
282 
299 void sc_array_split (sc_array_t * array, sc_array_t * offsets,
300  size_t num_types, sc_array_type_t type_fn,
301  void *data);
302 
310 int sc_array_is_permutation (sc_array_t * array);
311 
323 void sc_array_permute (sc_array_t * array,
324  sc_array_t * newindices, int keepperm);
325 
329 unsigned sc_array_checksum (sc_array_t * array);
330 
344 size_t sc_array_pqueue_add (sc_array_t * array,
345  void *temp,
346  int (*compar) (const void *,
347  const void *));
348 
358 size_t sc_array_pqueue_pop (sc_array_t * array,
359  void *result,
360  int (*compar) (const void *,
361  const void *));
362 
366 /*@unused@*/
367 static inline void *
368 sc_array_index (sc_array_t * array, size_t iz)
369 {
370  SC_ASSERT (iz < array->elem_count);
371 
372  return (void *) (array->array + (array->elem_size * iz));
373 }
374 
378 /*@unused@*/
379 static inline void *
381 {
382  SC_ASSERT (i >= 0 && (size_t) i < array->elem_count);
383 
384  return (void *) (array->array + (array->elem_size * (size_t) i));
385 }
386 
390 /*@unused@*/
391 static inline void *
393 {
394  SC_ASSERT (l >= 0 && (size_t) l < array->elem_count);
395 
396  return (void *) (array->array + (array->elem_size * (size_t) l));
397 }
398 
402 /*@unused@*/
403 static inline void *
404 sc_array_index_ssize_t (sc_array_t * array, ssize_t is)
405 {
406  SC_ASSERT (is >= 0 && (size_t) is < array->elem_count);
407 
408  return (void *) (array->array + (array->elem_size * (size_t) is));
409 }
410 
414 /*@unused@*/
415 static inline void *
416 sc_array_index_int16 (sc_array_t * array, int16_t i16)
417 {
418  SC_ASSERT (i16 >= 0 && (size_t) i16 < array->elem_count);
419 
420  return (void *) (array->array + (array->elem_size * (size_t) i16));
421 }
422 
426 /*@unused@*/
427 static inline size_t
428 sc_array_position (sc_array_t * array, void *element)
429 {
430  size_t position;
431 
432  SC_ASSERT (array->array <= (char *) element);
433  SC_ASSERT (((char *) element - array->array) % array->elem_size == 0);
434 
435  position = ((char *) element - array->array) / array->elem_size;
436  SC_ASSERT (position < array->elem_count);
437 
438  return position;
439 }
440 
446 /*@unused@*/
447 static inline void *
449 {
450  SC_ASSERT (SC_ARRAY_IS_OWNER (array));
451  SC_ASSERT (array->elem_count > 0);
452 
453  return (void *) (array->array + (array->elem_size * --array->elem_count));
454 }
455 
460 /*@unused@*/
461 static inline void *
462 sc_array_push_count (sc_array_t * array, size_t add_count)
463 {
464  const size_t old_count = array->elem_count;
465  const size_t new_count = old_count + add_count;
466 
467  SC_ASSERT (SC_ARRAY_IS_OWNER (array));
468 
469  if (array->elem_size * new_count > (size_t) array->byte_alloc) {
470  sc_array_resize (array, new_count);
471  }
472  else {
473  array->elem_count = new_count;
474  }
475 
476  return (void *) (array->array + array->elem_size * old_count);
477 }
478 
483 /*@unused@*/
484 static inline void *
486 {
487  return sc_array_push_count (array, 1);
488 }
489 
496 typedef struct sc_mempool
497 {
498  /* interface variables */
499  size_t elem_size;
500  size_t elem_count;
502  /* implementation variables */
503  struct obstack obstack;
505 }
507 
512 size_t sc_mempool_memory_used (sc_mempool_t * mempool);
513 
518 sc_mempool_t *sc_mempool_new (size_t elem_size);
519 
523 void sc_mempool_destroy (sc_mempool_t * mempool);
524 
527 void sc_mempool_truncate (sc_mempool_t * mempool);
528 
533 /*@unused@*/
534 static inline void *
536 {
537  void *ret;
538  sc_array_t *freed = &mempool->freed;
539 
540  ++mempool->elem_count;
541 
542  if (freed->elem_count > 0) {
543  ret = *(void **) sc_array_pop (freed);
544  }
545  else {
546  ret = obstack_alloc (&mempool->obstack, (int) mempool->elem_size);
547  }
548 
549 #ifdef SC_DEBUG
550  memset (ret, -1, mempool->elem_size);
551 #endif
552 
553  return ret;
554 }
555 
559 /*@unused@*/
560 static inline void
561 sc_mempool_free (sc_mempool_t * mempool, void *elem)
562 {
563  sc_array_t *freed = &mempool->freed;
564 
565  SC_ASSERT (mempool->elem_count > 0);
566 
567 #ifdef SC_DEBUG
568  memset (elem, -1, mempool->elem_size);
569 #endif
570 
571  --mempool->elem_count;
572 
573  *(void **) sc_array_push (freed) = elem;
574 }
575 
578 typedef struct sc_link
579 {
580  void *data;
581  struct sc_link *next;
582 }
583 sc_link_t;
584 
587 typedef struct sc_list
588 {
589  /* interface variables */
590  size_t elem_count;
591  sc_link_t *first;
592  sc_link_t *last;
593 
594  /* implementation variables */
595  int allocator_owned;
596  sc_mempool_t *allocator; /* must allocate sc_link_t */
597 }
598 sc_list_t;
599 
606 size_t sc_list_memory_used (sc_list_t * list, int is_dynamic);
607 
611 sc_list_t *sc_list_new (sc_mempool_t * allocator);
612 
616 void sc_list_destroy (sc_list_t * list);
617 
622 void sc_list_init (sc_list_t * list, sc_mempool_t * allocator);
623 
629 void sc_list_reset (sc_list_t * list);
630 
635 void sc_list_unlink (sc_list_t * list);
636 
637 void sc_list_prepend (sc_list_t * list, void *data);
638 void sc_list_append (sc_list_t * list, void *data);
639 
643 void sc_list_insert (sc_list_t * list,
644  sc_link_t * pred, void *data);
645 
651 void *sc_list_remove (sc_list_t * list, sc_link_t * pred);
652 
656 void *sc_list_pop (sc_list_t * list);
657 
661 typedef struct sc_hash
662 {
663  /* interface variables */
664  size_t elem_count;
666  /* implementation variables */
668  void *user_data;
669  sc_hash_function_t hash_fn;
670  sc_equal_function_t equal_fn;
671  size_t resize_checks, resize_actions;
672  int allocator_owned;
674 }
675 sc_hash_t;
676 
683 unsigned sc_hash_function_string (const void *s, const void *u);
684 
689 size_t sc_hash_memory_used (sc_hash_t * hash);
690 
699  sc_equal_function_t equal_fn,
700  void *user_data, sc_mempool_t * allocator);
701 
707 void sc_hash_destroy (sc_hash_t * hash);
708 
714 void sc_hash_truncate (sc_hash_t * hash);
715 
722 void sc_hash_unlink (sc_hash_t * hash);
723 
728 void sc_hash_unlink_destroy (sc_hash_t * hash);
729 
737 int sc_hash_lookup (sc_hash_t * hash, void *v, void ***found);
738 
746 int sc_hash_insert_unique (sc_hash_t * hash, void *v,
747  void ***found);
748 
755 int sc_hash_remove (sc_hash_t * hash, void *v, void **found);
756 
761 
764 void sc_hash_print_statistics (int package_id,
765  int log_priority,
766  sc_hash_t * hash);
767 
768 typedef struct sc_hash_array_data
769 {
770  sc_array_t *pa;
771  sc_hash_function_t hash_fn;
772  sc_equal_function_t equal_fn;
773  void *user_data;
774  void *current_item;
775 }
777 
781 typedef struct sc_hash_array
782 {
783  /* implementation variables */
784  sc_array_t a;
785  sc_hash_array_data_t internal_data;
786  sc_hash_t *h;
787 }
789 
795 
801 sc_hash_array_t *sc_hash_array_new (size_t elem_size,
802  sc_hash_function_t hash_fn,
803  sc_equal_function_t equal_fn,
804  void *user_data);
805 
808 void sc_hash_array_destroy (sc_hash_array_t * hash_array);
809 
812 int sc_hash_array_is_valid (sc_hash_array_t * hash_array);
813 
817 void sc_hash_array_truncate (sc_hash_array_t * hash_array);
818 
827 int sc_hash_array_lookup (sc_hash_array_t * hash_array,
828  void *v, size_t * position);
829 
841 void *sc_hash_array_insert_unique (sc_hash_array_t * hash_array,
842  void *v, size_t * position);
843 
850 void sc_hash_array_rip (sc_hash_array_t * hash_array,
851  sc_array_t * rip);
852 
858 typedef struct sc_recycle_array
859 {
860  /* interface variables */
861  size_t elem_count; /* number of valid entries */
862 
863  /* implementation variables */
864  sc_array_t a;
865  sc_array_t f;
866 }
868 
873 void sc_recycle_array_init (sc_recycle_array_t * rec_array,
874  size_t elem_size);
875 
881 void sc_recycle_array_reset (sc_recycle_array_t * rec_array);
882 
891  size_t * position);
892 
901  size_t position);
902 
903 SC_EXTERN_C_END;
904 
905 #endif /* !SC_CONTAINERS_H */
sc_array_t freed
buffers the freed elements
Definition: sc_containers.h:504
void sc_list_destroy(sc_list_t *list)
Destroy a linked list structure in O(N).
void * sc_recycle_array_remove(sc_recycle_array_t *rec_array, size_t position)
Remove an object from the recycle array.
static void * sc_array_pop(sc_array_t *array)
Remove the last element from an array and return a pointer to it.
Definition: sc_containers.h:448
void * sc_hash_array_insert_unique(sc_hash_array_t *hash_array, void *v, size_t *position)
Insert an object into a hash array if it is not contained already.
void sc_array_permute(sc_array_t *array, sc_array_t *newindices, int keepperm)
Given permutation newindices, permute array in place.
int sc_hash_lookup(sc_hash_t *hash, void *v, void ***found)
Check if an object is contained in the hash table.
size_t elem_size
size of a single element
Definition: sc_containers.h:499
static void * sc_array_index(sc_array_t *array, size_t iz)
Returns a pointer to an array element.
Definition: sc_containers.h:368
char * array
linear array to store elements
Definition: sc_containers.h:104
void sc_hash_foreach(sc_hash_t *hash, sc_hash_foreach_t fn)
Invoke a callback for every member of the hash table.
void sc_hash_truncate(sc_hash_t *hash)
Remove all entries from a hash table in O(N).
sc_array_t * slots
the slot count is slots->elem_count
Definition: sc_containers.h:667
size_t elem_size
size of a single element
Definition: sc_containers.h:95
void sc_hash_unlink(sc_hash_t *hash)
Unlink all hash elements without returning them to the mempool.
sc_list_t * sc_list_new(sc_mempool_t *allocator)
Allocate a linked list structure.
void sc_mempool_destroy(sc_mempool_t *mempool)
Destroys a mempool structure.
void sc_array_destroy(sc_array_t *array)
Destroys an array structure.
struct obstack obstack
holds the allocated elements
Definition: sc_containers.h:503
sc_hash_t * sc_hash_new(sc_hash_function_t hash_fn, sc_equal_function_t equal_fn, void *user_data, sc_mempool_t *allocator)
Create a new hash table.
int sc_array_is_equal(sc_array_t *array, sc_array_t *other)
Check whether two arrays have equal size, count, and content.
The sc_list object provides a linked list.
Definition: sc_containers.h:587
size_t sc_hash_array_memory_used(sc_hash_array_t *ha)
Calculate the memory used by a hash array.
int sc_hash_array_lookup(sc_hash_array_t *hash_array, void *v, size_t *position)
Check if an object is contained in a hash array.
int(* sc_hash_foreach_t)(void **v, const void *u)
Function to call on every data item of a hash table.
Definition: sc_containers.h:81
sc_array_t * sc_array_new_view(sc_array_t *array, size_t offset, size_t length)
Creates a new view of an existing sc_array_t.
size_t sc_array_pqueue_pop(sc_array_t *array, void *result, int(*compar)(const void *, const void *))
Pops the smallest element from a priority queue.
size_t sc_array_memory_used(sc_array_t *array, int is_dynamic)
Calculate the memory used by an array.
Definition: sc_containers.h:768
unsigned sc_array_checksum(sc_array_t *array)
Computes the adler32 checksum of array data (see zlib documentation).
static void * sc_array_index_int(sc_array_t *array, int i)
Returns a pointer to an array element indexed by a plain int.
Definition: sc_containers.h:380
size_t elem_count
number of valid elements
Definition: sc_containers.h:96
void sc_list_reset(sc_list_t *list)
Removes all elements from a list in O(N).
static void * sc_array_index_int16(sc_array_t *array, int16_t i16)
Returns a pointer to an array element indexed by a int16_t.
Definition: sc_containers.h:416
sc_mempool_t * sc_mempool_new(size_t elem_size)
Creates a new mempool structure.
void sc_array_init(sc_array_t *array, size_t elem_size)
Initializes an already allocated (or static) array structure.
int sc_hash_insert_unique(sc_hash_t *hash, void *v, void ***found)
Insert an object into a hash table if it is not contained already.
static void * sc_array_push(sc_array_t *array)
Enlarge an array by one element.
Definition: sc_containers.h:485
void sc_recycle_array_init(sc_recycle_array_t *rec_array, size_t elem_size)
Initialize a recycle array.
unsigned sc_hash_function_string(const void *s, const void *u)
Compute a hash value from a null-terminated string.
size_t elem_count
total number of objects contained
Definition: sc_containers.h:664
ssize_t byte_alloc
number of allocated bytes or -(number of viewed bytes + 1) if this is a view: the "+ 1" distinguishes...
Definition: sc_containers.h:99
static void * sc_array_push_count(sc_array_t *array, size_t add_count)
Enlarge an array by a number of elements.
Definition: sc_containers.h:462
int sc_array_is_permutation(sc_array_t *array)
Determine whether array is an array of size_t's whose entries include every integer 0 <= i < array->e...
unsigned(* sc_hash_function_t)(const void *v, const void *u)
Function to compute a hash value of an object.
Definition: sc_containers.h:67
void sc_hash_print_statistics(int package_id, int log_priority, sc_hash_t *hash)
Compute and print statistical information about the occupancy.
void * sc_recycle_array_insert(sc_recycle_array_t *rec_array, size_t *position)
Insert an object into the recycle array.
sc_mempool_t * allocator
must allocate sc_link_t
Definition: sc_containers.h:673
void sc_array_resize(sc_array_t *array, size_t new_count)
Sets the element count to new_count.
void sc_array_init_view(sc_array_t *view, sc_array_t *array, size_t offset, size_t length)
Initializes an already allocated (or static) view from existing sc_array_t.
int sc_array_is_sorted(sc_array_t *array, int(*compar)(const void *, const void *))
Check whether the array is sorted wrt.
void sc_array_uniq(sc_array_t *array, int(*compar)(const void *, const void *))
Removed duplicate entries from a sorted array.
void sc_array_sort(sc_array_t *array, int(*compar)(const void *, const void *))
Sorts the array in ascending order wrt.
size_t sc_list_memory_used(sc_list_t *list, int is_dynamic)
Calculate the memory used by a list.
void sc_hash_array_truncate(sc_hash_array_t *hash_array)
Remove all elements from the hash array.
#define SC_ARRAY_IS_OWNER(a)
test whether the sc_array_t owns its array
Definition: sc_containers.h:109
The sc_array object provides a large array of equal-size elements.
Definition: sc_containers.h:92
void sc_array_init_size(sc_array_t *array, size_t elem_size, size_t elem_count)
Initializes an already allocated (or static) array structure and allocates a given number of elements...
void sc_hash_unlink_destroy(sc_hash_t *hash)
Same effect as unlink and destroy, but in O(1).
static void sc_mempool_free(sc_mempool_t *mempool, void *elem)
Return a previously allocated element to the pool.
Definition: sc_containers.h:561
sc_array_t * sc_array_new_data(void *base, size_t elem_size, size_t elem_count)
Creates a new view of an existing plain C array.
void * sc_list_pop(sc_list_t *list)
Remove an element from the front of the list.
void * sc_list_remove(sc_list_t *list, sc_link_t *pred)
Remove an element after a given position.
sc_hash_array_t * sc_hash_array_new(size_t elem_size, sc_hash_function_t hash_fn, sc_equal_function_t equal_fn, void *user_data)
Create a new hash array.
void sc_hash_array_rip(sc_hash_array_t *hash_array, sc_array_t *rip)
Extract the array data from a hash array and destroy everything else.
The sc_recycle_array object provides an array of slots that can be reused.
Definition: sc_containers.h:858
size_t elem_count
number of valid elements
Definition: sc_containers.h:500
void sc_array_split(sc_array_t *array, sc_array_t *offsets, size_t num_types, sc_array_type_t type_fn, void *data)
Compute the offsets of groups of enumerable types in an array.
ssize_t sc_array_bsearch(sc_array_t *array, const void *key, int(*compar)(const void *, const void *))
Performs a binary search on an array.
int(* sc_equal_function_t)(const void *v1, const void *v2, const void *u)
Function to check equality of two objects.
Definition: sc_containers.h:73
void sc_array_truncate(sc_array_t *array)
Sets the array count to zero, but does not free elements.
void sc_list_insert(sc_list_t *list, sc_link_t *pred, void *data)
Insert an element after a given position.
void * user_data
user data passed to hash function
Definition: sc_containers.h:668
int sc_hash_remove(sc_hash_t *hash, void *v, void **found)
Remove an object from a hash table.
void sc_array_reset(sc_array_t *array)
Sets the array count to zero and frees all elements.
void sc_list_unlink(sc_list_t *list)
Unliks all list elements without returning them to the mempool.
static size_t sc_array_position(sc_array_t *array, void *element)
Return the index of an object in an array identified by a pointer.
Definition: sc_containers.h:428
static void * sc_array_index_long(sc_array_t *array, long l)
Returns a pointer to an array element indexed by a plain long.
Definition: sc_containers.h:392
static void * sc_mempool_alloc(sc_mempool_t *mempool)
Allocate a single element.
Definition: sc_containers.h:535
void sc_recycle_array_reset(sc_recycle_array_t *rec_array)
Reset a recycle array.
size_t sc_mempool_memory_used(sc_mempool_t *mempool)
Calculate the memory used by a memory pool.
The sc_mempool object provides a large pool of equal-size elements.
Definition: sc_containers.h:496
void sc_list_init(sc_list_t *list, sc_mempool_t *allocator)
Initializes an already allocated list structure.
size_t sc_hash_memory_used(sc_hash_t *hash)
Calculate the memory used by a hash table.
void sc_array_init_data(sc_array_t *view, void *base, size_t elem_size, size_t elem_count)
Initializes an already allocated (or static) view from given plain C data.
void sc_mempool_truncate(sc_mempool_t *mempool)
Invalidates all previously returned pointers, resets count to 0.
int sc_hash_array_is_valid(sc_hash_array_t *hash_array)
Check the internal consistency of a hash array.
void sc_hash_destroy(sc_hash_t *hash)
Destroy a hash table.
void sc_hash_array_destroy(sc_hash_array_t *hash_array)
Destroy a hash array.
The sc_hash_array implements an array backed up by a hash table.
Definition: sc_containers.h:781
size_t(* sc_array_type_t)(sc_array_t *array, size_t index, void *data)
Function to determine the enumerable type of an object in an array.
Definition: sc_containers.h:280
sc_array_t * sc_array_new_size(size_t elem_size, size_t elem_count)
Creates a new array structure with a given length (number of elements).
static void * sc_array_index_ssize_t(sc_array_t *array, ssize_t is)
Returns a pointer to an array element indexed by a ssize_t.
Definition: sc_containers.h:404
size_t sc_array_pqueue_add(sc_array_t *array, void *temp, int(*compar)(const void *, const void *))
Adds an element to a priority queue.
sc_array_t * sc_array_new(size_t elem_size)
Creates a new array structure with 0 elements.
void sc_array_copy(sc_array_t *dest, sc_array_t *src)
Copy the contents of an array into another.
The sc_hash implements a hash table.
Definition: sc_containers.h:661