00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 // -------------------------------------------------------------------------- 00005 // OpenMS Mass Spectrometry Framework 00006 // -------------------------------------------------------------------------- 00007 // Copyright (C) 2003-2008 -- Oliver Kohlbacher, Knut Reinert 00008 // 00009 // This library is free software; you can redistribute it and/or 00010 // modify it under the terms of the GNU Lesser General Public 00011 // License as published by the Free Software Foundation; either 00012 // version 2.1 of the License, or (at your option) any later version. 00013 // 00014 // This library is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 // Lesser General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU Lesser General Public 00020 // License along with this library; if not, write to the Free Software 00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 // 00023 // -------------------------------------------------------------------------- 00024 // $Maintainer: Ole Schulz-Trieglaff $ 00025 // -------------------------------------------------------------------------- 00026 00027 #ifndef OPENMS_TRANSFORMATIONS_FEATUREFINDER_MODELDESCRIPTION_H 00028 #define OPENMS_TRANSFORMATIONS_FEATUREFINDER_MODELDESCRIPTION_H 00029 00030 #include <OpenMS/DATASTRUCTURES/Param.h> 00031 #include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/BaseModel.h> 00032 #include <OpenMS/CONCEPT/Factory.h> 00033 00034 #include <sstream> 00035 00036 namespace OpenMS 00037 { 00047 template <UInt D> 00048 class ModelDescription 00049 { 00050 public: 00051 00053 ModelDescription() 00054 : name_(), 00055 parameters_() 00056 { 00057 } 00058 00060 ModelDescription(const ModelDescription& source) 00061 : name_(source.name_), 00062 parameters_(source.parameters_) 00063 { 00064 } 00065 00067 ModelDescription(const BaseModel<D>* model) 00068 : name_(model->getName()), 00069 parameters_(model->getParameters()) 00070 { 00071 } 00072 00074 virtual ~ModelDescription() 00075 { 00076 } 00077 00079 virtual ModelDescription& operator = (const ModelDescription& source) 00080 { 00081 if (&source == this) return *this; 00082 00083 name_ = source.name_; 00084 parameters_ = source.parameters_; 00085 00086 return *this; 00087 } 00088 00091 BaseModel<D>* createModel() 00092 { 00093 if (name_ == "") return 0; 00094 BaseModel<D>* model = Factory< BaseModel<D> >::create(name_); 00095 model->setParameters(parameters_); 00096 return model; 00097 } 00098 00101 00102 inline const String& getName() const 00103 { 00104 return name_; 00105 } 00107 inline String& getName() 00108 { 00109 return name_; 00110 } 00112 inline void setName(const String& name) 00113 { 00114 name_ = name; 00115 } 00116 00118 inline const Param& getParam() const 00119 { 00120 return parameters_; 00121 } 00123 inline Param& getParam() 00124 { 00125 return parameters_; 00126 } 00128 inline void setParam(const Param& param) 00129 { 00130 parameters_ = param; 00131 } 00132 00135 virtual bool operator == (const ModelDescription& rhs) const 00136 { 00137 return (name_ == rhs.name_) && (parameters_ == rhs.parameters_); 00138 } 00139 00140 virtual bool operator != (const ModelDescription& rhs) const 00141 { 00142 return !(operator == (rhs)); 00143 } 00145 00146 protected: 00147 00148 String name_; 00149 Param parameters_; 00150 }; 00151 } 00152 #endif // OPENMS_TRANSFORMATIONS_FEATUREFINDER_MODELDESCRIPTION_H
Generated Tue Apr 1 15:36:36 2008 -- using doxygen 1.5.4 | OpenMS / TOPP 1.1 |