c++/EEDB/ZDX/ZDXsegment.cpp
//re-initializes this segment to the contents of the next segment in order after this one
re-initializes this segment to the contents of the next segment in order after this one
re - initializes this segment to the contents of the next segment in order after this one
bool EEDB::ZDX::ZDXsegment::init_next_segment() {
  if(_zchrom==NULL) { return false; }
  if(_zchrom->segments_offset == 0) { _zchrom = NULL; return false; }
  if(_segment_offset == -1) { _zchrom = NULL; return false; }
  if(_zsegment.chrom_end >= _zchrom->chrom_length) { _zchrom = NULL; return false; }
  if(!_zdxdb) { return false; }  
  int zdxfd = _zdxdb->connect(ZDXREAD);
  if(zdxfd == -1) { return false; }
  _segment_offset += sizeof(zdx_chrom_segment);
  lseek(zdxfd, _segment_offset, SEEK_SET);
  if(read(zdxfd, &_zsegment, sizeof(zdx_chrom_segment)) != (unsigned)sizeof(zdx_chrom_segment)) {
    fprintf(stderr, "zdxsegement error reading  segment\n");
    _segment_offset = -1;
    _zchrom = NULL;
    return false;
  }
  return true;
}
bool EEDB :: ZDX :: ZDXsegment :: init_next_segment ( ) { if ( _zchrom == NULL ) { return false ; } if ( _zchrom -> segments_offset == 0 ) { _zchrom = NULL ; return false ; } if ( _segment_offset == -1 ) { _zchrom = NULL ; return false ; } if ( _zsegment . chrom_end >= _zchrom -> chrom_length ) { _zchrom = NULL ; return false ; } if ( ! _zdxdb ) { return false ; } int zdxfd = _zdxdb -> connect ( ZDXREAD ) ; if ( zdxfd == -1 ) { return false ; } _segment_offset += sizeof ( zdx_chrom_segment ) ; lseek ( zdxfd , _segment_offset , SEEK_SET ) ; if ( read ( zdxfd , & _zsegment , sizeof ( zdx_chrom_segment ) ) != ( unsigned ) sizeof ( zdx_chrom_segment ) ) { fprintf ( stderr , " \n " ) ; _segment_offset = -1 ; _zchrom = NULL ; return false ; } return true ; }
re-initializes this segment to the contents of the next segment in order after this one
re - initializes this segment to the contents of the next segment in order after this one