source: trunk/yat/omic/BamWriteIterator.h @ 2993

Last change on this file since 2993 was 2993, checked in by Peter, 9 years ago

conform GPL header to same style as in other yat files

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.4 KB
Line 
1#ifndef theplu_yat_omic_bam_write_iterator
2#define theplu_yat_omic_bam_write_iterator
3
4// $Id: BamWriteIterator.h 2993 2013-03-03 07:38:22Z peter $
5
6/*
7  Copyright (C) 2012 Peter Johansson
8
9  This file is part of the yat library, http://dev.thep.lu.se/yat
10
11  The yat library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 3 of the
14  License, or (at your option) any later version.
15
16  The yat library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20
21  You should have received a copy of the GNU General Public License
22  along with this program. If not, see <http://www.gnu.org/licenses/>.
23*/
24
25#include <boost/function_output_iterator.hpp>
26
27#include <functional>
28
29namespace theplu {
30namespace yat {
31namespace omic {
32
33  class BamRead;
34  class OutBamFile;
35
36  /**
37     Functor taking a BamRead and writing to an OutBamFile. Class is
38     primarily used by BamWriteIterator.
39
40     \since New in yat 0.10
41   */
42  class BamWriter : std::unary_function<const BamRead&, void>
43  {
44  public:
45    /**
46       \brief Default constructor
47
48       \note Created object cannot write, i.e., behaviour of
49       operator() is undefined.
50    */
51    BamWriter(void);
52
53    /**
54       \brief Constructor
55
56       Creates an object that will write to \a out.
57     */
58    explicit BamWriter(OutBamFile& out);
59
60    /**
61       write bam read \b to OutBamFile specified in constructor.
62     */
63    void operator()(const BamRead& b) const;
64  private:
65    OutBamFile* out_;
66  };
67
68
69  /**
70     \brief Output iterator for bam file.
71
72     A BamWriteIterator is an \output_iterator that writes output to a
73     specific OutBamFile. The writing is performed via
74     \code
75     *iter = bam;
76     \endcode
77     where operator* retunrns a proxy which when assigned writes the
78     right hand side to associated OutBamFile.
79
80     \see OutBamFile and
81     <a href="http://www.sgi.com/tech/stl/ostream_iterator.html">
82     std::ostream_iterator</a>
83
84     \since New in yat 0.10
85   */
86  class BamWriteIterator
87    : public boost::function_output_iterator<BamWriter>
88  {
89  public:
90    /**
91       \brief Default contructor
92
93       result is not dereferencable
94     */
95    BamWriteIterator(void);
96
97    /**
98       Creates an iterator that is associated with \a out.
99     */
100    explicit BamWriteIterator(OutBamFile& out);
101  private:
102  };
103}}}
104#endif
Note: See TracBrowser for help on using the repository browser.