Victor
 All Data Structures Functions Variables Friends Pages
Ss2Input.h
1 /* This file is part of Victor.
2 
3  Victor is free software: you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation, either version 3 of the License, or
6  (at your option) any later version.
7 
8  Victor is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with Victor. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 
18 #ifndef __Ss2Input_H__
19 #define __Ss2Input_H__
20 
21 #include <IoTools.h>
22 #include <Substitution.h>
23 #include <iostream>
24 #include <string>
25 #include <vector>
26 
27 namespace Victor { namespace Align2{
28 
34  class Ss2Input {
35  public:
36 
37  // CONSTRUCTORS:
38 
40  Ss2Input();
41 
43  Ss2Input(istream &is);
44 
46  Ss2Input(const Ss2Input &orig);
47 
49  virtual ~Ss2Input();
50 
51 
52  // OPERATORS:
53 
55  Ss2Input& operator =(const Ss2Input &orig);
56 
58  friend ostream& operator <<(ostream &os, const Ss2Input &object);
59 
61  friend istream& operator >>(istream &is, Ss2Input &object);
62 
63 
64  // PREDICATES:
65 
67  double score(int i, int j);
68 
70  virtual unsigned int size() const;
71 
72 
73  // MODIFIERS:
74 
76  virtual void copy(const Ss2Input& orig);
77 
79  virtual Ss2Input* newCopy();
80 
81 
82  // HELPERS:
83 
85  template<class T> static void pWriteDoubleVector(ostream &os,
86  vector< vector<T> > data);
87 
89  template<class T> static void pReadDoubleVector(istream &is,
90  vector< vector<T> > &data);
91 
92 
93  protected:
94 
95 
96  private:
97 
98  // ATTRIBUTES:
99 
100  vector< vector<double> > residuescores;
101 
102  };
103 
104  // -----------------------------------------------------------------------------
105  // Ss2Input
106  // -----------------------------------------------------------------------------
107 
108  // PREDICATES:
109 
110  inline double
111  Ss2Input::score(int i, int j) {
112  return residuescores[i][j];
113  }
114 
115  inline unsigned int
116  Ss2Input::size() const {
117  return residuescores.size();
118  }
119 
120 }} // namespace
121 
122 #endif
Ss2Input & operator=(const Ss2Input &orig)
Assignment operator.
Definition: Ss2Input.cc:45
virtual Ss2Input * newCopy()
Construct a new "deep copy" of this object.
Definition: Ss2Input.cc:101
virtual unsigned int size() const
Return dimension of matrix.
Definition: Ss2Input.h:116
Implement I/O objects for handling PSI-PRED files.
Definition: Ss2Input.h:34
static void pWriteDoubleVector(ostream &os, vector< vector< T > > data)
Helper function used to write a vector<vector> construct.
Definition: Ss2Input.cc:114
virtual ~Ss2Input()
Destructor.
Definition: Ss2Input.cc:38
virtual void copy(const Ss2Input &orig)
Copy orig object to this object ("deep copy").
Definition: Ss2Input.cc:87
static void pReadDoubleVector(istream &is, vector< vector< T > > &data)
Helper function used to read a vector<vector> construct.
Definition: Ss2Input.cc:128
double score(int i, int j)
Return the PSI-PRED score.
Definition: Ss2Input.h:111
friend ostream & operator<<(ostream &os, const Ss2Input &object)
Output operator.
Definition: Ss2Input.cc:58
Ss2Input()
Default constructor.
Definition: Ss2Input.cc:27
friend istream & operator>>(istream &is, Ss2Input &object)
Input operator.
Definition: Ss2Input.cc:69