BernoulliSamplingExecStreamGenerator Class Reference

Bernoulli sampling data generator. More...

#include <SamplingExecStreamGenerator.h>

Inheritance diagram for BernoulliSamplingExecStreamGenerator:

MockProducerExecStreamGenerator List of all members.

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< MockProducerExecStreamGeneratorgenerator
boost::scoped_ptr< BernoulliRngrng
uint nColumns
uint iChildRow
uint iLastRow

Detailed Description

Bernoulli sampling data generator.

Produces rows from the input based on the Bernoulli sampling algorithm.

Stephan Zuercher

Definition at line 37 of file SamplingExecStreamGenerator.h.

Constructor & Destructor Documentation

BernoulliSamplingExecStreamGenerator::BernoulliSamplingExecStreamGenerator ( boost::shared_ptr< MockProducerExecStreamGenerator > const &  generatorInit,
float  prob,
uint  seed,
uint  nColumnsInit 
) [inline, explicit]

Definition at line 49 of file SamplingExecStreamGenerator.h.

References rng.

00052         : generator(generatorInit),
00053           rng(new BernoulliRng(prob)),
00054           nColumns(nColumnsInit),
00055           iChildRow((uint) -1),
00056           iLastRow((uint) -1)
00057     {
00058         rng->reseed(seed);
00059     }

Member Function Documentation

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);
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         }
00076         return generator->generateValue(iChildRow, iCol);
00077     }

Member Data Documentation

boost::shared_ptr<MockProducerExecStreamGenerator> BernoulliSamplingExecStreamGenerator::generator [protected]

Definition at line 41 of file SamplingExecStreamGenerator.h.

Referenced by generateValue().

boost::scoped_ptr<BernoulliRng> BernoulliSamplingExecStreamGenerator::rng [protected]

Definition at line 43 of file SamplingExecStreamGenerator.h.

Referenced by BernoulliSamplingExecStreamGenerator(), and generateValue().

uint BernoulliSamplingExecStreamGenerator::nColumns [protected]

Definition at line 45 of file SamplingExecStreamGenerator.h.

Referenced by generateValue().

uint BernoulliSamplingExecStreamGenerator::iChildRow [protected]

Definition at line 46 of file SamplingExecStreamGenerator.h.

Referenced by generateValue().

uint BernoulliSamplingExecStreamGenerator::iLastRow [protected]

Definition at line 47 of file SamplingExecStreamGenerator.h.

Referenced by generateValue().

The documentation for this class was generated from the following file:
Generated on Mon Jun 22 04:00:24 2009 for Fennel by  doxygen 1.5.1