1 /*==========================================================================
2 SeqAn - The Library for Sequence Analysis
4 ============================================================================
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 3 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 ============================================================================
18 $Id: find_multi.h,v 1.1 2008/08/25 16:20:06 langmead Exp $
19 ==========================================================================*/
21 #ifndef SEQAN_HEADER_FIND_MULTI_H
22 #define SEQAN_HEADER_FIND_MULTI_H
24 namespace SEQAN_NAMESPACE_MAIN
27 //////////////////////////////////////////////////////////////////////////////
29 struct _MultipatternFinder;
30 typedef Tag<_MultipatternFinder> MultipatternFinder;
32 //____________________________________________________________________________
34 template <typename THaystack>
35 class Finder<THaystack, MultipatternFinder>
37 //____________________________________________________________________________
39 unsigned int data_pattern;
48 Finder(Finder const & other_):
49 data_pattern(other_.data_pattern)
58 //____________________________________________________________________________
61 operator = (Finder const & other_)
64 data_pattern = other_.data_pattern;
67 //____________________________________________________________________________
69 friend inline unsigned int &
73 return me.data_pattern;
75 friend inline unsigned int const &
76 needle(Finder const & me)
79 return me.data_pattern;
81 //____________________________________________________________________________
84 setNeedle(Finder & me, unsigned int const needleIndex_)
87 me.data_pattern = needleIndex_;
90 //____________________________________________________________________________
98 //____________________________________________________________________________
101 //////////////////////////////////////////////////////////////////////////////
103 template <typename THaystack, typename TNeedle>
110 while ( needle(me) < length(ndl) )
112 Finder<THaystack, Horspool> horspool(ndl[needle(me)]);
113 bool found = find(horspool, hstk, ndl[needle(me)]);
118 setPosition(hstk, 0);
124 //////////////////////////////////////////////////////////////////////////////
126 template <typename THaystack, typename TNeedle>
128 findNext(Finder & me,
134 return find(me, hstk, ndl);
137 //////////////////////////////////////////////////////////////////////////////
141 }// namespace SEQAN_NAMESPACE_MAIN
143 #endif //#ifndef SEQAN_HEADER_...