00001 #ifndef INCLUDE_SIEVE_H
00002 #define INCLUDE_SIEVE_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 #if defined(NO_TEMPLATE_MEMBERS)
00036 #include "PartialList.h"
00037 #endif
00038
00039 #include "PartialPtrs.h"
00040
00041
00042 namespace Loris {
00043
00044
00045
00046
00065
00066 class Sieve
00067 {
00068
00069
00070 double _fadeTime;
00071
00072
00073
00074
00075 public:
00076
00077
00078
00081 static const double DefaultFadeTime;
00082
00083
00084
00095 explicit Sieve( double partialFadeTime = Sieve::DefaultFadeTime );
00096
00097
00098
00099
00100
00113 #if ! defined(NO_TEMPLATE_MEMBERS)
00114 template<typename Iter>
00115 void sift( Iter sift_begin, Iter sift_end );
00116 #else
00117 inline
00118 void sift( PartialList::iterator sift_begin, PartialList::iterator sift_end );
00119 #endif
00120
00132 #if ! defined(NO_TEMPLATE_MEMBERS)
00133 template< typename Container >
00134 void sift( Container & partials )
00135 #else
00136 inline
00137 void sift( PartialList & partials )
00138 #endif
00139 {
00140 sift( partials.begin(), partials.end() );
00141 }
00142
00143
00144
00162 #if ! defined(NO_TEMPLATE_MEMBERS)
00163 template< typename Iter >
00164 static
00165 void sift( Iter sift_begin, Iter sift_end,
00166 double partialFadeTime );
00167 #else
00168 static inline
00169 void sift( PartialList::iterator sift_begin, PartialList::iterator sift_end,
00170 double partialFadeTime );
00171 #endif
00172
00173
00174 private:
00175
00185 void sift_ptrs( PartialPtrs & ptrs );
00186
00187 };
00188
00189
00190
00191
00204 #if ! defined(NO_TEMPLATE_MEMBERS)
00205 template< typename Iter >
00206 void Sieve::sift( Iter sift_begin, Iter sift_end )
00207 #else
00208 inline
00209 void Sieve::sift( PartialList::iterator sift_begin, PartialList::iterator sift_end )
00210 #endif
00211 {
00212 PartialPtrs ptrs;
00213 fillPartialPtrs( sift_begin, sift_end, ptrs );
00214 sift_ptrs( ptrs );
00215 }
00216
00217
00218
00219
00237 #if ! defined(NO_TEMPLATE_MEMBERS)
00238 template< typename Iter >
00239 void Sieve::sift( Iter sift_begin, Iter sift_end,
00240 double partialFadeTime )
00241 #else
00242 inline
00243 void Sieve::sift( PartialList::iterator sift_begin, PartialList::iterator sift_end,
00244 double partialFadeTime )
00245 #endif
00246 {
00247 Sieve instance( partialFadeTime );
00248 instance.sift( sift_begin, sift_end );
00249 }
00250
00251 }
00252
00253 #endif