Concordia
concordia_searcher.hpp
1 #ifndef ANUBIS_SEARCHER_HDR
2 #define ANUBIS_SEARCHER_HDR
3 
4 #include <boost/shared_ptr.hpp>
5 
6 #include "concordia/common/config.hpp"
7 #include "concordia/common/utils.hpp"
8 #include "concordia/substring_occurence.hpp"
9 #include "concordia/concordia_exception.hpp"
10 #include "concordia/concordia_config.hpp"
11 #include "concordia/concordia_search_result.hpp"
12 #include "concordia/anubis_search_result.hpp"
13 #include "concordia/tm_matches.hpp"
14 
15 #include <vector>
16 #include <divsufsort.h>
17 
25 public:
26  explicit ConcordiaSearcher();
27 
30  virtual ~ConcordiaSearcher();
31 
44  void concordiaSearch(
45  boost::shared_ptr<ConcordiaSearchResult> result,
46  boost::shared_ptr<std::vector<sauchar_t> > T,
47  boost::shared_ptr<std::vector<SUFFIX_MARKER_TYPE> > markers,
48  boost::shared_ptr<std::vector<saidx_t> > SA,
49  const std::vector<INDEX_CHARACTER_TYPE> & pattern)
50  throw(ConcordiaException);
51 
66  std::vector<AnubisSearchResult> anubisSearch(
67  boost::shared_ptr<ConcordiaConfig> config,
68  boost::shared_ptr<std::vector<sauchar_t> > T,
69  boost::shared_ptr<std::vector<SUFFIX_MARKER_TYPE> > markers,
70  boost::shared_ptr<std::vector<saidx_t> > SA,
71  const std::vector<INDEX_CHARACTER_TYPE> & pattern)
72  throw(ConcordiaException);
73 
85  boost::shared_ptr<TmMatchesMap> getTmMatches(
86  boost::shared_ptr<std::vector<sauchar_t> > T,
87  boost::shared_ptr<std::vector<SUFFIX_MARKER_TYPE> > markers,
88  boost::shared_ptr<std::vector<saidx_t> > SA,
89  const std::vector<INDEX_CHARACTER_TYPE> & pattern)
90  throw(ConcordiaException);
91 
107  std::vector<SubstringOccurence> lcpSearch(
108  boost::shared_ptr<std::vector<sauchar_t> > T,
109  boost::shared_ptr<std::vector<SUFFIX_MARKER_TYPE> > markers,
110  boost::shared_ptr<std::vector<saidx_t> > SA,
111  const std::vector<sauchar_t> & pattern,
112  SUFFIX_MARKER_TYPE & length) throw(ConcordiaException);
113 
114 private:
115  void _collectResults(std::vector<SubstringOccurence> & result,
116  boost::shared_ptr<std::vector<SUFFIX_MARKER_TYPE> > markers,
117  boost::shared_ptr<std::vector<saidx_t> > SA,
118  saidx_t left, saidx_t size);
119 
120  void _addToMap(boost::shared_ptr<std::vector<saidx_t> > SA,
121  boost::shared_ptr<std::vector<SUFFIX_MARKER_TYPE> > markers,
122  boost::shared_ptr<TmMatchesMap> tmMatchesMap,
123  saidx_t sa_pos,
124  SUFFIX_MARKER_TYPE totalPatternLength,
125  SUFFIX_MARKER_TYPE matchedFragmentLength,
126  SUFFIX_MARKER_TYPE patternOffset);
127 
128  bool _getOccurenceFromSA(boost::shared_ptr<std::vector<saidx_t> > SA,
129  boost::shared_ptr<std::vector<SUFFIX_MARKER_TYPE> > markers,
130  saidx_t sa_pos,
131  SubstringOccurence & occurence);
132 
133  void _addOccurenceToMap(boost::shared_ptr<TmMatchesMap> tmMatchesMap,
134  SubstringOccurence & occurence,
135  SUFFIX_MARKER_TYPE totalPatternLength,
136  SUFFIX_MARKER_TYPE matchedFragmentLength,
137  SUFFIX_MARKER_TYPE patternOffset);
138 };
139 
140 #endif
Definition: concordia_searcher.hpp:24
virtual ~ConcordiaSearcher()
Definition: concordia_searcher.cpp:11
Definition: concordia_exception.hpp:11
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, const std::vector< INDEX_CHARACTER_TYPE > &pattern)
Definition: concordia_searcher.cpp:88
void concordiaSearch(boost::shared_ptr< ConcordiaSearchResult > result, 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, const std::vector< INDEX_CHARACTER_TYPE > &pattern)
Definition: concordia_searcher.cpp:14
Definition: substring_occurence.hpp:16
std::vector< SubstringOccurence > lcpSearch(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, const std::vector< sauchar_t > &pattern, SUFFIX_MARKER_TYPE &length)
Definition: concordia_searcher.cpp:161
std::vector< AnubisSearchResult > anubisSearch(boost::shared_ptr< ConcordiaConfig > config, 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, const std::vector< INDEX_CHARACTER_TYPE > &pattern)
Definition: concordia_searcher.cpp:56