extern inline DSTATUS flex_nuke(flex_t flex) { check(flex,"Was given uninitialized flex"); index_t x; DSTATUS status; status = flex_traverse(flex,flex->free_func); check_alt(status == SUCCESS); for(x = 0 ; x <= flex->last_index_occup; x++){ free(flex->index_block[x]); } free(flex->index_block); free(flex); return SUCCESS; error: return FAILURE; }
extern inline DSTATUS flex_insert(flex_t flex, index_t requested_index, data_p user_data) { DSTATUS status; index_t r,k,b,e,p; r = requested_index + 1; k = LEADINGBIT(r); // no need for minus 1. already zero indexed b = BITSUBSET(r,k-k/2,k); e = BITSUBSET(r,0, CEILING(k,2)); p = (1 << (k/2 + 1)) - 2 + (k & 1) * (1 << (k/2)); //log_info("Grow Check P+B:[%ld], index: [%ld]",p+b, flex->index_length); //printf("k/2=[%ld], Ceil(k,2)=[%ld]\n",k/2,CEILING(k,2)); //printf("K: [%ld] is the leading 1 bit\n",k); // printf("B: [%ld]\n",b); while(p+b > flex->last_index_occup){ // we have an index which would seg fault status = flex_grow(flex); //flex_debug_out(flex); check_alt(status == SUCCESS); } //log_info("trying [%ld,%ld]",(p+b),e); (flex->index_block[(p+b)][e]) = *user_data; return SUCCESS; error: return FAILURE; }
void MetaEntryVisitor::operator()(std::map<std::string, std::string> & value) const { auto & id = entry.id; if (id == ALT) { check_alt(value); } else if (id == ASSEMBLY) { // TODO May check URL correctness (regexp?) } else if (id == CONTIG) { check_contig(value); } else if (id == FILTER) { check_filter(value); } else if (id == FORMAT) { check_format(value); } else if (id == INFO) { check_info(value); } else if (id == PEDIGREE) { // Nothing to check } else if (id == PEDIGREEDB) { // Nothing to check } else if (id == SAMPLE) { check_sample(value); } }