2014-05-14 16:29:44 +02:00
|
|
|
#ifndef ANUBIS_SEARCHER_HDR
|
|
|
|
#define ANUBIS_SEARCHER_HDR
|
|
|
|
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
|
|
|
#include "concordia/common/config.hpp"
|
2014-05-15 22:20:31 +02:00
|
|
|
#include "concordia/common/utils.hpp"
|
2014-05-14 16:29:44 +02:00
|
|
|
#include "concordia/substring_occurence.hpp"
|
|
|
|
#include "concordia/concordia_exception.hpp"
|
|
|
|
#include "concordia/anubis_search_result.hpp"
|
2015-04-14 20:14:30 +02:00
|
|
|
#include "concordia/tm_matches.hpp"
|
2014-05-14 16:29:44 +02:00
|
|
|
|
|
|
|
#include <divsufsort.h>
|
|
|
|
|
|
|
|
/*!
|
|
|
|
Class for searching using Anubis algorithm.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
class AnubisSearcher {
|
|
|
|
public:
|
|
|
|
explicit AnubisSearcher();
|
|
|
|
|
|
|
|
/*! Destructor.
|
|
|
|
*/
|
|
|
|
virtual ~AnubisSearcher();
|
|
|
|
|
2015-04-15 10:55:26 +02:00
|
|
|
std::vector<AnubisSearchResult> anubisSearch(
|
2014-05-15 22:20:31 +02:00
|
|
|
boost::shared_ptr<std::vector<sauchar_t> > T,
|
|
|
|
boost::shared_ptr<std::vector<SUFFIX_MARKER_TYPE> > markers,
|
|
|
|
boost::shared_ptr<std::vector<saidx_t> > SA,
|
2015-04-15 10:55:26 +02:00
|
|
|
const std::vector<INDEX_CHARACTER_TYPE> & pattern)
|
2014-05-15 22:20:31 +02:00
|
|
|
throw(ConcordiaException);
|
|
|
|
|
2015-04-14 20:14:30 +02:00
|
|
|
boost::shared_ptr<TmMatchesMap> getTmMatches(
|
|
|
|
boost::shared_ptr<std::vector<sauchar_t> > T,
|
|
|
|
boost::shared_ptr<std::vector<SUFFIX_MARKER_TYPE> > markers,
|
|
|
|
boost::shared_ptr<std::vector<saidx_t> > SA,
|
2015-04-15 10:55:26 +02:00
|
|
|
const std::vector<INDEX_CHARACTER_TYPE> & pattern)
|
2015-04-14 20:14:30 +02:00
|
|
|
throw(ConcordiaException);
|
|
|
|
|
2015-04-15 10:55:26 +02:00
|
|
|
std::vector<SubstringOccurence> lcpSearch(
|
2014-05-14 16:29:44 +02:00
|
|
|
boost::shared_ptr<std::vector<sauchar_t> > T,
|
|
|
|
boost::shared_ptr<std::vector<SUFFIX_MARKER_TYPE> > markers,
|
|
|
|
boost::shared_ptr<std::vector<saidx_t> > SA,
|
2015-04-15 10:55:26 +02:00
|
|
|
const std::vector<sauchar_t> & pattern,
|
2014-05-15 22:20:31 +02:00
|
|
|
SUFFIX_MARKER_TYPE & length) throw(ConcordiaException);
|
|
|
|
|
2014-05-14 16:29:44 +02:00
|
|
|
private:
|
2015-04-15 10:55:26 +02:00
|
|
|
void _collectResults(vector<SubstringOccurence> & result,
|
2014-05-15 22:20:31 +02:00
|
|
|
boost::shared_ptr<std::vector<SUFFIX_MARKER_TYPE> > markers,
|
|
|
|
boost::shared_ptr<std::vector<saidx_t> > SA,
|
|
|
|
saidx_t left, saidx_t size);
|
2015-04-14 20:14:30 +02:00
|
|
|
|
|
|
|
void _addToMap(boost::shared_ptr<std::vector<saidx_t> > SA,
|
|
|
|
boost::shared_ptr<std::vector<SUFFIX_MARKER_TYPE> > markers,
|
|
|
|
boost::shared_ptr<TmMatchesMap> tmMatchesMap,
|
|
|
|
saidx_t sa_pos,
|
|
|
|
SUFFIX_MARKER_TYPE totalPatternLength,
|
|
|
|
SUFFIX_MARKER_TYPE matchedFragmentLength,
|
|
|
|
SUFFIX_MARKER_TYPE patternOffset);
|
|
|
|
|
|
|
|
bool _getOccurenceFromSA(boost::shared_ptr<std::vector<saidx_t> > SA,
|
|
|
|
boost::shared_ptr<std::vector<SUFFIX_MARKER_TYPE> > markers,
|
|
|
|
saidx_t sa_pos,
|
|
|
|
SubstringOccurence & occurence);
|
|
|
|
|
|
|
|
void _addOccurenceToMap(boost::shared_ptr<TmMatchesMap> tmMatchesMap,
|
|
|
|
SubstringOccurence & occurence,
|
|
|
|
SUFFIX_MARKER_TYPE totalPatternLength,
|
|
|
|
SUFFIX_MARKER_TYPE matchedFragmentLength,
|
|
|
|
SUFFIX_MARKER_TYPE patternOffset);
|
2014-05-14 16:29:44 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|