source: trunk/yat/omic/BamPair.h @ 3792

Last change on this file since 3792 was 3792, checked in by Peter, 3 years ago

update copyright years

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.6 KB
Line 
1#ifndef theplu_yat_omic_bam_pair
2#define theplu_yat_omic_bam_pair
3
4// $Id: BamPair.h 3792 2019-04-12 07:15:09Z peter $
5
6/*
7  Copyright (C) 2014, 2018 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 yat. If not, see <http://www.gnu.org/licenses/>.
23*/
24
25#include "BamRead.h"
26
27namespace theplu {
28namespace yat {
29namespace omic {
30
31  /**
32     \since New in yat 0.12
33   */
34  class BamPair
35  {
36  public:
37    /**
38       \brief default constructor
39
40       Creating a pair using default constructor of BamRead.
41     */
42    BamPair(void);
43
44    /**
45       \brief Copy constructor
46     */
47    BamPair(const BamRead& first, const BamRead& second);
48
49    /**
50       \brief access first BamRead
51    */
52    BamRead& first(void);
53
54    /**
55       \brief access first BamRead
56    */
57    const BamRead& first(void) const;
58
59    /**
60       \brief access second BamRead
61    */
62    BamRead& second(void);
63
64    /**
65       \brief access second BamRead
66    */
67    const BamRead& second(void) const;
68
69  private:
70    BamRead first_;
71    BamRead second_;
72  };
73
74
75  /**
76     A proxy class that behaves like a const BamPair&.
77
78     The class is used in BamPairIterator. The class allows to create
79     an object that looks like a const reference of BamPair from two
80     BamRead pointers without copying the BamRead objects. As the
81     class is aimed at looking like a const BamPair&, implicit
82     conversion to BamPair is allowed to mimic: BamPair = const BamPair&.
83   */
84  class BamPairProxy
85  {
86  public:
87    /**
88       \brief Default constructor
89    */
90    BamPairProxy(void);
91
92    /**
93       Create a proxy from \a first and \a second.
94
95       \note if the objects pointed to by \a first and \a second goes
96       out of scope, this class becomes invalid and behaviour is
97       undefined.
98     */
99    BamPairProxy(const BamRead* first, const BamRead* second);
100
101    /**
102       \return const reference to first BamRead
103     */
104    const BamRead& first(void) const;
105
106    /**
107       \return const reference to second BamRead
108    */
109    const BamRead& second(void) const;
110
111    /**
112       Implicit conversion from BamPairProxy to BamPair.
113     */
114    operator BamPair() const;
115  private:
116    const BamRead* first_;
117    const BamRead* second_;
118  };
119
120}}}
121#endif
Note: See TracBrowser for help on using the repository browser.