00001 #include "FastShowerUtils/SamplerPtr.h" 00002 #include "FastShowerUtils/CoreSamples.h" 00003 #include "FastShowerUtils/Pinger/IPinger.h" 00004 #include "FastShowerUtils/Pinger/SimplePinger.h" 00005 #include "FastShowerUtils/Pinger/SimpleStatsCollector.h" 00006 #include "FastShowerUtils/FunctionStats.h" 00007 #include "FastShowerUtils/PolyArgs.h" 00008 #include <iostream> 00009 #include <string> 00010 #include <assert.h> 00011 namespace FastShower{ 00012 SamplerPtr::SamplerPtr(ISampler* s, std::string t): 00013 DebugBase(t),m_pointee(s){} 00014 // 00015 SamplerPtr::SamplerPtr(const SamplerPtr & rhs):ISampler(),DebugBase(rhs){ 00016 m_pointee = rhs.m_pointee; 00017 } 00018 SamplerPtr& SamplerPtr::operator=(const SamplerPtr& rhs){ 00019 00020 if (this == &rhs ) return *this; 00021 00022 ISampler::operator=(rhs); 00023 DebugBase::operator=(rhs); 00024 m_pointee = rhs.m_pointee; 00025 00026 return *this; 00027 } 00028 void SamplerPtr::sample(const PolyArgs& pa, CoreSamples& cs)const{ 00029 pa.pp()->fromIDebug(this); 00030 m_pointee->sample(pa, cs); 00031 double x = m_pointee->lastValue(cs); 00032 this->bumpStats(x, pa.pp() ); 00033 } 00034 double SamplerPtr::lastValue(const CoreSamples& cs) const { 00035 return m_pointee->lastValue(cs); 00036 } 00037 // 00038 ISampler* SamplerPtr::clone() const { 00039 ISampler* spPtr = new SamplerPtr(*this); 00040 return spPtr; 00041 } 00042 void SamplerPtr::ping(IPinger& p) const {DebugBase::ping(p);} 00043 void SamplerPtr::components(IDebug::Cpts& v)const{ 00044 m_pointee->components(v); 00045 } 00046 00047 // 00048 } 00049 00050 00051 00052 00053