00001 #ifndef INCLUDE_RESAMPLER_H
00002 #define INCLUDE_RESAMPLER_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #include "PartialList.h"
00041
00042
00043 namespace Loris {
00044
00045 class Partial;
00046
00047
00048
00049
00057
00058 class Resampler
00059 {
00060
00061 public:
00062
00063
00071 explicit Resampler( double sampleInterval );
00072
00073
00074
00075
00076
00085 void resample( Partial & p ) const;
00086
00087
00089 void operator() ( Partial & p ) const
00090 {
00091 resample( p );
00092 }
00093
00109 #if ! defined(NO_TEMPLATE_MEMBERS)
00110 template<typename Iter>
00111 void resample( Iter begin, Iter end ) const;
00112 #else
00113 inline
00114 void resample( PartialList::iterator begin, PartialList::iterator end ) const;
00115 #endif
00116
00118 #if ! defined(NO_TEMPLATE_MEMBERS)
00119 template<typename Iter>
00120 void operator()( Iter begin, Iter end ) const
00121 #else
00122 void operator()( PartialList::iterator begin, PartialList::iterator end ) const
00123 #endif
00124 {
00125 resample( begin, end );
00126 }
00127
00128
00129
00147 #if ! defined(NO_TEMPLATE_MEMBERS)
00148 template< typename Iter >
00149 static
00150 void resample( Iter begin, Iter end, double sampleInterval );
00151 #else
00152 static inline
00153 void resample( PartialList::iterator begin, PartialList::iterator end,
00154 double sampleInterval );
00155 #endif
00156
00157
00158 private:
00159
00161 double interval_;
00162
00163 };
00164
00165
00166
00167
00183
00184 #if ! defined(NO_TEMPLATE_MEMBERS)
00185 template<typename Iter>
00186 void Resampler::resample( Iter begin, Iter end ) const
00187 #else
00188 inline
00189 void Resampler::resample( PartialList::iterator begin, PartialList::iterator end ) const
00190 #endif
00191 {
00192 while ( begin != end )
00193 {
00194 resample( *begin++ );
00195 }
00196 }
00197
00198
00199
00200
00218
00219 #if ! defined(NO_TEMPLATE_MEMBERS)
00220 template< typename Iter >
00221 void Resampler::resample( Iter begin, Iter end, double sampleInterval )
00222 #else
00223 inline
00224 void Resampler::resample( PartialList::iterator begin, PartialList::iterator end,
00225 double sampleInterval )
00226 #endif
00227 {
00228 Resampler instance( sampleInterval );
00229 instance.resample( begin, end );
00230 }
00231
00232 }
00233
00234 #endif
00235