]> git.donarmstrong.com Git - biopieces.git/blob - code_c/Maasha/src/inc/barray.h
added bed2tag_contigs.c
[biopieces.git] / code_c / Maasha / src / inc / barray.h
1 /* Martin Asser Hansen (mail@maasha.dk) Copyright (C) 2008 - All right reserved */
2
3
4 /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> STRUCTURE DECLARATIONS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
5
6
7 struct _barray
8 {
9     ushort *array;   /* Unsigned short array. */
10     size_t  nmemb;   /* Number of elements in array. */
11     size_t  end;     /* Last position used. */
12 };
13
14 typedef struct _barray barray;
15
16
17 /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> FUNCTION DECLARATIONS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
18
19
20 /* Initialize a new zeroed byte array
21  * with nmemb number of elements. */
22 barray *barray_new( size_t nmemb );
23
24 /* Returns a new larger byte array size. */
25 size_t barray_new_size( size_t nmemb_old );
26
27 /* Reallocate a byte array, any new elements will be zeroed. */
28 void barray_resize( barray *ba, size_t nmemb_new );
29
30 /* Debug function to print the content of a byte array. */
31 void barray_print( barray *ba );
32
33 /* Increments a given interval of a byte array with a given score.
34  * Resizes the byte array if needed. */
35 void barray_interval_inc( barray *ba, size_t beg, size_t end, ushort score );
36
37 /* Scan a byte array from a given position
38  * for the next interval of non-zero values. */
39 bool barray_interval_scan( barray *ba, size_t *pos_pt, size_t *beg_pt, size_t *end_pt );
40
41 /* Locate the max value in an interval within a byte array. */ 
42 ushort barray_interval_max( barray *ba, size_t beg, size_t end );
43
44 /* Deallocates a byte array and set it to NULL. */
45 void barray_destroy( barray **ba_ppt );
46
47
48 /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
49
50