#include <SamplingExecStreamGenerator.h>
Inheritance diagram for BernoulliSamplingExecStreamGenerator:
Public Member Functions | |
BernoulliSamplingExecStreamGenerator (boost::shared_ptr< MockProducerExecStreamGenerator > const &generatorInit, float prob, uint seed, uint nColumnsInit) | |
virtual int64_t | generateValue (uint iRow, uint iCol) |
Generates one data value. | |
Protected Attributes | |
boost::shared_ptr< MockProducerExecStreamGenerator > | generator |
boost::scoped_ptr< BernoulliRng > | rng |
uint | nColumns |
uint | iChildRow |
uint | iLastRow |
Produces rows from the input based on the Bernoulli sampling algorithm.
Definition at line 37 of file SamplingExecStreamGenerator.h.
BernoulliSamplingExecStreamGenerator::BernoulliSamplingExecStreamGenerator | ( | boost::shared_ptr< MockProducerExecStreamGenerator > const & | generatorInit, | |
float | prob, | |||
uint | seed, | |||
uint | nColumnsInit | |||
) | [inline, explicit] |
virtual int64_t BernoulliSamplingExecStreamGenerator::generateValue | ( | uint | iRow, | |
uint | iCol | |||
) | [inline, virtual] |
Generates one data value.
iRow | 0-based row number to generate | |
iCol | 0-based col number to generate |
Implements MockProducerExecStreamGenerator.
Definition at line 61 of file SamplingExecStreamGenerator.h.
References generator, iChildRow, iLastRow, nColumns, and rng.
00062 { 00063 if (iRow != iLastRow) { 00064 assert(iCol == 0); 00065 00066 iChildRow++; 00067 while (!rng->nextValue()) { 00068 for (int i = 0; i < nColumns; i++) { 00069 generator->generateValue(iChildRow, i); 00070 } 00071 iChildRow++; 00072 } 00073 iLastRow = iRow; 00074 } 00075 00076 return generator->generateValue(iChildRow, iCol); 00077 }
boost::shared_ptr<MockProducerExecStreamGenerator> BernoulliSamplingExecStreamGenerator::generator [protected] |
boost::scoped_ptr<BernoulliRng> BernoulliSamplingExecStreamGenerator::rng [protected] |
Definition at line 43 of file SamplingExecStreamGenerator.h.
Referenced by BernoulliSamplingExecStreamGenerator(), and generateValue().
uint BernoulliSamplingExecStreamGenerator::nColumns [protected] |
uint BernoulliSamplingExecStreamGenerator::iChildRow [protected] |
uint BernoulliSamplingExecStreamGenerator::iLastRow [protected] |