void gt_diagram_add_custom_track(GtDiagram *diagram, GtCustomTrack* ctrack) { gt_assert(diagram && ctrack); gt_rwlock_wrlock(diagram->lock); gt_array_add(diagram->custom_tracks, ctrack); gt_rwlock_unlock(diagram->lock); }
void gt_feature_index_delete(GtFeatureIndex *fi) { if (!fi) return; gt_rwlock_wrlock(fi->pvt->lock); if (fi->pvt->reference_count) { fi->pvt->reference_count--; gt_rwlock_unlock(fi->pvt->lock); return; } gt_assert(fi->c_class); if (fi->c_class->free) fi->c_class->free(fi); gt_rwlock_unlock(fi->pvt->lock); gt_rwlock_delete(fi->pvt->lock); gt_free(fi->pvt); gt_free(fi); }
GtFeatureIndex* gt_feature_index_ref(GtFeatureIndex *fi) { gt_assert(fi); gt_rwlock_wrlock(fi->pvt->lock); fi->pvt->reference_count++; gt_rwlock_unlock(fi->pvt->lock); return fi; }
GtRange gt_diagram_get_range(const GtDiagram *diagram) { GtRange rng; gt_assert(diagram); gt_rwlock_rdlock(diagram->lock); rng = diagram->range; gt_rwlock_unlock(diagram->lock); return rng; }
GtArray* gt_diagram_get_custom_tracks(const GtDiagram *diagram) { GtArray *ret; gt_assert(diagram); gt_rwlock_rdlock(diagram->lock); ret = diagram->custom_tracks; gt_rwlock_unlock(diagram->lock); return ret; }
void gt_diagram_reset_track_selector_func(GtDiagram *diagram) { gt_assert(diagram); gt_rwlock_wrlock(diagram->lock); diagram->select_func = default_track_selector; gt_hashmap_delete(diagram->blocks); diagram->blocks = NULL; gt_rwlock_unlock(diagram->lock); }
GtStrArray* gt_feature_index_get_seqids(const GtFeatureIndex *feature_index, GtError *err) { GtStrArray *strarr; gt_assert(feature_index && feature_index->c_class); gt_rwlock_rdlock(feature_index->pvt->lock); strarr = feature_index->c_class->get_seqids(feature_index, err); gt_rwlock_unlock(feature_index->pvt->lock); return strarr; }
int gt_feature_index_save(GtFeatureIndex *feature_index, GtError *err) { int ret; gt_assert(feature_index && feature_index->c_class); gt_assert(feature_index->c_class->save_func); gt_rwlock_wrlock(feature_index->pvt->lock); ret = feature_index->c_class->save_func(feature_index, err); gt_rwlock_unlock(feature_index->pvt->lock); return ret; }
int gt_feature_index_remove_node(GtFeatureIndex *feature_index, GtFeatureNode *node, GtError *err) { int ret; gt_assert(feature_index && feature_index->c_class && node); gt_rwlock_wrlock(feature_index->pvt->lock); ret = feature_index->c_class->remove_node(feature_index, node, err); gt_rwlock_unlock(feature_index->pvt->lock); return ret; }
char* gt_feature_index_get_first_seqid(const GtFeatureIndex *feature_index, GtError *err) { const char *str; gt_assert(feature_index && feature_index->c_class); gt_rwlock_rdlock(feature_index->pvt->lock); str = feature_index->c_class->get_first_seqid(feature_index, err); gt_rwlock_unlock(feature_index->pvt->lock); return (char*) str; }
GtArray* gt_feature_index_get_features_for_seqid(GtFeatureIndex *fi, const char *seqid, GtError *err) { GtArray *arr; gt_assert(fi && fi->c_class && seqid); gt_rwlock_rdlock(fi->pvt->lock); arr = fi->c_class->get_features_for_seqid(fi, seqid, err); gt_rwlock_unlock(fi->pvt->lock); return arr; }
int gt_feature_index_add_region_node(GtFeatureIndex *feature_index, GtRegionNode *region_node, GtError *err) { int ret; gt_assert(feature_index && feature_index->c_class && region_node); gt_rwlock_wrlock(feature_index->pvt->lock); ret = feature_index->c_class->add_region_node(feature_index, region_node, err); gt_rwlock_unlock(feature_index->pvt->lock); return ret; }
int gt_feature_index_has_seqid(const GtFeatureIndex *feature_index, bool *has_seqid, const char *seqid, GtError *err) { int ret; gt_assert(feature_index && feature_index->c_class && seqid); gt_rwlock_rdlock(feature_index->pvt->lock); ret = feature_index->c_class->has_seqid(feature_index, has_seqid, seqid, err); gt_rwlock_unlock(feature_index->pvt->lock); return ret; }
int gt_feature_index_get_orig_range_for_seqid(GtFeatureIndex *feature_index, GtRange *range, const char *seqid, GtError *err) { int ret; gt_assert(feature_index && feature_index->c_class && range && seqid); gt_rwlock_rdlock(feature_index->pvt->lock); ret = feature_index->c_class->get_orig_range_for_seqid(feature_index, range, seqid, err); gt_rwlock_unlock(feature_index->pvt->lock); return ret; }
GtHashmap* gt_diagram_get_blocks(GtDiagram *diagram, GtError *err) { GtHashmap *ret; int had_err = 0; gt_assert(diagram); gt_rwlock_wrlock(diagram->lock); had_err = gt_diagram_build((GtDiagram*) diagram, err); if (had_err) ret = NULL; else ret = diagram->blocks; gt_rwlock_unlock(diagram->lock); return ret; }
void gt_diagram_set_track_selector_func(GtDiagram *diagram, GtTrackSelectorFunc bsfunc, void *ptr) { gt_assert(diagram); gt_rwlock_wrlock(diagram->lock); /* register selector function and attached pointer */ diagram->select_func = bsfunc; diagram->ptr = ptr; /* this could change track assignment -> discard current blocks and requeue */ gt_hashmap_delete(diagram->blocks); diagram->blocks = NULL; gt_rwlock_unlock(diagram->lock); }
void gt_layout_delete(GtLayout *layout) { if (!layout) return; gt_rwlock_wrlock(layout->lock); if (layout->twc && layout->own_twc) gt_text_width_calculator_delete(layout->twc); gt_hashmap_delete(layout->tracks); gt_array_delete(layout->custom_tracks); if (layout->blocks) gt_hashmap_delete(layout->blocks); gt_rwlock_unlock(layout->lock); gt_rwlock_delete(layout->lock); gt_free(layout); }
int gt_feature_index_get_features_for_range(GtFeatureIndex *feature_index, GtArray *results, const char *seqid, const GtRange *range, GtError *err) { int ret; gt_assert(feature_index && feature_index->c_class && results && seqid && range); gt_assert(gt_range_length(range) > 0); gt_rwlock_rdlock(feature_index->pvt->lock); ret = feature_index->c_class->get_features_for_range(feature_index, results, seqid, range, err); gt_rwlock_unlock(feature_index->pvt->lock); return ret; }
void gt_diagram_delete(GtDiagram *diagram) { if (!diagram) return; gt_rwlock_wrlock(diagram->lock); gt_array_delete(diagram->features); if (diagram->blocks) gt_hashmap_delete(diagram->blocks); gt_hashmap_delete(diagram->nodeinfo); gt_hashmap_delete(diagram->collapsingtypes); gt_hashmap_delete(diagram->groupedtypes); gt_hashmap_delete(diagram->caption_display_status); gt_array_delete(diagram->custom_tracks); gt_rwlock_unlock(diagram->lock); gt_rwlock_delete(diagram->lock); gt_free(diagram); }