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; }
LIB_EXPORT rc_t CC ReferenceIteratorGetPlacement ( ReferenceIterator *self, const PlacementRecord **rec ) { rc_t rc = 0; if ( self == NULL ) { rc = RC( rcAlign, rcIterator, rcAccessing, rcSelf, rcNull ); } else if ( rec == NULL ) { rc = RC( rcAlign, rcIterator, rcAccessing, rcParam, rcNull ); } else { if ( self->current_spot_group == NULL ) { rc = SILENT_RC( rcAlign, rcIterator, rcAccessing, rcOffset, rcDone ); } else { if ( self->current_rec != NULL ) { /* remove the 'previous' current-rec! */ DLListPopHead ( &self->current_spot_group->records ); PlacementRecordWhack ( self->current_rec ); self->depth--; self->current_rec = NULL; } self->current_rec = ( PlacementRecord * )DLListHead( &self->current_spot_group->records ); if ( self->current_rec == NULL ) { rc = SILENT_RC( rcAlign, rcIterator, rcAccessing, rcOffset, rcDone ); } else { *rec = self->current_rec; } } } return rc; }
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; }