| 1 |
/* BaitFisher (version 1.2.7) a program for designing DNA target enrichment baits |
| 2 |
* Copyright 2013-2016 by Christoph Mayer |
| 3 |
* |
| 4 |
* This source file is part of the BaitFisher-package. |
| 5 |
* |
| 6 |
* This program is free software: you can redistribute it and/or modify |
| 7 |
* it under the terms of the GNU General Public License as published by |
| 8 |
* the Free Software Foundation, either version 3 of the License, or |
| 9 |
* (at your option) any later version. |
| 10 |
* |
| 11 |
* This program is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU General Public License |
| 17 |
* along with BaitFisher. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
* |
| 19 |
* |
| 20 |
* For any enquiries send an Email to Christoph Mayer |
| 21 |
* [email protected] |
| 22 |
* |
| 23 |
* When publishing work that is based on the results please cite: |
| 24 |
* Mayer et al. 2016: BaitFisher: A software package for multi-species target DNA enrichment probe design |
| 25 |
* |
| 26 |
*/ |
| 27 |
#ifndef CTRIPLE_H |
| 28 |
#define CTRIPLE_H |
| 29 |
|
| 30 |
#include <iostream> |
| 31 |
|
| 32 |
//class Ctriple; |
| 33 |
//bool Ctriple::operator<(Ctriple &a, Ctriple &b) |
| 34 |
|
| 35 |
template <typename T1, typename T2, typename T3> |
| 36 |
class Ctriple |
| 37 |
{ |
| 38 |
private: |
| 39 |
T1 t1; |
| 40 |
T2 t2; |
| 41 |
T3 t3; |
| 42 |
|
| 43 |
public: |
| 44 |
Ctriple(const T1 &pt1,const T2 &pt2,const T3 &pt3):t1(pt1),t2(pt2),t3(pt3) |
| 45 |
{} |
| 46 |
|
| 47 |
T1 first() { return t1; } |
| 48 |
T2 second() { return t2; } |
| 49 |
T3 third() { return t3; } |
| 50 |
|
| 51 |
friend bool operator<(const Ctriple<T1, T2, T3> &a, const Ctriple<T1, T2, T3> &b) |
| 52 |
{ |
| 53 |
if (a.t1 != b.t1) |
| 54 |
return a.t1 < b.t1; |
| 55 |
if (a.t2 != b.t2) |
| 56 |
return a.t2 < b.t2; |
| 57 |
return a.t3 < b.t3; |
| 58 |
} |
| 59 |
|
| 60 |
void print(std::ostream &os) const |
| 61 |
{ |
| 62 |
os << "(" << t1 << "," << t2 << "," << t3 << ")"; |
| 63 |
} |
| 64 |
|
| 65 |
}; |
| 66 |
|
| 67 |
|
| 68 |
template <typename T1, typename T2, typename T3> |
| 69 |
inline std::ostream &operator<<(std::ostream &os, const Ctriple<T1, T2, T3> &t) |
| 70 |
{ |
| 71 |
t.print(os); |
| 72 |
return os; |
| 73 |
} |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
#endif |
| 84 |
|
| 85 |
|