Victor
 All Data Structures Functions Variables Friends Pages
Structure.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 __Structure_H__
19 #define __Structure_H__
20 
21 #include <SubMatrix.h>
22 #include <math.h>
23 #include <string>
24 
25 namespace Victor { namespace Align2{
26 
32  class Structure {
33  public:
34 
35  // CONSTRUCTORS:
36 
38 
39  Structure(SubMatrix *subStr) : subStr(subStr) {
40  }
41 
43 
44  Structure(const Structure &orig) {
45  copy(orig);
46  }
47 
49 
50  virtual ~Structure() {
51  }
52 
53 
54  // OPERATORS:
55 
57  Structure& operator =(const Structure &orig);
58 
59 
60  // PREDICATES:
61 
63  virtual double scoringStr(int i, int j) = 0;
64 
65 
66  // MODIFIERS:
67 
69  virtual void copy(const Structure &orig);
70 
72  virtual Structure* newCopy() = 0;
73 
75 
76  virtual void reverse() {
77  }
78 
79 
80  // ATTRIBUTES:
81 
83 
84 
85  protected:
86 
87 
88  private:
89 
90  };
91 
92  // -----------------------------------------------------------------------------
93  // Structure
94  // -----------------------------------------------------------------------------
95 
96  // OPERATORS:
97 
98  inline Structure&
100  if (&orig != this)
101  copy(orig);
102  POSTCOND((orig == *this), exception);
103  return *this;
104  }
105 
106 
107  // MODIFIERS:
108 
109  inline void
110  Structure::copy(const Structure &orig) {
111  subStr = orig.subStr->newCopy();
112  }
113 
114 }} // namespace
115 
116 #endif
virtual void reverse()
Reverse template structural components.
Definition: Structure.h:76
Implement a standard substitution matrix.
Definition: SubMatrix.h:30
virtual Structure * newCopy()=0
Construct a new "deep copy" of this object.
Structure & operator=(const Structure &orig)
Assignment operator.
Definition: Structure.h:99
Structure(SubMatrix *subStr)
Default constructor.
Definition: Structure.h:39
virtual double scoringStr(int i, int j)=0
Calculate scores to create matrix values.
Structure(const Structure &orig)
Copy constructor.
Definition: Structure.h:44
Base class for structural scores.
Definition: Structure.h:32
virtual SubMatrix * newCopy()
Construct a new "deep copy" of this object.
Definition: SubMatrix.cc:105
virtual ~Structure()
Destructor.
Definition: Structure.h:50
virtual void copy(const Structure &orig)
Copy orig object to this object ("deep copy").
Definition: Structure.h:110
SubMatrix * subStr
Structural substitution matrix.
Definition: Structure.h:82