/*
  Copyright (c) 2010 Stefan Kurtz <kurtz@zbh.uni-hamburg.de>
  Copyright (c) 2010 Dirk Willrodt <willrodt@zbh.uni-hamburg.de>
  Copyright (c) 2010 Center for Bioinformatics, University of Hamburg

  Permission to use, copy, modify, and distribute this software for any
  purpose with or without fee is hereby granted, provided that the above
  copyright notice and this permission notice appear in all copies.

  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#ifndef ESA_SHULEN_H
#define ESA_SHULEN_H

#include "core/encseq_api.h"
#include "core/error_api.h"
#include "core/str_array.h"
#include "match/esa-seqread.h"
#include "match/shu_unitfile.h"
#include "match/genomediff_opt.h"

typedef struct GtBUstate_shulen GtBUstate_shulen;

int gt_multiesa2shulengthdist_print(Sequentialsuffixarrayreader *ssar,
                                    const GtEncseq *encseq,
                                    GtError *err);

int gt_esa2shulengthqueryfiles(GtUword *totalgmatchlength,
                               const Suffixarray *suffixarray,
                               const GtStrArray *queryfilenames,
                               GtError *err);

int gt_multiesa2shulengthdist(Sequentialsuffixarrayreader *ssar,
                              const GtEncseq *encseq,
                              uint64_t **shulen,
                              const GtShuUnitFileInfo *unit_info,
                              GtError *err);

GtBUstate_shulen *gt_sfx_multiesashulengthdist_new(const GtEncseq *encseq,
                                                   GenomediffInfo *gd_info);

int gt_sfx_multiesa2shulengthdist(GtBUstate_shulen *bustate,
                                  const GtUword *bucketofsuffixes,
                                  const uint32_t *bucketofsuffixes_uint32,
                                  const GtLcpvaluetype *lcptab_bucket,
                                  GtUword numberofsuffixes,
                                  GtError *err);

int gt_sfx_multiesa2shulengthdist_last(GtBUstate_shulen *bustate,
                                       GtError *err);

void gt_sfx_multiesashulengthdist_delete(GtBUstate_shulen *bustate,
                                         GenomediffInfo *gd_info);

#endif
