#include <EvtPredGen.hh>
Public Types | |
typedef Generator::result_type | result_type |
Public Member Functions | |
EvtPredGen (const EvtPredGen &other) | |
EvtPredGen (Generator gen, Predicate pred) | |
EvtPredGen () | |
int | getPassed () const |
int | getTried () const |
result_type | operator() () |
~EvtPredGen () | |
Protected Attributes | |
Generator | itsGen |
int | itsPassed |
Predicate | itsPred |
int | itsTried |
|
|
|
|
|
|
|
00037 : itsGen(other.itsGen), itsPred(other.itsPred), 00038 itsTried(other.itsTried), itsPassed(other.itsPassed) 00039 {}
|
|
00042 {}
|
|
00065 { return itsPassed; }
|
|
00064 { return itsTried; }
|
|
00044 { 00045 00046 int i = 0; 00047 int MAX = 10000; 00048 while(i++ < MAX) { 00049 00050 itsTried++; 00051 result_type point = itsGen(); 00052 if(itsPred(point)) { 00053 itsPassed++; 00054 return point; 00055 } 00056 } 00057 00058 printf("No random point generated after %d attempts\n",MAX); 00059 printf("Sharp peak? Consider using pole compensation.\n"); 00060 printf("I will now pick a point at random to return.\n"); 00061 return itsGen(); 00062 }
|
|
|
|
|
|
|
|
|