1
/* This file is part of Charon.
3
Charon is free software: you can redistribute it and/or modify
4
it under the terms of the GNU Lesser 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.
8
Charon 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 Lesser General Public License for more details.
13
You should have received a copy of the GNU Lesser General Public License
14
along with Charon. If not, see <http://www.gnu.org/licenses/>.
16
/** @file ParameteredObject.hxx
17
* Convenience file to iclude all ParameteredObject dependencies and
19
* Include this file when you want to derive from ParameteredObject.
21
* @author <a href="mailto:jmgottfried@web.de">Jens-Malte Gottfried</a>
22
* @author <a href="mailto:bc002@ix.urz.uni-heidelberg.de">Cornelius Ratsch</a>
28
#ifndef _PARAMETERED_OBJECT_HXX_
29
#define _PARAMETERED_OBJECT_HXX_
31
#include "ParameteredObject.h"
32
#include "Parameter.hxx"
36
void ParameteredObject::_addParameter(Parameter<T>& param,
37
const std::string& name, const std::string& doc, const T& defVal,
38
const std::string& type) {
39
param.setDefault(defVal);
41
ParameteredObject::_addParameter(param, name, doc, type.c_str());
45
void ParameteredObject::setParameter(std::string name, T value) {
46
if(_parameters.find(name) != _parameters.end()) {
47
*((Parameter<T>*)_parameters[name]) = value;
52
TemplatedParameteredObject<T>::TemplatedParameteredObject(
53
const std::string& className, const std::string& name,
54
const std::string& doc) :
55
ParameteredObject(className, name, doc) {
56
_addSomething("parameters", "templatetype", "template type", "string", "double");
61
const std::string TemplatedParameteredObject<T>::getTemplateType() const {
62
return TypeDetector::instance().type(typeid(T).name());
65
#endif // _PARAMETERED_OBJECT_HXX_