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

Last change on this file since 2884 was 2884, checked in by Peter, 10 years ago

add missing since tags. refs #729

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