IITree.insert

Insert interval for contig

Note this differs from the other trees in the package in inclusion of "contig" parameter, because underlying cgranges has built-in hashmap and essentially stores multiple trees. Passing a \0-terminated C string contig will be faster than passing a D string or char[], due to the need to call toStringz before calling the C API.

last param "label" of cr_add not used by cgranges as of 2019-05-04

  1. cr_intv_t* insert(S contig, IntervalType* i, bool trackGC, bool GCptr)
    struct IITree(IntervalType)
    insert
    (
    S
    )
    (,
    IntervalType* i
    ,
    bool trackGC = true
    ,
    bool GCptr = true
    )
    if (
    isSomeString!S ||
    is(S : const(char)*)
    )
    if (
    __traits(hasMember, IntervalType, "start") &&
    __traits(hasMember, IntervalType, "end")
    )
  2. cr_intv_t* insert(S contig, IntervalType i, bool trackGC)
  3. cr_intv_t* insert(I i, bool trackGC)
  4. cr_intv_t* insert(const(char)* contig, T start, T end)

Parameters

S

string-like contig name (if absent will pass "default" to cr_add)

i IntervalType*

IntervalType or IntervalType*

trackGC bool

(Default true) add i to the GC scanned ranges. see discussion

GCptr bool

(Default true) when i is IntervalType*, is the pointer to GC-mgd memory?

Non-payload variant: params contig, start, end

Discussion: This container structure may store an IntervalType in one of two ways. First, you can pass a pointer which will be stored directly without additional memory allocations. Note however that if this pointer is to garbage collected memory and no other reference exists in the D code, it could be swept away. Even if it is not to GC memory, if it encapsulates a pointer (e.g., a string ) you can still be bitten. Thus trackGC defaults to true. If unneeded, you might obtain a marginal speedup by setting trackGC = false.

The interval to be contained may also be passed by value. In this case, memory will be allocated with malloc and the pointer will be stored. In this case the same caveats regarding contained GC-pointing objects like D-arrays and strings still apply. For example, passing a struct by value may not necessitate tracking the memory in the GC if it contains only value types, but if the struct contains a D-style array or string, it must be tracked

Finally, there is a variant missing the first contig parameter. Unlike other trees, cgranges requires a string contig parameter, so a default value of "default" will be supplied.

Meta