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
00036 #include "Distiller.h"
00037
00038 #if defined(NO_TEMPLATE_MEMBERS)
00039 #include "PartialList.h"
00040 #endif
00041
00042 #include "PartialPtrs.h"
00043
00044
00045 namespace Loris {
00046
00047
00048
00049
00068
00069 class Sieve
00070 {
00071
00072
00073 double _fadeTime;
00074
00075
00076
00077
00078 public:
00079
00080
00081
00082 enum
00083 {
00084
00089 DefaultFadeTimeMs = Distiller::DefaultFadeTimeMs,
00090
00096 DefaultSilentTimeMs = Distiller::DefaultSilentTimeMs
00097 };
00098
00099
00100
00111 explicit Sieve( double partialFadeTime = Sieve::DefaultFadeTimeMs/1000.0 );
00112
00113
00114
00115
00116
00129 #if ! defined(NO_TEMPLATE_MEMBERS)
00130 template<typename Iter>
00131 void sift( Iter sift_begin, Iter sift_end );
00132 #else
00133 inline
00134 void sift( PartialList::iterator sift_begin, PartialList::iterator sift_end );
00135 #endif
00136
00148 #if ! defined(NO_TEMPLATE_MEMBERS)
00149 template< typename Container >
00150 void sift( Container & partials )
00151 #else
00152 inline
00153 void sift( PartialList & partials )
00154 #endif
00155 {
00156 sift( partials.begin(), partials.end() );
00157 }
00158
00159
00160
00178 #if ! defined(NO_TEMPLATE_MEMBERS)
00179 template< typename Iter >
00180 static
00181 void sift( Iter sift_begin, Iter sift_end,
00182 double partialFadeTime );
00183 #else
00184 static inline
00185 void sift( PartialList::iterator sift_begin, PartialList::iterator sift_end,
00186 double partialFadeTime );
00187 #endif
00188
00189
00190 private:
00191
00201 void sift_ptrs( PartialPtrs & ptrs );
00202
00203 };
00204
00205
00206
00207
00220 #if ! defined(NO_TEMPLATE_MEMBERS)
00221 template< typename Iter >
00222 void Sieve::sift( Iter sift_begin, Iter sift_end )
00223 #else
00224 inline
00225 void Sieve::sift( PartialList::iterator sift_begin, PartialList::iterator sift_end )
00226 #endif
00227 {
00228 PartialPtrs ptrs;
00229 fillPartialPtrs( sift_begin, sift_end, ptrs );
00230 sift_ptrs( ptrs );
00231 }
00232
00233
00234
00235
00253 #if ! defined(NO_TEMPLATE_MEMBERS)
00254 template< typename Iter >
00255 void Sieve::sift( Iter sift_begin, Iter sift_end,
00256 double partialFadeTime )
00257 #else
00258 inline
00259 void Sieve::sift( PartialList::iterator sift_begin, PartialList::iterator sift_end,
00260 double partialFadeTime )
00261 #endif
00262 {
00263 Sieve instance( partialFadeTime );
00264 instance.sift( sift_begin, sift_end );
00265 }
00266
00267 }
00268
00269 #endif