1 // ========================================================================== 2 // SeqAn - The Library for Sequence Analysis 3 // ========================================================================== 4 // Copyright (c) 2006-2010, 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_HEADER_INDEX_PUMP_SEPARATOR_H 36 #define SEQAN_HEADER_INDEX_PUMP_SEPARATOR_H 37 38 namespace SEQAN_NAMESPACE_MAIN 39 { 40 41 42 template < 43 typename TInput, typename TFunctor, 44 typename TOut1, typename TOut2, typename TOut4 45 > _skew7SeparateSlices(TInput & in,TFunctor const & funcSlice,TOut1 & out1,TOut2 & out2,TOut4 & out4)46 static void _skew7SeparateSlices( 47 TInput &in, TFunctor const &funcSlice, 48 TOut1 &out1, TOut2 &out2, TOut4 &out4) 49 { 50 beginRead(in); 51 52 resize(out1, funcSlice.n1); 53 resize(out2, funcSlice.n2); 54 resize(out4, funcSlice.n4); 55 56 beginWrite(out1); 57 beginWrite(out2); 58 beginWrite(out4); 59 60 typename Value<TInput>::Type i; 61 while (!eof(in)) { 62 pop(in, i); 63 if (i.i1 < funcSlice.n4) { 64 push(out4, i); 65 } else 66 if (i.i1 < funcSlice.n24) { 67 i.i1 -= funcSlice.n4; 68 push(out2, i); 69 } else { 70 i.i1 -= funcSlice.n24; 71 push(out1, i); 72 } 73 } 74 75 endWrite(out4); 76 endWrite(out2); 77 endWrite(out1); 78 endRead(in); 79 } 80 81 //} 82 83 } 84 85 #endif 86