![]() |
Reference Documentation |
00001 /********************************************************************** 00002 * * 00003 * Copyright (c) 2002 Jakub MOSCICKI, CERN/IT * 00004 * <Jakub.MOSCICKI@cern.ch> * 00005 * * 00006 * This library is free software; you can redistribute it and/or * 00007 * modify it under the terms of the GNU Lesser General Public * 00008 * License as published by the Free Software Foundation; either * 00009 * version 2.1 of the License, or (at your option) any later version. * 00010 * * 00011 * This library is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00014 * Lesser General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU Lesser General Public * 00017 * License along with this library (see file COPYING); if not, write * 00018 * to the Free Software Foundation, Inc., 59 Temple Place, Suite * 00019 * 330, Boston, MA 02111-1307 USA, or contact the author at * 00020 * <Jakub.MOSCICKI@cern.ch> * 00021 **********************************************************************/ 00022 00023 // Header file for class Function 00024 // 00025 // Created by: Jakub MOSCICKI at Tue Jan 15 13:05:27 2002 00026 // 00027 // Last update: Tue Jan 15 13:05:27 2002 00028 // 00029 #ifndef FUNCTION_H 00030 #define FUNCTION_H 00031 00032 00033 #include "AIDA/IFunction.h" 00034 00035 // twin proxy 00036 #include "Interfaces/IModelFunction.h" 00037 00038 # include <memory> 00039 00050 class Function_plain_wrapper : virtual public IFunction 00051 { 00052 00053 public: 00054 00061 Function_plain_wrapper(std::string label, Anaphe::IModelFunction* modelFun); 00062 00065 00066 virtual ~Function_plain_wrapper(); 00067 00068 private: 00069 // for more complex classes these two should probably be protected 00070 Function_plain_wrapper(const Function_plain_wrapper &); 00071 Function_plain_wrapper & operator = (const Function_plain_wrapper &); 00072 00073 void _init(); 00074 00075 public: 00076 00077 // ----------------------------------------------------------------------- 00078 00079 virtual const std::string & label ( ) const; 00080 00087 virtual double value ( const std::vector< double > & point ) const; 00088 00089 //-FIXME: for 1-D: operator () (double), similar for n-D 00090 00094 virtual int dimension ( ) const; 00095 00099 virtual const std::vector< std::string > & parameterNames ( ) const; 00100 00104 virtual const std::vector< double > & parameterValues ( ) const; 00105 00109 virtual bool setParameterValue ( const std::string & name, double value ); 00110 00111 00112 virtual const std::string & version() const; 00113 00114 // ----------------------------------------------------------------------- 00115 // additional methods - specific to this implementation 00116 00117 bool setParameterValues(std::vector<double> vals); 00118 00119 protected: 00120 00121 std::string m_label; 00122 00124 std::vector<std::string> m_parNames; 00125 std::vector<double> m_parVals; 00126 00127 Anaphe::IModelFunction * m_modelFun; 00128 00129 // bool m_owner; 00130 private: 00131 00132 mutable std::string m_version; 00133 00134 }; 00135 00140 class Function_impl_owner : virtual public IFunction 00141 { 00142 00143 public: 00144 00150 Function_impl_owner(std::string label, std::auto_ptr<Anaphe::IModelFunction> modelFun); 00151 00152 // ----------------------------------------------------------------------- 00153 00154 const std::string & label ( ) const 00155 { return m_wrapper.label(); } 00156 00157 double value ( const std::vector< double > & point ) const 00158 { return m_wrapper.value(point); } 00159 00160 int dimension ( ) const 00161 { return m_wrapper.dimension(); } 00162 00163 const std::vector< std::string > & parameterNames ( ) const 00164 { return m_wrapper.parameterNames(); } 00165 00166 const std::vector< double > & parameterValues ( ) const 00167 { return m_wrapper.parameterValues(); } 00168 00169 bool setParameterValue ( const std::string & name, double value ) 00170 { return m_wrapper.setParameterValue(name,value); } 00171 00172 const std::string & version() const 00173 { return m_wrapper.version(); } 00174 00175 // ----------------------------------------------------------------------- 00176 bool setParameterValues(std::vector<double> vals) 00177 { return m_wrapper.setParameterValues(vals); } 00178 00179 private: 00180 std::auto_ptr<Anaphe::IModelFunction> m_modelFun; 00181 Function_plain_wrapper m_wrapper; 00182 }; 00183 00184 #endif /* FUNCTION_H */
Anaphe documentation generated by Doxygen (www.doxygen.org) |