Beispiel #1
0
LIB_EXPORT rc_t CC PlacementSetIteratorNextWindow ( PlacementSetIterator *self,
        INSDC_coord_zero *first_pos, INSDC_coord_len *len )
{
    rc_t rc = 0;
    if ( first_pos != NULL ) {
        *first_pos = 0;
    }
    if ( len != NULL ) {
        *len = 0;
    }

    if ( self == NULL )
        return RC( rcAlign, rcIterator, rcReleasing, rcSelf, rcNull );

    self->current_entry = NULL;     /* what is the current pi-entry, we are handling ? */

    if ( self->current_ref == NULL )
    {
        return SILENT_RC( rcAlign, rcIterator, rcAccessing, rcOffset, rcDone );
    }

    pl_set_iter_clear_curr_ref_window( self );

    /* !!! here we are taking the next window from the top of the list */
    self->current_window = ( pi_window * )DLListPopHead ( &(self->current_ref->pi_windows) );

    /* check if we have reached the last window on this reference... */
    if ( self->current_window == NULL )
    {
        return SILENT_RC( rcAlign, rcIterator, rcAccessing, rcOffset, rcDone );
    }

    /* point to the first entry in this window... */
    self->current_entry = ( pi_entry * )DLListHead( &(self->current_window->pi_entries) );

    /* if the caller wants to know first_pos / len */
    if ( first_pos != NULL )
    {
        *first_pos = self->current_window->w.first;
    }
    if ( len != NULL )
    {
        *len = self->current_window->w.len;
    }

    return rc;
}
Beispiel #2
0
LIB_EXPORT rc_t CC PlacementSetIteratorNextReference ( PlacementSetIterator *self,
        INSDC_coord_zero *first_pos, INSDC_coord_len *len, struct ReferenceObj const ** refobj )
{
    rc_t rc = 0;
    if ( refobj != NULL ) {
        *refobj = NULL;
    }

    if ( self == NULL )
        return RC( rcAlign, rcIterator, rcReleasing, rcSelf, rcNull );

    pl_set_iter_clear_curr_ref_window( self );
    pl_set_iter_clear_curr_ref( self );
    self->current_entry = NULL;     /* what is the current pi-entry, we are handling ? */

    /* !!! here we are taking the next reference from the top of the list */
    self->current_ref = ( pi_ref * )DLListPopHead ( &self->pi_refs );

    if ( self->current_ref == NULL )
    {
        return SILENT_RC( rcAlign, rcIterator, rcAccessing, rcOffset, rcDone );
    }

    if ( first_pos != NULL ) *first_pos = self->current_ref->outer.first;
    if ( len != NULL) *len = self->current_ref->outer.len;

    /* if the caller wants to know the ref-obj... */
    if ( refobj != NULL )
    {
        pi_window *pw = ( pi_window * )DLListHead( &(self->current_ref->pi_windows) );
        if ( pw != NULL )
        {
            pi_entry * pie = ( pi_entry * )DLListHead( &(pw->pi_entries) );
            if ( pie != NULL )
            {
                rc = PlacementIteratorRefObj( pie->pi, refobj );
            }
        }
    }
    return rc;
}
Beispiel #3
0
LIB_EXPORT rc_t CC PlacementSetIteratorRelease ( const PlacementSetIterator *cself )
{
    rc_t rc = 0;
    if ( cself == NULL )
        rc = RC( rcAlign, rcIterator, rcReleasing, rcSelf, rcNull );
    else
    {
        if ( KRefcountDrop( &cself->refcount, "PlacementSetIterator" ) == krefWhack )
        {
            PlacementSetIterator * self = ( PlacementSetIterator * ) cself;

            pl_set_iter_clear_curr_ref_window( self );
            pl_set_iter_clear_curr_ref( self );

            /* release the DLList of pi-ref's and the pi's in it... */
            DLListWhack ( &self->pi_refs, pi_ref_whacker, NULL );

            AlignMgrRelease ( self->amgr );

            free( self );
        }
    }
    return rc;
}