SystemSamplingExecStreamGenerator Class Reference

#include <SamplingExecStreamGenerator.h>

Inheritance diagram for SystemSamplingExecStreamGenerator:

MockProducerExecStreamGenerator List of all members.

Public Member Functions

 SystemSamplingExecStreamGenerator (boost::shared_ptr< MockProducerExecStreamGenerator > const &generatorInit, float rate, uint nRows, uint nColumnsInit, uint nClumps)
virtual int64_t generateValue (uint iRow, uint iCol)
 Generates one data value.

Protected Attributes

boost::shared_ptr< MockProducerExecStreamGeneratorgenerator
uint nColumns
uint iChildRow
uint iLastRow
uint clumpSize
uint clumpDistance
uint clumpPos

Detailed Description

Definition at line 80 of file SamplingExecStreamGenerator.h.


Constructor & Destructor Documentation

SystemSamplingExecStreamGenerator::SystemSamplingExecStreamGenerator ( boost::shared_ptr< MockProducerExecStreamGenerator > const &  generatorInit,
float  rate,
uint  nRows,
uint  nColumnsInit,
uint  nClumps 
) [inline, explicit]

Definition at line 95 of file SamplingExecStreamGenerator.h.

References clumpDistance, and clumpSize.

00098         : generator(generatorInit),
00099           nColumns(nColumnsInit),
00100           iChildRow((uint) -1),
00101           iLastRow((uint) -1),
00102           clumpPos((uint) -1)
00103     {
00104         uint sampleSize = (uint)round((double)nRows * (double)rate);
00105         clumpSize = (uint)round((double)sampleSize / (double)nClumps);
00106         clumpDistance =
00107             (uint)round((double)(nRows - sampleSize) / (double)(nClumps - 1));
00108 
00109         uint rowsRequired =
00110             (clumpSize + clumpDistance) * (nClumps - 1) + clumpSize;
00111         if (rowsRequired > nRows && clumpDistance > 0) {
00112             clumpDistance--;
00113         }
00114 
00115 //        std::cout << "sampleSize " << sampleSize << std::endl;
00116 //        std::cout << "clumpSize " << clumpSize << std::endl;
00117 //        std::cout << "clumpDistance " << clumpDistance << std::endl;
00118     }


Member Function Documentation

virtual int64_t SystemSamplingExecStreamGenerator::generateValue ( uint  iRow,
uint  iCol 
) [inline, virtual]

Generates one data value.

Parameters:
iRow 0-based row number to generate
iCol 0-based col number to generate

Implements MockProducerExecStreamGenerator.

Definition at line 120 of file SamplingExecStreamGenerator.h.

References clumpDistance, clumpPos, clumpSize, generator, iChildRow, iLastRow, and nColumns.

00121     {
00122         if (iRow != iLastRow) {
00123             assert(iCol == 0);
00124 
00125             iChildRow++;
00126             clumpPos++;
00127 
00128             if (clumpPos >= clumpSize) {
00129                 // Skip clumpDistance rows
00130                 for (uint i = 0; i < clumpDistance; i++) {
00131 //                    std::cout << "skip " << iChildRow << std::endl;
00132                     for (int j = 0; j < nColumns; j++) {
00133                         generator->generateValue(iChildRow, j);
00134                     }
00135                     iChildRow++;
00136                 }
00137                 clumpPos = 0;
00138             }
00139             iLastRow = iRow;
00140 
00141 //            std::cout << "gen " << iChildRow << std::endl;
00142         }
00143 
00144         return generator->generateValue(iChildRow, iCol);
00145     }


Member Data Documentation

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

Definition at line 84 of file SamplingExecStreamGenerator.h.

Referenced by generateValue().

uint SystemSamplingExecStreamGenerator::nColumns [protected]

Definition at line 86 of file SamplingExecStreamGenerator.h.

Referenced by generateValue().

uint SystemSamplingExecStreamGenerator::iChildRow [protected]

Definition at line 87 of file SamplingExecStreamGenerator.h.

Referenced by generateValue().

uint SystemSamplingExecStreamGenerator::iLastRow [protected]

Definition at line 88 of file SamplingExecStreamGenerator.h.

Referenced by generateValue().

uint SystemSamplingExecStreamGenerator::clumpSize [protected]

Definition at line 90 of file SamplingExecStreamGenerator.h.

Referenced by generateValue(), and SystemSamplingExecStreamGenerator().

uint SystemSamplingExecStreamGenerator::clumpDistance [protected]

Definition at line 91 of file SamplingExecStreamGenerator.h.

Referenced by generateValue(), and SystemSamplingExecStreamGenerator().

uint SystemSamplingExecStreamGenerator::clumpPos [protected]

Definition at line 92 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:47 2009 for Fennel by  doxygen 1.5.1