1 // ==========================================================================
2 // SeqAn - The Library for Sequence Analysis
3 // ==========================================================================
4 // Copyright (c) 2006-2018, Knut Reinert, FU Berlin
5 // All rights reserved.
6 //
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions are met:
9 //
10 // * Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 // * Redistributions in binary form must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in the
14 // documentation and/or other materials provided with the distribution.
15 // * Neither the name of Knut Reinert or the FU Berlin nor the names of
16 // its contributors may be used to endorse or promote products derived
17 // from this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 // ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE
23 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
29 // DAMAGE.
30 //
31 // ==========================================================================
32 // Author: David Weese <david.weese@fu-berlin.de>
33 // ==========================================================================
34
35 #ifndef SEQAN_INCLUDE_SEQAN_BASIC_BASIC_CHUNKING_H_
36 #define SEQAN_INCLUDE_SEQAN_BASIC_BASIC_CHUNKING_H_
37
38 namespace seqan {
39
40 // ============================================================================
41 // Tags
42 // ============================================================================
43
44 // --------------------------------------------------------------------------
45 // Direction Tags
46 // --------------------------------------------------------------------------
47
48 /*!
49 * @defgroup DirectionTags Direction Tags
50 * @brief Tags for selecting a direction.
51 */
52
53 /*!
54 * @tag DirectionTags#Input
55 * @headerfile <seqan/basic.h>
56 * @brief Tag for selecting the input direction.
57 *
58 * @signature typedef Tag<Input_> Input;
59 */
60
61 struct Input_;
62 typedef Tag<Input_> Input;
63
64 /*!
65 * @tag DirectionTags#Output
66 * @headerfile <seqan/basic.h>
67 * @brief Tag for selecting the output direction.
68 *
69 * @signature typedef Tag<Output_> Output;
70 */
71
72 struct Output_;
73 typedef Tag<Output_> Output;
74
75 /*!
76 * @tag DirectionTags#Bidirectional
77 * @headerfile <seqan/basic.h>
78 * @brief Tag for allowing both input and output.
79 *
80 * @signature typedef Tag<Bidirectional_> Bidirectional;
81 */
82
83 struct Bidirectional_;
84 typedef Tag<Bidirectional_> Bidirectional;
85
86 // ============================================================================
87 // Metafunctions
88 // ============================================================================
89
90 // --------------------------------------------------------------------------
91 // Metafunction Chunk
92 // --------------------------------------------------------------------------
93
94 /*!
95 * @mfn Chunk
96 * @headerfile <seqan/basic.h>
97 * @brief Return the chunk type for an object.
98 *
99 * @signature Chunk<TObject>::Type;
100 *
101 * @tparam TObject The object to query for its chunk type.
102 * @return Type The chunk type of <tt>TObject</tt>.
103 *
104 * The default result type (if not overloaded) is @link Nothing @endlink.
105 */
106
107 // Chunking is only supported for selected objects
108 template <typename TObject>
109 struct Chunk
110 {
111 typedef Nothing Type; // disabled by default
112 };
113
114 // ============================================================================
115 // Functions
116 // ============================================================================
117
118 // ----------------------------------------------------------------------------
119 // Function reserveChunk()
120 // ----------------------------------------------------------------------------
121
122 template <typename TIterator, typename TSize, typename TDirection>
reserveChunk(TIterator &,TSize,TDirection)123 inline void reserveChunk(TIterator &, TSize, TDirection)
124 {}
125
126 // ----------------------------------------------------------------------------
127 // Function getChunk()
128 // ----------------------------------------------------------------------------
129
130 template <typename TChunk, typename TIterator, typename TDirection>
getChunk(TChunk &,TIterator &,TDirection)131 inline Nothing getChunk(TChunk &, TIterator &, TDirection)
132 {
133 return Nothing();
134 }
135
136 // ----------------------------------------------------------------------------
137 // Function advanceChunk()
138 // ----------------------------------------------------------------------------
139
140 template <typename TIterator, typename TSize>
advanceChunk(TIterator & iter,TSize size)141 inline void advanceChunk(TIterator &iter, TSize size)
142 {
143 iter += size;
144 }
145
146 } // namespace seqan
147
148 #endif // #ifndef SEQAN_INCLUDE_SEQAN_BASIC_BASIC_CHUNKING_H_
149