18 #ifndef _biomcmc_char_vector_h_ 19 #define _biomcmc_char_vector_h_ 66 void char_vector_append_string_big (char_vector vec,
const char *
string);
67 void char_vector_finalise_big (char_vector vec);
94 void update_species_count_from_gene_char_vector (char_vector species, char_vector gene,
int *sp_count);
Probability distribution functions and auxiliary mathematical functions from statistical package R...
char_vector new_char_vector_from_valid_strings_char_vector(char_vector vec, int *valid, int n_valid)
Create a vector of strings from subset of strings of another char_vector.
Definition: char_vector.c:80
void char_vector_add_string_at_position(char_vector vec, const char *string, int position)
Add a new string (vector of characters) at specific location.
Definition: char_vector.c:142
char_vector new_char_vector_big(int nstrings)
Create vector of strings, and preparing it to realloc() fewer times; used in conjunction with 'append...
Definition: char_vector.c:71
void del_char_vector(char_vector vec)
Delete vector of strings only after nobody is using it.
Definition: char_vector.c:114
vector of strings (char vectors) of variable length
Definition: char_vector.h:27
char_vector new_char_vector(int nstrings)
Create a vector of strings with initial size for each string of zero.
Definition: char_vector.c:46
char_vector new_char_vector_fixed_length(int nstrings, int nchars)
Create a vector of strings where each string is assigned an initial value of nchars.
Definition: char_vector.c:89
void char_vector_reorder_strings_from_external_order(char_vector vec, int *order)
update order of strings in vector based on a vector of new positions
Definition: char_vector.c:258
bool char_vector_link_address_if_identical(char_vector *v1, char_vector *v2)
If the two char_vectors are identical (same strings in same order), then delete one and make it point...
Definition: char_vector.c:389
void char_vector_reduce_to_valid_strings(char_vector vec, int *valid, int n_valid)
reduce char_string_struct to only those elements indexed by valid[]
Definition: char_vector.c:350
Lowest level header file. Header file for lowlevel.c.
void char_vector_append_string_big_at_position(char_vector vec, const char *string, int position)
Append strings like before, but doubling allocation space if insufficient (reduces calls to realloc()...
Definition: char_vector.c:193
int next_avail
how many times this char_vector_struct is being used
Definition: char_vector.h:35
void char_vector_reorder_by_size_or_lexicographically(char_vector vec, bool lexico, int *order)
Order char_vector_struct elements from longer string to smaller, or lexicographically; can be used af...
Definition: char_vector.c:365
void char_vector_link_string_at_position(char_vector vec, const char *string, int position)
Link a previously allocated string (to avoid copying all characters)
Definition: char_vector.c:129
void index_species_gene_char_vectors(char_vector species, char_vector gene, int *sp_idx_in_gene, int *order_external)
find occurences of species->string[] inside gene->string[] filling indexes in sp_idx_in_gene.
Definition: char_vector.c:408
size_t * alloc
how many strings
Definition: char_vector.h:31
size_t * nchars
in some cases (e.g. huge fasta files) we need to reduce calls to realloc()
Definition: char_vector.h:32
void char_vector_append_string(char_vector vec, const char *string)
Append string at the end of existing string at most recently used location.
Definition: char_vector.c:186
void char_vector_append_string_at_position(char_vector vec, const char *string, int position)
Append string at the end of existing string at location.
Definition: char_vector.c:166
int nstrings
vector of strings
Definition: char_vector.h:30
int char_vector_remove_duplicate_strings(char_vector vec)
Remove identical strings and resizes char_vector_struct.
Definition: char_vector.c:317
int ref_counter
length of allocated memory for each string excluding the ending '\0' (the actual size in use needs st...
Definition: char_vector.h:34
int char_vector_remove_empty_strings(char_vector vec)
Reduce size of vector of strings by removing empty strings (returns number of empty strings) ...
Definition: char_vector.c:283
void char_vector_expand_nstrings(char_vector vec, int new_size)
Increase size of vector of strings (called automatically by other functions)
Definition: char_vector.c:235
void char_vector_add_string(char_vector vec, const char *string)
Add a new string (vector of characters) at next available location.
Definition: char_vector.c:160