GtNodeStream* agn_filter_stream_new(GtNodeStream *in_stream, GtHashmap *typestokeep) { GtNodeStream *ns; AgnFilterStream *stream; gt_assert(in_stream && typestokeep); ns = gt_node_stream_create(filter_stream_class(), false); stream = filter_stream_cast(ns); stream->in_stream = gt_node_stream_ref(in_stream); stream->cache = gt_queue_new(); stream->typestokeep = gt_hashmap_ref(typestokeep); return ns; }
GtLayout* gt_layout_new_with_twc(GtDiagram *diagram, unsigned int width, GtStyle *style, GtTextWidthCalculator *twc, GtError *err) { GtLayout *layout; GtHashmap *blocks; gt_assert(diagram); gt_assert(style); gt_assert(twc); gt_assert(err); if (check_width(width, style, err) < 0) return NULL; layout = gt_calloc(1, sizeof (GtLayout)); layout->twc = twc; layout->style = style; layout->width = width; layout->blocks = NULL; layout->viewrange = gt_diagram_get_range(diagram); layout->nof_tracks = 0; layout->track_ordering_func = NULL; layout->block_ordering_func = gt_block_compare; layout->t_cmp_data = NULL; layout->b_cmp_data = NULL; layout->lock = gt_rwlock_new(); layout->own_twc = false; layout->layout_done = false; layout->custom_tracks = gt_array_ref(gt_diagram_get_custom_tracks(diagram)); /* XXX: use other container type here! */ layout->tracks = gt_hashmap_new(GT_HASH_STRING, gt_free_func, (GtFree) gt_track_delete); blocks = gt_diagram_get_blocks(diagram, err); if (!blocks) { gt_array_delete(layout->custom_tracks); gt_hashmap_delete(layout->tracks); gt_free(layout); return NULL; } else layout->blocks = gt_hashmap_ref(blocks); return layout; }