00001 #ifndef FASTSHOWER_IFNPTR_H
00002 #define FASTSHOWER_IFNPTR_H
00003
00004 #ifndef FASTSHOWER_DEBUGBASE_H
00005 #include "FastShowerUtils/DebugBase.h"
00006 #endif
00007
00008 #ifndef FASTSHOWER_SP_H
00009 #include "FastShowerUtils/SP.h"
00010 #endif
00011
00012 #ifndef FASTSHOWER_POLYARGS_H
00013 #include "FastShowerUtils/PolyArgs.h"
00014 #endif
00015
00016 #ifndef STD_STRING_H
00017 #define STD_STRING_H
00018 #include <string>
00019 #endif
00020
00021 #include <iostream>
00022 #include <string>
00023
00024 namespace FastShower{
00029 class PolyArgs;
00030 class IFnPtr: public IFn, private DebugBase{
00031 public:
00032
00033 IFnPtr(IFn* f, std::string s="");
00034 IFnPtr(const IFnPtr & f);
00035 IFnPtr& operator=(const IFnPtr& f);
00036 ~IFnPtr(){};
00037
00038 virtual double value(const PolyArgs&) const;
00039 virtual IFnPtr* clone() const;
00040
00041 private:
00042 SP<IFn> m_pointee;
00043 };
00044
00045 inline
00046 IFnPtr::IFnPtr(IFn* f, std::string s):
00047 DebugBase(s),m_pointee(f){}
00048
00049 inline
00050 IFnPtr::IFnPtr(const IFnPtr& f):IFn(f),DebugBase(f){
00051 m_pointee = f.m_pointee;
00052 }
00053
00054 inline
00055 IFnPtr& IFnPtr::operator=(const IFnPtr& rhs){
00056
00057 if (this == &rhs ) return *this;
00058
00059 IFn::operator=(rhs);
00060 DebugBase::operator=(rhs);
00061 m_pointee = rhs.m_pointee;
00062
00063 return *this;
00064 }
00065
00066 inline
00067 double IFnPtr::value(const PolyArgs& pa)const{
00068 double x = m_pointee->value(pa);
00069 this->bumpStats(x, pa.pp() );
00070
00071
00072 return x;
00073 }
00074
00075 inline
00076 IFnPtr* IFnPtr::clone() const {
00077 IFnPtr* nptr = new IFnPtr(*this);
00078 return nptr;
00079 }
00080
00081 }
00082 #endif
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095