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: basic_iterator_base.h,v 1.1 2008/08/25 16:20:01 langmead Exp $
19 ==========================================================================*/
21 #ifndef SEQAN_HEADER_BASIC_ITERATOR_BASE_H
22 #define SEQAN_HEADER_BASIC_ITERATOR_BASE_H
24 namespace SEQAN_NAMESPACE_MAIN
26 //////////////////////////////////////////////////////////////////////////////
28 //////////////////////////////////////////////////////////////////////////////
32 ..summary:Iterator that is used to traverse containers.
33 ..signature:Iter<TContainer, TSpec>
34 ..param.TContainer:Type of the container that can be iterated by $Iter$.
35 ...metafunction:Metafunction.Container
36 ..param.TSpec:The specializing type.
37 ...metafunction:Metafunction.Spec
38 ..implements:Concept.Iterator
40 template <typename TContainer, typename TSpec>
43 //////////////////////////////////////////////////////////////////////////////
44 ///.Metafunction.Spec.param.T.type:Class.Iter
46 template <typename TContainer, typename TSpec>
47 struct Spec<Iter<TContainer, TSpec> >
51 template <typename TContainer, typename TSpec>
52 struct Spec<Iter<TContainer, TSpec> const>
57 //////////////////////////////////////////////////////////////////////////////
59 ///.Metafunction.Value.param.T.type:Class.Iter
61 template <typename TContainer, typename TSpec>
62 struct Value<Iter<TContainer, TSpec> >:
66 template <typename TContainer, typename TSpec>
67 struct Value<Iter<TContainer, TSpec> const>:
72 //////////////////////////////////////////////////////////////////////////////
74 ///.Metafunction.GetValue.param.T.type:Class.Iter
76 template <typename TContainer, typename TSpec>
77 struct GetValue<Iter<TContainer, TSpec> >:
81 template <typename TContainer, typename TSpec>
82 struct GetValue<Iter<TContainer, TSpec> const>:
87 //////////////////////////////////////////////////////////////////////////////
89 ///.Metafunction.Reference.param.T.type:Class.Iter
91 template <typename TContainer, typename TSpec>
92 struct Reference<Iter<TContainer, TSpec> >:
96 template <typename TContainer, typename TSpec>
97 struct Reference<Iter<TContainer, TSpec> const>:
102 //////////////////////////////////////////////////////////////////////////////
104 ///.Metafunction.Container.param.T.type:Class.Iter
106 template <typename T> struct Container;
108 template <typename TContainer, typename TSpec>
109 struct Container<Iter<TContainer, TSpec> >
111 typedef TContainer Type;
113 template <typename TContainer, typename TSpec>
114 struct Container<Iter<TContainer, TSpec> const>
116 typedef TContainer Type;
119 //////////////////////////////////////////////////////////////////////////////
122 ///.Metafunction.Host.param.T.type:Class.Iter
124 template <typename TContainer, typename TSpec>
125 struct Host<Iter<TContainer, TSpec> >:
126 Container<Iter<TContainer, TSpec> >
129 template <typename TContainer, typename TSpec>
130 struct Host<Iter<TContainer, TSpec> const>:
131 Container<Iter<TContainer, TSpec> const>
136 //////////////////////////////////////////////////////////////////////////////
138 //////////////////////////////////////////////////////////////////////////////
140 template <typename TContainer, typename TSpec>
141 inline typename Reference<Iter<TContainer, TSpec> >::Type
142 operator * (Iter<TContainer, TSpec> & me)
147 template <typename TContainer, typename TSpec>
148 inline typename Reference<Iter<TContainer, TSpec> const>::Type
149 operator * (Iter<TContainer, TSpec> const & me)
155 //////////////////////////////////////////////////////////////////////////////
157 //////////////////////////////////////////////////////////////////////////////
159 template <typename TContainer, typename TSpec>
160 inline Iter<TContainer, TSpec> const &
161 operator ++ (Iter<TContainer, TSpec> & me)
168 template <typename TContainer, typename TSpec>
169 inline Iter<TContainer, TSpec> const
170 operator ++ (Iter<TContainer, TSpec> & me, int)
173 Iter<TContainer, TSpec> temp_(me);
178 //////////////////////////////////////////////////////////////////////////////
180 //////////////////////////////////////////////////////////////////////////////
182 template <typename TContainer, typename TSpec>
183 inline Iter<TContainer, TSpec> const &
184 operator -- (Iter<TContainer, TSpec> & me)
191 template <typename TContainer, typename TSpec>
192 inline Iter<TContainer, TSpec> const
193 operator -- (Iter<TContainer, TSpec> & me, int)
196 Iter<TContainer, TSpec> temp_(me);
201 //////////////////////////////////////////////////////////////////////////////
203 //////////////////////////////////////////////////////////////////////////////
205 //most Iter classes are rooted strings
207 template <typename TContainer, typename TSpec, typename TContainer2>
208 inline typename Position<Iter<TContainer, TSpec> const>::Type
209 position(Iter<TContainer, TSpec> const & me,
217 //////////////////////////////////////////////////////////////////////////////
219 } //namespace SEQAN_NAMESPACE_MAIN
221 #endif //#ifndef SEQAN_HEADER_...