#include <SamplingExecStreamGenerator.h>
Inheritance diagram for SystemSamplingExecStreamGenerator:
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< MockProducerExecStreamGenerator > | generator |
uint | nColumns |
uint | iChildRow |
uint | iLastRow |
uint | clumpSize |
uint | clumpDistance |
uint | clumpPos |
Definition at line 80 of file SamplingExecStreamGenerator.h.
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 }
virtual int64_t SystemSamplingExecStreamGenerator::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 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 }
boost::shared_ptr<MockProducerExecStreamGenerator> SystemSamplingExecStreamGenerator::generator [protected] |
uint SystemSamplingExecStreamGenerator::nColumns [protected] |
uint SystemSamplingExecStreamGenerator::iChildRow [protected] |
uint SystemSamplingExecStreamGenerator::iLastRow [protected] |
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] |