nnfw/src/updatable.cpp
00001 /******************************************************************************** 00002 * Neural Network Framework. * 00003 * Copyright (C) 2005-2011 Gianluca Massera <emmegian@yahoo.it> * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the Free Software * 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * 00018 ********************************************************************************/ 00019 00020 #include "updatable.h" 00021 00022 namespace farsa { 00023 00024 Updatable::Updatable( QString name ) 00025 : ParameterSettableInConstructor() 00026 { 00027 setName( name ); 00028 } 00029 00030 Updatable::Updatable( ConfigurationParameters& params, QString prefix ) : 00031 ParameterSettableInConstructor(params, prefix) 00032 { 00033 QString upname = prefix; 00034 // remove from the name the GroupSeparator() at the start and at the end 00035 // because they create problem when referencing the object using NeuralNet::byName 00036 if ( upname.startsWith( ConfigurationParameters::GroupSeparator() ) ) { 00037 upname.remove( 0, 1 ); 00038 } 00039 if ( upname.endsWith( ConfigurationParameters::GroupSeparator() ) ) { 00040 upname.chop( 1 ); 00041 } 00042 setName( upname ); 00043 } 00044 00045 Updatable::~Updatable() { 00046 } 00047 00048 void Updatable::setName( QString newname ) { 00049 namev = newname; 00050 } 00051 00052 QString Updatable::name() const { 00053 return namev; 00054 } 00055 00056 void Updatable::save(ConfigurationParameters& params, QString prefix) 00057 { 00058 params.startObjectParameters(prefix, "Updatable", this); 00059 } 00060 00061 void Updatable::describe( QString type ) { 00062 addTypeDescription( type, "an Updatable" ); 00063 } 00064 00065 }