bpp-phyl
2.1.0
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Friends
Pages
SubstitutionCount.h
Go to the documentation of this file.
1
//
2
// File: SubstitutionCount.h
3
// Created by: Julien Dutheil
4
// Created on: Wed Apr 5 11:08 2006
5
//
6
7
/*
8
Copyright or © or Copr. Bio++ Development Team, (November 16, 2004, 2005, 2006)
9
10
This software is a computer program whose purpose is to provide classes
11
for phylogenetic data analysis.
12
13
This software is governed by the CeCILL license under French law and
14
abiding by the rules of distribution of free software. You can use,
15
modify and/ or redistribute the software under the terms of the CeCILL
16
license as circulated by CEA, CNRS and INRIA at the following URL
17
"http://www.cecill.info".
18
19
As a counterpart to the access to the source code and rights to copy,
20
modify and redistribute granted by the license, users are provided only
21
with a limited warranty and the software's author, the holder of the
22
economic rights, and the successive licensors have only limited
23
liability.
24
25
In this respect, the user's attention is drawn to the risks associated
26
with loading, using, modifying and/or developing or reproducing the
27
software by the user in light of its specific status of free software,
28
that may mean that it is complicated to manipulate, and that also
29
therefore means that it is reserved for developers and experienced
30
professionals having in-depth computer knowledge. Users are therefore
31
encouraged to load and test the software's suitability as regards their
32
requirements in conditions enabling the security of their systems and/or
33
data to be ensured and, more generally, to use and operate it in the
34
same conditions as regards security.
35
36
The fact that you are presently reading this means that you have had
37
knowledge of the CeCILL license and that you accept its terms.
38
*/
39
40
#ifndef _SUBSTITUTIONCOUNT_H_
41
#define _SUBSTITUTIONCOUNT_H_
42
43
#include "
SubstitutionRegister.h
"
44
#include "../Model/SubstitutionModel.h"
45
46
#include <
Bpp/Numeric/Matrix/Matrix.h
>
47
48
//From the STL:
49
#include <vector>
50
51
namespace
bpp
52
{
53
70
class
SubstitutionCount
:
71
public
virtual
Clonable
72
{
73
public
:
74
SubstitutionCount
() {}
75
virtual
~SubstitutionCount
() {}
76
virtual
SubstitutionCount
*
clone
()
const
= 0;
77
78
public
:
82
virtual
bool
hasSubstitutionRegister
()
const
= 0;
83
87
virtual
const
SubstitutionRegister
*
getSubstitutionRegister
()
const
= 0;
88
92
virtual
SubstitutionRegister
*
getSubstitutionRegister
() = 0;
93
98
virtual
void
setSubstitutionRegister
(
SubstitutionRegister
* reg) = 0;
99
105
virtual
size_t
getNumberOfSubstitutionTypes
()
const
{
return
getSubstitutionRegister
()->
getNumberOfSubstitutionTypes
(); }
106
112
virtual
const
Alphabet
*
getAlphabet
()
const
{
return
getSubstitutionRegister
()->
getAlphabet
(); }
113
119
virtual
size_t
getNumberOfStates
()
const
{
return
getSubstitutionRegister
()->
getAlphabet
()->getSize(); }
120
121
132
virtual
double
getNumberOfSubstitutions
(
int
initialState,
int
finalState,
double
length,
size_t
type)
const
= 0;
133
141
virtual
Matrix<double>
*
getAllNumbersOfSubstitutions
(
double
length,
size_t
type)
const
= 0;
142
151
virtual
std::vector<double>
getNumberOfSubstitutionsForEachType
(
int
initialState,
int
finalState,
double
length)
const
= 0;
152
158
virtual
void
setSubstitutionModel
(
const
SubstitutionModel
* model) = 0;
159
};
160
166
class
AbstractSubstitutionCount
:
167
public
virtual
SubstitutionCount
168
{
169
protected
:
170
SubstitutionRegister
*
register_
;
171
172
public
:
173
AbstractSubstitutionCount
(
SubstitutionRegister
* reg):
174
register_
(reg)
175
{}
176
177
AbstractSubstitutionCount
(
const
AbstractSubstitutionCount
& asc):
178
register_
(dynamic_cast<
SubstitutionRegister
*>(
register_
->
clone
()))
179
{}
180
181
AbstractSubstitutionCount
&
operator=
(
const
AbstractSubstitutionCount
& asc) {
182
if
(
register_
)
183
delete
register_
;
184
register_
=
dynamic_cast<
SubstitutionRegister
*
>
(
register_
->
clone
());
185
return
*
this
;
186
}
187
188
~AbstractSubstitutionCount
() {
189
if
(
register_
)
190
delete
register_
;
191
}
192
193
public
:
194
bool
hasSubstitutionRegister
()
const
{
return
(
register_
!= 0); }
195
196
/*
197
*@brief attribution of a SubstitutionRegister
198
*
199
*@param reg pointer to a SubstitutionRegister
200
*
201
*/
202
203
void
setSubstitutionRegister
(
SubstitutionRegister
* reg) {
204
if
(
register_
)
delete
register_
;
205
register_
= reg;
206
substitutionRegisterHasChanged
();
207
}
208
209
const
SubstitutionRegister
*
getSubstitutionRegister
()
const
{
return
register_
; }
210
211
SubstitutionRegister
*
getSubstitutionRegister
() {
return
register_
; }
212
213
protected
:
214
virtual
void
substitutionRegisterHasChanged
() = 0;
215
};
216
217
}
//end of namespace bpp.
218
219
#endif //_SUBSTITUTIONCOUNT_H_
220
Bpp
Phyl
Mapping
SubstitutionCount.h
Generated on Thu Mar 14 2013 16:39:09 for bpp-phyl by
1.8.3.1-20130209