Victor
 All Data Structures Functions Variables Friends Pages
ThreadingInput.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 __ThreadingInput_H__
19 #define __ThreadingInput_H__
20 
21 #include <Substitution.h>
22 #include <iostream>
23 #include <string>
24 
25 namespace Victor { namespace Align2{
26 
33  public:
34 
35  // CONSTRUCTORS:
36 
39 
41  ThreadingInput(istream &is);
42 
44  ThreadingInput(const ThreadingInput &orig);
45 
47  virtual ~ThreadingInput();
48 
49 
50  // OPERATORS:
51 
54 
56  friend ostream& operator <<(ostream &os, const ThreadingInput &object);
57 
59  friend istream& operator >>(istream &is, ThreadingInput &object);
60 
61 
62  // PREDICATES:
63 
65  double score(int i, int j);
66 
68  virtual unsigned int size() const;
69 
70 
71  // MODIFIERS:
72 
74  virtual void copy(const ThreadingInput &orig);
75 
77  virtual ThreadingInput* newCopy();
78 
79 
80  // HELPERS:
81 
83  template<class T> static void pWriteDoubleVector(ostream &os,
84  vector< vector<T> > data);
85 
87  template<class T> static void pReadDoubleVector(istream &is,
88  vector< vector<T> > &data);
89 
90 
91  protected:
92 
93 
94  private:
95 
96  // ATTRIBUTES:
97 
98  vector< vector<double> > residuescores;
99 
100  };
101 
102  // -----------------------------------------------------------------------------
103  // ThreadingInput
104  // -----------------------------------------------------------------------------
105 
106  // PREDICATES:
107 
108  inline double
109  ThreadingInput::score(int i, int j) {
110  return residuescores[j][i];
111  }
112 
113  inline unsigned int
115  return residuescores.size();
116  }
117 
118 }} // namespace
119 
120 #endif
friend istream & operator>>(istream &is, ThreadingInput &object)
Input operator.
Definition: ThreadingInput.cc:65
virtual void copy(const ThreadingInput &orig)
Copy orig object to this object ("deep copy").
Definition: ThreadingInput.cc:77
ThreadingInput()
Default constructor.
Definition: ThreadingInput.cc:29
Implement I/O objects for handling threading files.
Definition: ThreadingInput.h:32
static void pReadDoubleVector(istream &is, vector< vector< T > > &data)
Helper function used to read a vector<vector> construct.
Definition: ThreadingInput.cc:119
virtual unsigned int size() const
Return the size of the object referred as the dimension of the matrix.
Definition: ThreadingInput.h:114
static void pWriteDoubleVector(ostream &os, vector< vector< T > > data)
Helper function used to write a vector<vector> construct.
Definition: ThreadingInput.cc:102
virtual ThreadingInput * newCopy()
Construct a new "deep copy" of this object.
Definition: ThreadingInput.cc:93
friend ostream & operator<<(ostream &os, const ThreadingInput &object)
Output operator.
Definition: ThreadingInput.cc:59
double score(int i, int j)
Return the threading score.
Definition: ThreadingInput.h:109
virtual ~ThreadingInput()
Destructor.
Definition: ThreadingInput.cc:40
ThreadingInput & operator=(const ThreadingInput &orig)
Assignment operator.
Definition: ThreadingInput.cc:51