bpp-core
2.1.0
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Friends
Parametrizable.h
Go to the documentation of this file.
1
//
2
// File: Parametrizable.h
3
// Created by: Julien Dutheil
4
// Created on: Sun Oct 19 23:06:42 2003
5
//
6
7
/*
8
Copyright or © or Copr. Bio++ Development Team, (November 19, 2004)
9
10
This software is a computer program whose purpose is to provide classes
11
for numerical calculus.
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 _PARAMETRIZABLE_H_
41
#define _PARAMETRIZABLE_H_
42
43
// From Utils:
44
#include "../Clonable.h"
45
46
// From the STL:
47
#include <string>
48
49
#include "
ParameterList.h
"
50
51
namespace
bpp
52
{
53
59
class
Parametrizable
:
60
public
virtual
Clonable
61
{
62
public
:
63
Parametrizable
() {}
64
virtual
~Parametrizable
() {}
65
66
public
:
73
virtual
bool
hasParameter
(
const
std::string& name)
const
= 0;
74
81
virtual
const
ParameterList
&
getParameters
()
const
= 0;
82
90
virtual
const
Parameter
&
getParameter
(
const
std::string& name)
const
throw
(
ParameterNotFoundException
) = 0;
91
98
virtual
double
getParameterValue
(
const
std::string& name)
const
99
throw
(
ParameterNotFoundException
) = 0;
100
112
virtual
void
setAllParametersValues
(
const
ParameterList
& parameters)
113
throw
(
ParameterNotFoundException
,
ConstraintException
) = 0;
114
124
virtual
void
setParameterValue
(
const
std::string& name,
double
value)
125
throw
(
ParameterNotFoundException
,
ConstraintException
) = 0;
126
137
virtual
void
setParametersValues
(
const
ParameterList
& parameters)
138
throw
(
ParameterNotFoundException
,
ConstraintException
) = 0;
139
150
virtual
bool
matchParametersValues
(
const
ParameterList
& parameters)
151
throw
(
ConstraintException
) = 0;
152
159
virtual
size_t
getNumberOfParameters
()
const
= 0;
160
167
virtual
void
setNamespace
(
const
std::string& prefix) = 0;
168
172
virtual
std::string
getNamespace
()
const
= 0;
173
179
virtual
std::string
getParameterNameWithoutNamespace
(
const
std::string& name)
const
= 0;
180
181
};
182
188
class
ParametrizableAdapter
:
189
public
virtual
Parametrizable
190
{
191
protected
:
192
ParameterList
parameters_
;
193
Parameter
parameter_
;
194
195
public
:
196
ParametrizableAdapter
():
parameters_
(),
parameter_
() {}
197
virtual
~ParametrizableAdapter
() {}
198
199
public
:
200
206
bool
hasParameter
(
const
std::string & name)
const
{
return
parameters_
.
hasParameter
(name); }
207
const
ParameterList
&
getParameters
()
const
{
return
parameters_
; }
208
const
Parameter
&
getParameter
(
const
std::string & name)
const
throw
(
ParameterNotFoundException
) {
return
parameter_
; }
209
double
getParameterValue
(
const
std::string & name)
const
210
throw
(
ParameterNotFoundException
) {
return
0; };
211
void
setAllParametersValues
(
const
ParameterList
& parameters)
212
throw
(
ParameterNotFoundException
,
ConstraintException
) {}
213
void
setParameterValue
(
const
std::string & name,
double
value)
214
throw
(
ParameterNotFoundException
,
ConstraintException
) {}
215
void
setParametersValues
(
const
ParameterList
& parameters)
216
throw
(
ParameterNotFoundException
,
ConstraintException
) {}
217
bool
matchParametersValues
(
const
ParameterList
& parameters)
218
throw
(
ConstraintException
) {
return
false ;}
219
size_t
getNumberOfParameters
()
const
{
return
0; }
220
void
setNamespace
(
const
std::string& prefix) {}
221
std::string
getNamespace
()
const
{
return
""
; }
222
std::string
getParameterNameWithoutNamespace
(
const
std::string& name)
const
{
return
name; }
225
};
226
227
}
//end of namespace bpp.
228
229
#endif //_PARAMETRIZABLE_H_
230
Bpp
Numeric
Parametrizable.h
Generated on Thu Mar 14 2013 16:32:30 for bpp-core by
1.8.3.1-20130209